ruby-vpi 16.0.1 → 17.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -19
- data/README +1 -1
- data/Rakefile +35 -32
- data/bin/convert.rb +28 -0
- data/bin/generate/design.rb +16 -0
- data/bin/generate/proto.rb +13 -0
- data/bin/generate/runner.rake +33 -0
- data/bin/generate/spec.rb +45 -0
- data/bin/generate.rb +177 -0
- data/bin/ruby-vpi +56 -0
- data/doc/Rakefile +20 -4
- data/doc/common.css +92 -33
- data/doc/common.inc +13 -0
- data/doc/common.tpl +42 -28
- data/doc/history.doc +11 -11
- data/doc/history.html +769 -248
- data/doc/history.inc +909 -0
- data/doc/history.rb +9 -0
- data/doc/history.yaml +69 -0
- data/doc/intro.inc +170 -178
- data/doc/lib/doc_format.rb +57 -144
- data/doc/lib/doc_proxy.rb +504 -88
- data/doc/lib/erb_content.rb +8 -8
- data/doc/lib/erb_proxy.rb +17 -17
- data/doc/manual.doc +626 -777
- data/doc/manual.html +1541 -1031
- data/doc/memo.doc +38 -36
- data/doc/memo.html +64 -28
- data/doc/readme.doc +4 -31
- data/doc/readme.html +221 -163
- data/doc/rss.erb +1 -1
- data/doc/rss.xml +73 -1761
- data/ext/Rakefile +6 -5
- data/ext/main.c +17 -15
- data/ext/relay.c +4 -7
- data/ext/relay.h +2 -2
- data/ext/swig_vpi.h +2 -2
- data/ext/swig_vpi.i +1 -2
- data/ext/swig_wrap.cin +12 -16
- data/ext/vlog.c +5 -5
- data/ext/vlog.h +2 -2
- data/lib/ruby-vpi/erb.rb +3 -3
- data/lib/ruby-vpi/float.rb +2 -2
- data/lib/ruby-vpi/rcov.rb +5 -7
- data/lib/ruby-vpi/runner.rb +43 -41
- data/lib/ruby-vpi/runner_boot_loader.rb +117 -0
- data/lib/ruby-vpi/runner_proxy.rb +6 -8
- data/lib/ruby-vpi/util.rb +10 -0
- data/lib/ruby-vpi/verilog_parser.rb +28 -56
- data/lib/ruby-vpi/vpi.rb +168 -123
- data/lib/ruby-vpi.rb +22 -143
- data/ref/c/annotated.html +1 -1
- data/ref/c/common_8h.html +1 -1
- data/ref/c/files.html +1 -1
- data/ref/c/functions.html +1 -1
- data/ref/c/functions_vars.html +1 -1
- data/ref/c/globals.html +1 -1
- data/ref/c/globals_0x63.html +1 -1
- data/ref/c/globals_0x65.html +1 -1
- data/ref/c/globals_0x66.html +1 -1
- data/ref/c/globals_0x6d.html +1 -1
- data/ref/c/globals_0x70.html +1 -1
- data/ref/c/globals_0x72.html +1 -1
- data/ref/c/globals_0x73.html +1 -1
- data/ref/c/globals_0x74.html +1 -1
- data/ref/c/globals_0x76.html +1 -1
- data/ref/c/globals_0x78.html +1 -1
- data/ref/c/globals_defs.html +1 -1
- data/ref/c/globals_defs_0x65.html +1 -1
- data/ref/c/globals_defs_0x70.html +1 -1
- data/ref/c/globals_defs_0x76.html +1 -1
- data/ref/c/globals_defs_0x78.html +1 -1
- data/ref/c/globals_enum.html +1 -1
- data/ref/c/globals_eval.html +1 -1
- data/ref/c/globals_func.html +1 -1
- data/ref/c/globals_type.html +1 -1
- data/ref/c/globals_vars.html +1 -1
- data/ref/c/index.html +1 -1
- data/ref/c/main_8c.html +1 -1
- data/ref/c/main_8h.html +1 -1
- data/ref/c/relay_8c.html +1 -1
- data/ref/c/relay_8h.html +1 -1
- data/ref/c/structt__cb__data.html +1 -1
- data/ref/c/structt__vpi__delay.html +1 -1
- data/ref/c/structt__vpi__error__info.html +1 -1
- data/ref/c/structt__vpi__strengthval.html +1 -1
- data/ref/c/structt__vpi__systf__data.html +1 -1
- data/ref/c/structt__vpi__time.html +1 -1
- data/ref/c/structt__vpi__value.html +1 -1
- data/ref/c/structt__vpi__vecval.html +1 -1
- data/ref/c/structt__vpi__vlog__info.html +1 -1
- data/ref/c/verilog_8h.html +1 -1
- data/ref/c/vlog_8c.html +1 -1
- data/ref/c/vlog_8h.html +1 -1
- data/ref/c/vpi__user_8h.html +1 -1
- data/ref/ruby/classes/ERB.html +5 -5
- data/ref/ruby/classes/ERB.src/{M000024.html → M000026.html} +0 -0
- data/ref/ruby/classes/FileUtils.html +11 -11
- data/ref/ruby/classes/FileUtils.src/{M000025.html → M000027.html} +0 -0
- data/ref/ruby/classes/FileUtils.src/{M000026.html → M000028.html} +0 -0
- data/ref/ruby/classes/Float.html +6 -6
- data/ref/ruby/classes/Float.src/{M000020.html → M000021.html} +0 -0
- data/ref/ruby/classes/Integer.html +65 -65
- data/ref/ruby/classes/Integer.src/M000009.html +12 -5
- data/ref/ruby/classes/Integer.src/M000010.html +5 -5
- data/ref/ruby/classes/Integer.src/M000011.html +5 -5
- data/ref/ruby/classes/Integer.src/M000012.html +5 -5
- data/ref/ruby/classes/Integer.src/M000013.html +5 -5
- data/ref/ruby/classes/Integer.src/M000014.html +18 -0
- data/ref/ruby/classes/Integer.src/M000017.html +12 -18
- data/ref/ruby/classes/Integer.src/M000018.html +18 -12
- data/ref/ruby/classes/Integer.src/M000019.html +12 -17
- data/ref/ruby/classes/Integer.src/M000020.html +30 -0
- data/ref/ruby/classes/RDoc.html +5 -5
- data/ref/ruby/classes/RDoc.src/{M000053.html → M000058.html} +0 -0
- data/ref/ruby/classes/{RubyVpi/Config.html → RubyVPI.html} +20 -6
- data/ref/ruby/classes/String.html +34 -15
- data/ref/ruby/classes/String.src/M000022.html +5 -28
- data/ref/ruby/classes/String.src/M000023.html +5 -5
- data/ref/ruby/classes/String.src/{M000021.html → M000024.html} +0 -0
- data/ref/ruby/classes/String.src/M000025.html +41 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.html +16 -36
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000006.html +10 -5
- data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000004.html → M000007.html} +4 -4
- data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000005.html → M000008.html} +4 -4
- data/ref/ruby/classes/VerilogParser/Module.html +28 -9
- data/ref/ruby/classes/VerilogParser/Module.src/M000005.html +29 -0
- data/ref/ruby/classes/VerilogParser.html +5 -39
- data/ref/ruby/classes/VerilogParser.src/M000004.html +26 -0
- data/ref/ruby/classes/Vpi/Handle.html +179 -77
- data/ref/ruby/classes/Vpi/Handle.src/M000035.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000036.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000037.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000038.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000039.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000040.html +5 -8
- data/ref/ruby/classes/Vpi/Handle.src/M000041.html +5 -8
- data/ref/ruby/classes/Vpi/Handle.src/M000042.html +5 -9
- data/ref/ruby/classes/Vpi/Handle.src/M000043.html +8 -31
- data/ref/ruby/classes/Vpi/Handle.src/M000044.html +8 -74
- data/ref/ruby/classes/Vpi/Handle.src/M000045.html +9 -17
- data/ref/ruby/classes/Vpi/Handle.src/M000046.html +31 -11
- data/ref/ruby/classes/Vpi/Handle.src/M000047.html +86 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000048.html +17 -18
- data/ref/ruby/classes/Vpi/Handle.src/M000050.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000051.html +24 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000053.html +31 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000054.html +89 -0
- data/ref/ruby/classes/Vpi/S_vpi_time.html +16 -16
- data/ref/ruby/classes/Vpi/S_vpi_time.src/{M000050.html → M000055.html} +4 -4
- data/ref/ruby/classes/Vpi/S_vpi_time.src/{M000051.html → M000056.html} +5 -5
- data/ref/ruby/classes/Vpi/S_vpi_value.html +15 -15
- data/ref/ruby/classes/Vpi/S_vpi_value.src/{M000035.html → M000032.html} +5 -5
- data/ref/ruby/classes/Vpi/S_vpi_value.src/M000033.html +5 -5
- data/ref/ruby/classes/Vpi/S_vpi_value.src/M000034.html +5 -5
- data/ref/ruby/classes/Vpi.html +6 -42
- data/ref/ruby/classes/Vpi.src/M000029.html +15 -5
- data/ref/ruby/classes/Vpi.src/M000030.html +24 -24
- data/ref/ruby/classes/Vpi.src/M000031.html +6 -8
- data/ref/ruby/created.rid +1 -1
- data/ref/ruby/files/bin/{header_to_ruby_rb.html → convert_rb.html} +5 -5
- data/ref/ruby/files/bin/{generate_test_rb.html → generate_rb.html} +8 -21
- data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/float_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/runner_boot_loader_rb.html +197 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_boot_loader_rb.src/M000001.html +17 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_boot_loader_rb.src/M000002.html +18 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +6 -19
- data/ref/ruby/files/lib/ruby-vpi/util_rb.html +101 -0
- data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +8 -1
- data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi_rb.html +2 -14
- data/ref/ruby/fr_class_index.html +1 -3
- data/ref/ruby/fr_file_index.html +4 -2
- data/ref/ruby/fr_method_index.html +56 -51
- data/ref/ruby/index.html +1 -1
- data/samp/counter/RSpec/Rakefile +1 -0
- data/samp/counter/RSpec/counter_design.rb +15 -0
- data/samp/counter/RSpec/counter_proto.rb +10 -0
- data/samp/counter/RSpec/counter_runner.rake +44 -0
- data/samp/counter/RSpec/counter_spec.rb +39 -0
- data/samp/counter/Rakefile +1 -1
- data/samp/counter/counter.v +7 -7
- data/samp/counter/xUnit/Rakefile +1 -0
- data/samp/counter/xUnit/counter_bench.rb +95 -0
- data/samp/counter/{counter_xunit_bench.v → xUnit/counter_bench.v} +0 -0
- data/samp/counter/xUnit/counter_design.rb +15 -0
- data/samp/counter/xUnit/counter_proto.rb +10 -0
- data/samp/counter/xUnit/counter_runner.rake +44 -0
- data/samp/counter/{counter_xunit_spec.rb → xUnit/counter_spec.rb} +9 -9
- data/samp/pipelined_alu/Rakefile +1 -1
- data/samp/pipelined_alu/TestHw5UnitModel.rb +4 -5
- data/samp/pipelined_alu/hw5_unit.v +55 -85
- data/samp/pipelined_alu/hw5_unit_design.rb +51 -0
- data/samp/pipelined_alu/hw5_unit_proto.rb +4 -0
- data/samp/pipelined_alu/hw5_unit_runner.rake +43 -0
- data/samp/pipelined_alu/hw5_unit_spec.rb +64 -0
- data/samp/register_file/LICENSE +20 -0
- data/samp/register_file/README +4 -0
- data/samp/register_file/Rakefile +1 -0
- data/samp/register_file/register_file.v +18 -0
- data/samp/register_file/register_file_design.rb +11 -0
- data/samp/register_file/register_file_proto.rb +11 -0
- data/samp/register_file/register_file_runner.rake +43 -0
- data/samp/register_file/register_file_spec.rb +58 -0
- metadata +78 -66
- data/bin/generate_test.rb +0 -200
- data/bin/generate_test_tpl/bench.rb +0 -89
- data/bin/generate_test_tpl/bench.v +0 -26
- data/bin/generate_test_tpl/design.rb +0 -11
- data/bin/generate_test_tpl/proto.rb +0 -16
- data/bin/generate_test_tpl/runner.rake +0 -42
- data/bin/generate_test_tpl/spec.rb +0 -37
- data/bin/header_to_ruby.rb +0 -27
- data/ref/ruby/classes/Integer.src/M000008.html +0 -25
- data/ref/ruby/classes/Integer.src/M000016.html +0 -25
- data/ref/ruby/classes/RubyVpi.html +0 -199
- data/ref/ruby/classes/RubyVpi.src/M000027.html +0 -121
- data/ref/ruby/classes/VerilogParser/Module/Parameter.html +0 -160
- data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000007.html +0 -19
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000003.html +0 -21
- data/ref/ruby/classes/VerilogParser/Module.src/M000002.html +0 -34
- data/ref/ruby/classes/VerilogParser.src/M000001.html +0 -34
- data/ref/ruby/classes/Vpi/Handle.src/M000049.html +0 -69
- data/ref/ruby/classes/Vpi.src/M000028.html +0 -28
- data/ref/ruby/classes/Vpi.src/M000032.html +0 -22
- data/samp/counter/counter_rspec_bench.rb +0 -86
- data/samp/counter/counter_rspec_bench.v +0 -9
- data/samp/counter/counter_rspec_design.rb +0 -8
- data/samp/counter/counter_rspec_proto.rb +0 -13
- data/samp/counter/counter_rspec_runner.rake +0 -52
- data/samp/counter/counter_rspec_spec.rb +0 -39
- data/samp/counter/counter_xunit_bench.rb +0 -86
- data/samp/counter/counter_xunit_design.rb +0 -8
- data/samp/counter/counter_xunit_proto.rb +0 -13
- data/samp/counter/counter_xunit_runner.rake +0 -52
- data/samp/pipelined_alu/hw5_unit_test_bench.rb +0 -86
- data/samp/pipelined_alu/hw5_unit_test_bench.v +0 -14
- data/samp/pipelined_alu/hw5_unit_test_design.rb +0 -61
- data/samp/pipelined_alu/hw5_unit_test_proto.rb +0 -7
- data/samp/pipelined_alu/hw5_unit_test_runner.rake +0 -52
- data/samp/pipelined_alu/hw5_unit_test_spec.rb +0 -68
data/LICENSE
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
Copyright
|
1
|
+
Copyright 2006 Suraj N. Kurapati <snk@gna.org>
|
2
2
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
9
|
|
10
|
-
All copies and portions of the Software
|
11
|
-
their corresponding machine-readable source code (the
|
12
|
-
above copyright notice and this permission notice.
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
1. All modified and unmodified copies and substantial portions of the Software
|
11
|
+
(the "Derivatives") and their corresponding machine-readable source code (the
|
12
|
+
"Code") must include the above copyright notice and this permission notice.
|
13
|
+
|
14
|
+
2. Upon distribution, the Derivatives must be accompanied either by the Code or,
|
15
|
+
if the Code is obtainable for no more than the cost of distribution plus a
|
16
|
+
nominal fee, by information on how to obtain the Code.
|
16
17
|
|
17
18
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
THE SOFTWARE.
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
20
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
21
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
22
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
23
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Please see ./index.html or ./doc/readme.html in your
|
1
|
+
Please see ./index.html or ./doc/readme.html in your web browser.
|
data/Rakefile
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
# CFLAGS:: Arguments to the compiler.
|
3
3
|
# LDFLAGS:: Arguments to the linker.
|
4
4
|
#--
|
5
|
-
# Copyright 2006
|
5
|
+
# Copyright 2006 Suraj N. Kurapati
|
6
6
|
# See the file named LICENSE for details.
|
7
7
|
|
8
|
-
CFLAGS, LDFLAGS = ENV['CFLAGS'], ENV['LDFLAGS']
|
9
|
-
|
10
8
|
require 'rake/clean'
|
11
9
|
require 'rake/rdoctask'
|
12
10
|
require 'rake/gempackagetask'
|
@@ -24,21 +22,22 @@ task :default => :build
|
|
24
22
|
|
25
23
|
|
26
24
|
# load project information
|
27
|
-
include
|
28
|
-
PROJECT_SSH_URL
|
25
|
+
include RubyVPI
|
26
|
+
PROJECT_SSH_URL = "snk@rubyforge.org:/var/www/gforge-projects/#{PROJECT_ID}"
|
29
27
|
|
30
28
|
load 'doc/history.rb'
|
31
|
-
head
|
32
|
-
PROJECT_VERSION
|
29
|
+
head = @history.first
|
30
|
+
PROJECT_VERSION = head['Version']
|
33
31
|
PROJECT_BIRTHDAY = head['Date']
|
34
32
|
|
35
33
|
|
36
34
|
# utility
|
37
35
|
|
38
|
-
# Returns a temporary, unique path ready for
|
39
|
-
# returned path.
|
36
|
+
# Returns a temporary, unique path ready for
|
37
|
+
# use. No file exists at the returned path.
|
40
38
|
def generate_temp_path
|
41
|
-
|
39
|
+
path = Tempfile.new($$).path
|
40
|
+
rm_f path
|
42
41
|
path
|
43
42
|
end
|
44
43
|
|
@@ -48,7 +47,7 @@ task :default => :build
|
|
48
47
|
end
|
49
48
|
|
50
49
|
# propogate cleaning tasks recursively to lower levels
|
51
|
-
[
|
50
|
+
%w[clean clobber].each do |t|
|
52
51
|
task t do
|
53
52
|
files = FileList['**/Rakefile'].exclude('_darcs')
|
54
53
|
files.shift # avoid infinite loop on _this_ file
|
@@ -58,7 +57,7 @@ task :default => :build
|
|
58
57
|
|
59
58
|
files.each do |f|
|
60
59
|
cd File.dirname(f) do
|
61
|
-
sh 'rake', t
|
60
|
+
sh 'rake', t
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
@@ -73,6 +72,9 @@ task :default => :build
|
|
73
72
|
directory 'obj'
|
74
73
|
CLOBBER.include 'obj'
|
75
74
|
|
75
|
+
ccFlags = ENV['CFLAGS']
|
76
|
+
ldFlags = ENV['LDFLAGS']
|
77
|
+
|
76
78
|
SIMULATORS.each_pair do |id, sim|
|
77
79
|
taskName = "build_#{id}"
|
78
80
|
|
@@ -83,8 +85,8 @@ task :default => :build
|
|
83
85
|
|
84
86
|
unless File.exist? dst
|
85
87
|
cd 'ext' do
|
86
|
-
ENV['CFLAGS']
|
87
|
-
ENV['LDFLAGS'] = "#{
|
88
|
+
ENV['CFLAGS'] = "#{ccFlags} #{sim.compiler_args}"
|
89
|
+
ENV['LDFLAGS'] = "#{ldFlags} #{sim.linker_args}"
|
88
90
|
|
89
91
|
sh 'rake'
|
90
92
|
mv src, dst
|
@@ -120,7 +122,7 @@ task :default => :build
|
|
120
122
|
desc 'Generate reference for Ruby.'
|
121
123
|
Rake::RDocTask.new 'ref/ruby' do |t|
|
122
124
|
t.rdoc_dir = t.name
|
123
|
-
t.title
|
125
|
+
t.title = "#{PROJECT_NAME}: #{PROJECT_SUMMARY}"
|
124
126
|
t.options.concat %w(--charset utf-8 --line-numbers)
|
125
127
|
t.rdoc_files.include '{bin,lib/**}/*.rb'
|
126
128
|
end
|
@@ -200,25 +202,26 @@ task :default => :build
|
|
200
202
|
end
|
201
203
|
|
202
204
|
spec = Gem::Specification.new do |s|
|
203
|
-
s.name
|
204
|
-
s.
|
205
|
-
s.
|
206
|
-
s.
|
207
|
-
s.
|
208
|
-
|
209
|
-
|
210
|
-
s.add_dependency '
|
211
|
-
s.add_dependency '
|
212
|
-
s.add_dependency '
|
205
|
+
s.name = PROJECT_ID
|
206
|
+
s.rubyforge_project = PROJECT_ID
|
207
|
+
s.summary = PROJECT_SUMMARY
|
208
|
+
s.description = PROJECT_DETAIL
|
209
|
+
s.homepage = PROJECT_URL
|
210
|
+
s.version = PROJECT_VERSION
|
211
|
+
|
212
|
+
s.add_dependency 'rake', '>= 0.7.0'
|
213
|
+
s.add_dependency 'rspec', '>= 1.0.0'
|
214
|
+
s.add_dependency 'rcov', '>= 0.7.0'
|
215
|
+
s.add_dependency 'xx' # needed by rcov
|
213
216
|
s.add_dependency 'ruby-debug', '>= 0.5.2'
|
214
217
|
|
215
218
|
s.requirements << "POSIX threads library"
|
216
219
|
s.requirements << "C language compiler"
|
217
220
|
|
218
|
-
s.files
|
221
|
+
s.files = FileList['**/*'].exclude('_darcs')
|
219
222
|
s.autorequire = PROJECT_ID
|
220
223
|
s.extensions << 'gem_extconf.rb'
|
221
|
-
s.executables =
|
224
|
+
s.executables = PROJECT_ID
|
222
225
|
end
|
223
226
|
|
224
227
|
Rake::GemPackageTask.new(spec) do |pkg|
|
@@ -231,9 +234,9 @@ task :default => :build
|
|
231
234
|
desc "Configures the gem during installation."
|
232
235
|
task :gem_config_inst do |t|
|
233
236
|
# make documentation available to gem_server
|
234
|
-
gemDir
|
237
|
+
gemDir = File.dirname(__FILE__)
|
235
238
|
gemName = File.basename(gemDir)
|
236
|
-
docDir
|
239
|
+
docDir = File.join('..', '..', 'doc', gemName)
|
237
240
|
|
238
241
|
mkdir_p docDir
|
239
242
|
ln_s gemDir, File.join(docDir, 'rdoc')
|
@@ -247,9 +250,9 @@ task :default => :build
|
|
247
250
|
# ensures that current sources are tested instead of the installed gem
|
248
251
|
ENV['RUBYLIB'] = PROJECT_LIBS
|
249
252
|
|
250
|
-
FileList['samp
|
251
|
-
cd
|
252
|
-
sh 'rake', ENV['SIMULATOR'] || 'cver'
|
253
|
+
FileList['samp/**/*.rake'].each do |runner|
|
254
|
+
cd File.dirname(runner) do
|
255
|
+
sh 'rake', '-f', File.basename(runner), ENV['SIMULATOR'] || 'cver'
|
253
256
|
end
|
254
257
|
end
|
255
258
|
end
|
data/bin/convert.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Converts Verilog source code into Ruby.
|
2
|
+
# * The standard input stream is read if no input files are specified.
|
3
|
+
# * Output is written to the standard output stream.
|
4
|
+
|
5
|
+
#--
|
6
|
+
# Copyright 2006 Suraj N. Kurapati
|
7
|
+
# See the file named LICENSE for details.
|
8
|
+
|
9
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
10
|
+
|
11
|
+
# parse command-line options
|
12
|
+
require 'optparse'
|
13
|
+
|
14
|
+
opts = OptionParser.new
|
15
|
+
opts.banner = "Usage: ruby-vpi convert [options] [files]"
|
16
|
+
|
17
|
+
opts.on '-h', '--help', 'show this help message' do
|
18
|
+
require 'ruby-vpi/rdoc'
|
19
|
+
RDoc.usage_from_file __FILE__
|
20
|
+
|
21
|
+
puts opts
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.parse! ARGV
|
26
|
+
|
27
|
+
require 'ruby-vpi/verilog_parser'
|
28
|
+
puts ARGF.read.verilog_to_ruby
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% clock = aModuleInfo.clock_port.name rescue "YOUR_CLOCK_SIGNAL_HERE" %>
|
2
|
+
# Simulates the design under test for one clock cycle.
|
3
|
+
def cycle!
|
4
|
+
<%= clock %>.high!
|
5
|
+
advance_time
|
6
|
+
<%= clock %>.low!
|
7
|
+
advance_time
|
8
|
+
end
|
9
|
+
|
10
|
+
<% reset = aModuleInfo.reset_port.name rescue "YOUR_RESET_SIGNAL_HERE" %>
|
11
|
+
# Brings the design under test into a blank state.
|
12
|
+
def reset!
|
13
|
+
<%= reset %>.high!
|
14
|
+
cycle!
|
15
|
+
<%= reset %>.low!
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Ruby prototype of the design under test's Verilog implementation.
|
2
|
+
def feign!
|
3
|
+
if <%= aModuleInfo.clock_port.name rescue "YOUR_CLOCK_SIGNAL_HERE" %>.posedge?
|
4
|
+
# discard old outputs
|
5
|
+
<% aModuleInfo.output_ports.each do |port| %>
|
6
|
+
<%= port.name %>.x!
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
# process new inputs
|
10
|
+
|
11
|
+
# produce new outputs
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Array of paths and shell globs (see the Dir.glob method's documentation for
|
2
|
+
# details) to source files and directories that contain source files. These
|
3
|
+
# source files will be loaded by the simulator before the simulation begins.
|
4
|
+
SIMULATOR_SOURCES = FileList[
|
5
|
+
'<%= aModuleInfo.name %>.v',
|
6
|
+
]
|
7
|
+
|
8
|
+
# Command-line arguments for the simulator. These arguments can be
|
9
|
+
# specified as a string or an array of strings, as demonstrated below:
|
10
|
+
#
|
11
|
+
# :cver => "this is a single string argument",
|
12
|
+
# :cver => ["these", "are", "separate", "arguments"],
|
13
|
+
# :cver => %w[these are also separate arguments],
|
14
|
+
#
|
15
|
+
SIMULATOR_ARGUMENTS = {
|
16
|
+
<% RubyVPI::SIMULATORS.each_pair do |id, sim| %>
|
17
|
+
# <%= sim.name %>
|
18
|
+
:<%= id %> => "",
|
19
|
+
|
20
|
+
<% end %>
|
21
|
+
}
|
22
|
+
|
23
|
+
# This task is invoked before the simulator runs. It
|
24
|
+
# can be used to make preprations, such as converting
|
25
|
+
# Verilog header files into Ruby, for the simulation.
|
26
|
+
task :setup do
|
27
|
+
# To learn how to write Rake tasks, please see:
|
28
|
+
# http://docs.rubyrake.org/read/chapter/4#page16
|
29
|
+
end
|
30
|
+
|
31
|
+
# This command loads the Ruby-VPI runner template,
|
32
|
+
# which runs the simulator using the above parameters.
|
33
|
+
require 'ruby-vpi/runner'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<% dut = aOutputInfo.designClassName %>
|
2
|
+
|
3
|
+
<% case aOutputInfo.specFormat %>
|
4
|
+
<% when :xUnit %>
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
class <%= aOutputInfo.specClassName %> < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
<%= dut %>.reset!
|
10
|
+
end
|
11
|
+
<% aModuleInfo.ports.each do |port| %>
|
12
|
+
|
13
|
+
def test_<%= port.name %>
|
14
|
+
# assert <%= dut %>.<%= port.name %> ..., "<%= port.name %> should ..."
|
15
|
+
end
|
16
|
+
<% end %>
|
17
|
+
end
|
18
|
+
<% when :tSpec %>
|
19
|
+
require 'test/spec'
|
20
|
+
|
21
|
+
context "A resetted <%= dut %>" do
|
22
|
+
setup do
|
23
|
+
<%= dut %>.reset!
|
24
|
+
end
|
25
|
+
|
26
|
+
specify "should ..." do
|
27
|
+
# <%= dut %>.should ...
|
28
|
+
end
|
29
|
+
end
|
30
|
+
<% when :rSpec %>
|
31
|
+
require 'spec'
|
32
|
+
|
33
|
+
describe <%= dut %>, " when resetted" do
|
34
|
+
before do
|
35
|
+
<%= dut %>.reset!
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should ..." do
|
39
|
+
# <%= dut %>.should ...
|
40
|
+
end
|
41
|
+
end
|
42
|
+
<% else %>
|
43
|
+
<%= dut %>.reset!
|
44
|
+
# raise "should ..." unless <%= dut %> ...
|
45
|
+
<% end %>
|
data/bin/generate.rb
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
# Generates Ruby-VPI tests from Verilog 2001 and Verilog 95 module declarations.
|
2
|
+
#
|
3
|
+
# * The standard input stream is read if no input files are specified.
|
4
|
+
#
|
5
|
+
# = Progress indicators
|
6
|
+
#
|
7
|
+
# module:: A Verilog module has been identified.
|
8
|
+
#
|
9
|
+
# create:: A file is being created because it does not exist.
|
10
|
+
#
|
11
|
+
# skip:: A file is being skipped because it is already up to date.
|
12
|
+
#
|
13
|
+
# update:: A file will be updated because it is out of date. A text
|
14
|
+
# merging tool (see MERGER) will be launched to transfer
|
15
|
+
# content from the old file (*.old) and the new file (*.new)
|
16
|
+
# to the out of date file. If a text merging tool is not
|
17
|
+
# specified, then you will have to do the merging by hand.
|
18
|
+
#
|
19
|
+
#
|
20
|
+
# = Environment variables
|
21
|
+
#
|
22
|
+
# MERGER:: A command that invokes a text merging tool with three
|
23
|
+
# arguments: (1) old file, (2) new file, (3) output file.
|
24
|
+
# The tool's output should be written to the output file.
|
25
|
+
|
26
|
+
#--
|
27
|
+
# Copyright 2006-2007 Suraj N. Kurapati
|
28
|
+
# See the file named LICENSE for details.
|
29
|
+
|
30
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
31
|
+
|
32
|
+
require 'ruby-vpi' # for project info
|
33
|
+
require 'ruby-vpi/verilog_parser'
|
34
|
+
require 'fileutils'
|
35
|
+
require 'digest/md5'
|
36
|
+
|
37
|
+
|
38
|
+
# Notify the user about some action being performed.
|
39
|
+
def notify *args # :nodoc:
|
40
|
+
printf "%8s %s\n", *args
|
41
|
+
end
|
42
|
+
|
43
|
+
# Writes the given contents to the file at the given path. If the given path
|
44
|
+
# already exists, then a backup is created before invoking the merging tool.
|
45
|
+
def write_file aPath, aContent # :nodoc:
|
46
|
+
if File.exist? aPath
|
47
|
+
oldDigest = Digest::MD5.digest(File.read(aPath))
|
48
|
+
newDigest = Digest::MD5.digest(aContent)
|
49
|
+
|
50
|
+
if oldDigest == newDigest
|
51
|
+
notify :skip, aPath
|
52
|
+
else
|
53
|
+
notify :update, aPath
|
54
|
+
cur, old, new = aPath, "#{aPath}.old", "#{aPath}.new"
|
55
|
+
|
56
|
+
FileUtils.cp cur, old, :preserve => true
|
57
|
+
File.open(new, 'w') {|f| f << aContent}
|
58
|
+
|
59
|
+
if m = ENV['MERGER']
|
60
|
+
system "#{m} #{old.inspect} #{new.inspect} #{cur.inspect}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
else
|
64
|
+
notify :create, aPath
|
65
|
+
File.open(aPath, 'w') {|f| f << aContent}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
require 'ruby-vpi/erb'
|
71
|
+
|
72
|
+
# Template used for generating output.
|
73
|
+
class Template < ERB # :nodoc:
|
74
|
+
TEMPLATE_PATH = __FILE__.sub(/\.rb$/, '')
|
75
|
+
|
76
|
+
def initialize aName
|
77
|
+
super File.read(File.join(TEMPLATE_PATH, aName))
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
# Holds information about the output destinations of a parsed Verilog module.
|
83
|
+
class OutputInfo # :nodoc:
|
84
|
+
RUBY_EXT = '.rb'
|
85
|
+
VERILOG_EXT = '.v'
|
86
|
+
RUNNER_EXT = '.rake'
|
87
|
+
|
88
|
+
DESIGN_SUFFIX = '_design'
|
89
|
+
SPEC_SUFFIX = '_spec'
|
90
|
+
RUNNER_SUFFIX = '_runner'
|
91
|
+
PROTO_SUFFIX = '_proto'
|
92
|
+
|
93
|
+
SPEC_FORMATS = [:rSpec, :tSpec, :xUnit, :generic]
|
94
|
+
|
95
|
+
attr_reader :designPath, :designName, :designClassName,
|
96
|
+
:specPath, :specName, :specClassName, :specFormat,
|
97
|
+
:runnerPath, :runnerName,
|
98
|
+
:protoPath, :protoName
|
99
|
+
|
100
|
+
def initialize aModuleName, aSpecFormat
|
101
|
+
raise ArgumentError unless SPEC_FORMATS.include? aSpecFormat
|
102
|
+
@specFormat = aSpecFormat
|
103
|
+
|
104
|
+
@designName = aModuleName + DESIGN_SUFFIX
|
105
|
+
@designPath = @designName + RUBY_EXT
|
106
|
+
|
107
|
+
@protoName = aModuleName + PROTO_SUFFIX
|
108
|
+
@protoPath = @protoName + RUBY_EXT
|
109
|
+
|
110
|
+
@specName = aModuleName + SPEC_SUFFIX
|
111
|
+
@specPath = @specName + RUBY_EXT
|
112
|
+
|
113
|
+
@designClassName = aModuleName.to_ruby_const_name
|
114
|
+
@specClassName = @specName.to_ruby_const_name
|
115
|
+
|
116
|
+
@runnerName = aModuleName + RUNNER_SUFFIX
|
117
|
+
@runnerPath = @runnerName + RUNNER_EXT
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
# obtain templates for output generation
|
123
|
+
DESIGN_TEMPLATE = Template.new('design.rb')
|
124
|
+
PROTO_TEMPLATE = Template.new('proto.rb')
|
125
|
+
SPEC_TEMPLATE = Template.new('spec.rb')
|
126
|
+
RUNNER_TEMPLATE = Template.new('runner.rake')
|
127
|
+
|
128
|
+
|
129
|
+
# parse command-line options
|
130
|
+
require 'optparse'
|
131
|
+
|
132
|
+
optSpecFmt = :generic
|
133
|
+
optTestName = 'test'
|
134
|
+
|
135
|
+
opts = OptionParser.new
|
136
|
+
opts.banner = "Usage: ruby-vpi generate [options] [files]"
|
137
|
+
|
138
|
+
opts.on '-h', '--help', 'show this help message' do
|
139
|
+
require 'ruby-vpi/rdoc'
|
140
|
+
RDoc.usage_from_file __FILE__
|
141
|
+
|
142
|
+
puts opts
|
143
|
+
exit
|
144
|
+
end
|
145
|
+
|
146
|
+
opts.on '--xUnit',
|
147
|
+
'use xUnit (Test::Unit) specification format' do
|
148
|
+
optSpecFmt = :xUnit
|
149
|
+
end
|
150
|
+
|
151
|
+
opts.on '--rSpec',
|
152
|
+
'use rSpec specification format' do
|
153
|
+
optSpecFmt = :rSpec
|
154
|
+
end
|
155
|
+
|
156
|
+
opts.on '--tSpec',
|
157
|
+
'use test/spec specification format' do
|
158
|
+
optSpecFmt = :tSpec
|
159
|
+
end
|
160
|
+
|
161
|
+
opts.parse! ARGV
|
162
|
+
|
163
|
+
|
164
|
+
v = VerilogParser.new(ARGF.read)
|
165
|
+
v.modules.each do |m|
|
166
|
+
puts
|
167
|
+
notify :module, m.name
|
168
|
+
|
169
|
+
o = OutputInfo.new(m.name, optSpecFmt)
|
170
|
+
aParseInfo, aModuleInfo, aOutputInfo = v.freeze, m.freeze, o.freeze
|
171
|
+
|
172
|
+
write_file o.runnerPath, RUNNER_TEMPLATE.result(binding)
|
173
|
+
write_file o.designPath, DESIGN_TEMPLATE.result(binding)
|
174
|
+
write_file o.protoPath, PROTO_TEMPLATE.result(binding)
|
175
|
+
write_file o.specPath, SPEC_TEMPLATE.result(binding)
|
176
|
+
write_file 'Rakefile', "require 'ruby-vpi/runner_proxy'"
|
177
|
+
end
|
data/bin/ruby-vpi
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# This is a front-end for tools provided by Ruby-VPI.
|
2
|
+
#
|
3
|
+
# Usage:
|
4
|
+
# ruby-vpi Show this help message
|
5
|
+
# ruby-vpi TOOL --help Show help message for TOOL
|
6
|
+
# ruby-vpi TOOL arguments... Run TOOL with some arguments
|
7
|
+
|
8
|
+
#--
|
9
|
+
# Copyright 2006 Suraj N. Kurapati
|
10
|
+
# See the file named LICENSE for details.
|
11
|
+
|
12
|
+
TOOL_DIR = File.dirname(__FILE__)
|
13
|
+
TOOL_EXT = '.rb'
|
14
|
+
|
15
|
+
$: << File.join(TOOL_DIR, '..', 'lib')
|
16
|
+
|
17
|
+
|
18
|
+
def show_help_info
|
19
|
+
require 'ruby-vpi/rdoc'
|
20
|
+
RDoc.usage_from_file __FILE__
|
21
|
+
|
22
|
+
# show a list of available tools
|
23
|
+
puts "Tools:"
|
24
|
+
|
25
|
+
Dir[File.join(TOOL_DIR, "*#{TOOL_EXT}")].each do |file|
|
26
|
+
tool = File.basename file, TOOL_EXT
|
27
|
+
printf " %-10s %s", tool, File.new(file).readline.sub(/^#\s*/, '')
|
28
|
+
end
|
29
|
+
|
30
|
+
puts
|
31
|
+
|
32
|
+
# show a list of available simulators
|
33
|
+
require 'ruby-vpi'
|
34
|
+
puts "Simulators:"
|
35
|
+
|
36
|
+
RubyVPI::SIMULATORS.each_pair do |id, sim|
|
37
|
+
printf " %-10s %s\n", id, sim.name
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
unless ARGV.empty?
|
43
|
+
tool = ARGV.shift
|
44
|
+
glob = File.join(TOOL_DIR, tool + '*' + TOOL_EXT)
|
45
|
+
file = Dir[glob].first
|
46
|
+
|
47
|
+
begin
|
48
|
+
load file
|
49
|
+
rescue LoadError
|
50
|
+
show_help_info
|
51
|
+
puts '', '#' * 76
|
52
|
+
raise "Invalid tool: #{tool.inspect}"
|
53
|
+
end
|
54
|
+
else
|
55
|
+
show_help_info
|
56
|
+
end
|
data/doc/Rakefile
CHANGED
@@ -8,18 +8,31 @@ require 'rake/clean'
|
|
8
8
|
|
9
9
|
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
10
10
|
require 'ruby-vpi'
|
11
|
-
include
|
11
|
+
include RubyVPI
|
12
|
+
|
12
13
|
HISTORY_URL = WEBSITE_URL + "/history.html"
|
13
14
|
RSS_URL = WEBSITE_URL + '/rss.xml'
|
14
15
|
RSS_INFO = "RSS feed for this project."
|
15
16
|
|
16
17
|
require 'ruby-vpi/erb'
|
18
|
+
include ERB::Util
|
17
19
|
|
18
20
|
|
19
21
|
$: << File.join(File.dirname(__FILE__), 'lib')
|
20
22
|
require 'doc_proxy'
|
21
23
|
|
22
24
|
|
25
|
+
def resolve_includes aFilePath
|
26
|
+
input = File.read(aFilePath)
|
27
|
+
|
28
|
+
input.gsub! %r{<doc_proxy_include *(.*?)>} do
|
29
|
+
resolve_includes($1)
|
30
|
+
end
|
31
|
+
|
32
|
+
input
|
33
|
+
end
|
34
|
+
|
35
|
+
|
23
36
|
FileList['*.doc'].each do |src|
|
24
37
|
prefix = File.basename(src, File.extname(src))
|
25
38
|
helper = prefix + '.rb'
|
@@ -28,7 +41,7 @@ FileList['*.doc'].each do |src|
|
|
28
41
|
|
29
42
|
desc "Process file #{src.inspect}."
|
30
43
|
file dst => [src, 'common.tpl', *deps] do |t|
|
31
|
-
|
44
|
+
puts src
|
32
45
|
|
33
46
|
content = DocProxy.new.instance_eval do
|
34
47
|
# default output configuration
|
@@ -41,10 +54,14 @@ FileList['*.doc'].each do |src|
|
|
41
54
|
end
|
42
55
|
|
43
56
|
# evaluate the documentation file
|
44
|
-
|
57
|
+
input = resolve_includes(src)
|
58
|
+
File.open('input', 'w') {|f| f << input} if $DEBUG
|
59
|
+
|
60
|
+
template = ERB.new(input)
|
45
61
|
content = template.result(binding)
|
46
62
|
toc, content = post_process(content)
|
47
63
|
|
64
|
+
|
48
65
|
# fit result into common HTML format
|
49
66
|
template = ERB.new(File.read(t.prerequisites[1]))
|
50
67
|
template.result(binding)
|
@@ -52,7 +69,6 @@ FileList['*.doc'].each do |src|
|
|
52
69
|
|
53
70
|
File.open(dst, 'w') do |f|
|
54
71
|
f << content
|
55
|
-
puts f.path
|
56
72
|
end
|
57
73
|
end
|
58
74
|
|