ruby-vpi 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HEADER +15 -14
- data/HISTORY +36 -1
- data/MEMO +17 -14
- data/README +2 -19
- data/Rakefile +1 -2
- data/bin/generate_test.rb +4 -4
- data/bin/generate_test_tpl/bench.rb +1 -0
- data/bin/generate_test_tpl/bench.v +1 -1
- data/bin/header_to_ruby.rb +2 -2
- data/doc/background.organization.html +1 -1
- data/doc/hacking.html +3 -0
- data/doc/hacking.release-packages.html +7 -0
- data/doc/index.html +2 -2
- data/doc/manual.txt +69 -13
- data/doc/problem.ivl.html +3 -3
- data/doc/problems.html +1 -1
- data/doc/problems.ruby.html +1 -1
- data/doc/problems.vsim.html +1 -1
- data/doc/setup.installation.html +1 -1
- data/doc/src/manual.xml +130 -20
- data/doc/usage.examples.html +1 -1
- data/doc/usage.tutorial.html +1 -1
- data/header.html +15 -14
- data/header.part.html +15 -14
- data/history.html +88 -15
- data/history.part.html +73 -1
- data/lib/ruby-vpi.rb +5 -5
- data/lib/ruby-vpi/verilog_parser.rb +1 -1
- data/lib/ruby-vpi/vpi.rb +184 -169
- data/memo.html +44 -38
- data/memo.part.html +29 -24
- data/readme.html +17 -47
- data/readme.part.html +2 -33
- data/ref/c/annotated.html +40 -0
- data/ref/c/common_8h.html +146 -0
- data/ref/c/doxygen.css +358 -0
- data/ref/c/doxygen.png +0 -0
- data/ref/c/files.html +36 -0
- data/ref/c/functions.html +154 -0
- data/ref/c/functions_vars.html +154 -0
- data/ref/c/globals.html +261 -0
- data/ref/c/globals_0x62.html +62 -0
- data/ref/c/globals_0x63.html +103 -0
- data/ref/c/globals_0x65.html +62 -0
- data/ref/c/globals_0x66.html +72 -0
- data/ref/c/globals_0x67.html +64 -0
- data/ref/c/globals_0x69.html +62 -0
- data/ref/c/globals_0x6c.html +64 -0
- data/ref/c/globals_0x6d.html +62 -0
- data/ref/c/globals_0x6e.html +63 -0
- data/ref/c/globals_0x70.html +78 -0
- data/ref/c/globals_0x72.html +73 -0
- data/ref/c/globals_0x73.html +251 -0
- data/ref/c/globals_0x74.html +62 -0
- data/ref/c/globals_0x75.html +63 -0
- data/ref/c/globals_0x76.html +483 -0
- data/ref/c/globals_0x78.html +62 -0
- data/ref/c/globals_defs.html +86 -0
- data/ref/c/globals_defs_0x65.html +55 -0
- data/ref/c/globals_defs_0x6c.html +57 -0
- data/ref/c/globals_defs_0x6e.html +56 -0
- data/ref/c/globals_defs_0x70.html +56 -0
- data/ref/c/globals_defs_0x72.html +57 -0
- data/ref/c/globals_defs_0x73.html +164 -0
- data/ref/c/globals_defs_0x75.html +56 -0
- data/ref/c/globals_defs_0x76.html +470 -0
- data/ref/c/globals_defs_0x78.html +55 -0
- data/ref/c/globals_enum.html +39 -0
- data/ref/c/globals_eval.html +40 -0
- data/ref/c/globals_func.html +208 -0
- data/ref/c/globals_func_0x66.html +62 -0
- data/ref/c/globals_func_0x67.html +55 -0
- data/ref/c/globals_func_0x69.html +53 -0
- data/ref/c/globals_func_0x70.html +53 -0
- data/ref/c/globals_func_0x72.html +57 -0
- data/ref/c/globals_func_0x73.html +114 -0
- data/ref/c/globals_func_0x76.html +57 -0
- data/ref/c/globals_type.html +66 -0
- data/ref/c/globals_vars.html +126 -0
- data/ref/c/index.html +20 -0
- data/ref/c/relay_8c.html +214 -0
- data/ref/c/relay_8h.html +129 -0
- data/ref/c/structrelay____RubyOptions____def.html +67 -0
- data/ref/c/structswig__cast__info.html +98 -0
- data/ref/c/structswig__class.html +115 -0
- data/ref/c/structswig__module__info.html +132 -0
- data/ref/c/structswig__type__info.html +132 -0
- data/ref/c/structt__cb__data.html +168 -0
- data/ref/c/structt__vpi__delay.html +151 -0
- data/ref/c/structt__vpi__error__info.html +219 -0
- data/ref/c/structt__vpi__strengthval.html +83 -0
- data/ref/c/structt__vpi__systf__data.html +185 -0
- data/ref/c/structt__vpi__time.html +100 -0
- data/ref/c/structt__vpi__value.html +314 -0
- data/ref/c/structt__vpi__vecval.html +66 -0
- data/ref/c/structt__vpi__vlog__info.html +151 -0
- data/ref/c/swig_8c.html +80 -0
- data/ref/c/swig_8h.html +83 -0
- data/ref/c/swig__vpi_8h.html +8739 -0
- data/ref/c/swig__wrap_8cin.html +11556 -0
- data/ref/c/tab_b.gif +0 -0
- data/ref/c/tab_l.gif +0 -0
- data/ref/c/tab_r.gif +0 -0
- data/ref/c/tabs.css +102 -0
- data/ref/c/unions__vpi__value__value.html +166 -0
- data/ref/c/verilog_8h.html +117 -0
- data/ref/c/vlog_8c.html +168 -0
- data/ref/c/vlog_8h.html +128 -0
- data/ref/c/vpi__user_8h.html +8739 -0
- data/ref/ruby/classes/ERB.html +158 -0
- data/ref/ruby/classes/ERB.src/M000034.html +29 -0
- data/ref/ruby/classes/FileUtils.html +165 -0
- data/ref/ruby/classes/FileUtils.src/M000081.html +18 -0
- data/ref/ruby/classes/FileUtils.src/M000082.html +18 -0
- data/ref/ruby/classes/Integer.html +398 -0
- data/ref/ruby/classes/Integer.src/M000012.html +25 -0
- data/ref/ruby/classes/Integer.src/M000013.html +18 -0
- data/ref/ruby/classes/Integer.src/M000014.html +18 -0
- data/ref/ruby/classes/Integer.src/M000015.html +18 -0
- data/ref/ruby/classes/Integer.src/M000016.html +18 -0
- data/ref/ruby/classes/Integer.src/M000017.html +18 -0
- data/ref/ruby/classes/Integer.src/M000020.html +22 -0
- data/ref/ruby/classes/Integer.src/M000021.html +22 -0
- data/ref/ruby/classes/Integer.src/M000022.html +25 -0
- data/ref/ruby/classes/Integer.src/M000023.html +31 -0
- data/ref/ruby/classes/Integer.src/M000024.html +25 -0
- data/ref/ruby/classes/Integer.src/M000025.html +30 -0
- data/ref/ruby/classes/OutputInfo.html +294 -0
- data/ref/ruby/classes/OutputInfo.src/M000030.html +50 -0
- data/ref/ruby/classes/RDoc.html +135 -0
- data/ref/ruby/classes/RDoc.src/M000095.html +40 -0
- data/ref/ruby/classes/RubyVpi.html +206 -0
- data/ref/ruby/classes/RubyVpi.src/M000083.html +78 -0
- data/ref/ruby/classes/RubyVpi.src/M000084.html +20 -0
- data/ref/ruby/classes/RubyVpi/Config.html +159 -0
- data/ref/ruby/classes/String.html +159 -0
- data/ref/ruby/classes/String.src/M000032.html +41 -0
- data/ref/ruby/classes/String.src/M000033.html +18 -0
- data/ref/ruby/classes/Table.html +191 -0
- data/ref/ruby/classes/Table.src/M000026.html +38 -0
- data/ref/ruby/classes/Table.src/M000027.html +18 -0
- data/ref/ruby/classes/Table.src/M000028.html +18 -0
- data/ref/ruby/classes/Table.src/M000029.html +18 -0
- data/ref/ruby/classes/Template.html +158 -0
- data/ref/ruby/classes/Template.src/M000031.html +18 -0
- data/ref/ruby/classes/VerilogParser.html +187 -0
- data/ref/ruby/classes/VerilogParser.src/M000005.html +34 -0
- data/ref/ruby/classes/VerilogParser/Module.html +172 -0
- data/ref/ruby/classes/VerilogParser/Module.src/M000006.html +29 -0
- data/ref/ruby/classes/VerilogParser/Module/Parameter.html +160 -0
- data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000011.html +21 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.html +207 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000007.html +21 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000008.html +18 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000009.html +18 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000010.html +18 -0
- data/ref/ruby/classes/Vpi.html +124 -0
- data/ref/ruby/classes/Vpi/Handle.html +383 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000085.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000086.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000087.html +22 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000088.html +44 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000089.html +87 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000090.html +30 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000091.html +24 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000093.html +68 -0
- data/ref/ruby/classes/Vpi/Handle/Property.html +130 -0
- data/ref/ruby/classes/Vpi/Handle/Property.src/M000094.html +80 -0
- data/ref/ruby/classes/XX.html +138 -0
- data/ref/ruby/classes/XX/Document.html +295 -0
- data/ref/ruby/classes/XX/Document.src/M000072.html +22 -0
- data/ref/ruby/classes/XX/Document.src/M000073.html +20 -0
- data/ref/ruby/classes/XX/Document.src/M000074.html +20 -0
- data/ref/ruby/classes/XX/Document.src/M000075.html +20 -0
- data/ref/ruby/classes/XX/Document.src/M000076.html +22 -0
- data/ref/ruby/classes/XX/Document.src/M000077.html +21 -0
- data/ref/ruby/classes/XX/Document.src/M000078.html +21 -0
- data/ref/ruby/classes/XX/Document.src/M000079.html +34 -0
- data/ref/ruby/classes/XX/Document.src/M000080.html +98 -0
- data/ref/ruby/classes/XX/HTML4.html +145 -0
- data/ref/ruby/classes/XX/HTML4.src/M000036.html +20 -0
- data/ref/ruby/classes/XX/HTML4/Strict.html +138 -0
- data/ref/ruby/classes/XX/HTML4/Strict.src/M000038.html +20 -0
- data/ref/ruby/classes/XX/HTML4/Transitional.html +138 -0
- data/ref/ruby/classes/XX/HTML4/Transitional.src/M000037.html +20 -0
- data/ref/ruby/classes/XX/Markup.html +160 -0
- data/ref/ruby/classes/XX/Markup.src/M000043.html +28 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.html +236 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000044.html +22 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000045.html +20 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000046.html +25 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000047.html +20 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000048.html +27 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000049.html +20 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000050.html +27 -0
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000051.html +22 -0
- data/ref/ruby/classes/XX/Markup/Error.html +111 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.html +474 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000052.html +56 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000053.html +33 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000054.html +31 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000055.html +48 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000056.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000057.html +31 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000058.html +32 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000059.html +32 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000060.html +28 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000061.html +23 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000062.html +26 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000063.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000064.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000065.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000066.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000067.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000068.html +21 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000069.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000070.html +20 -0
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000071.html +20 -0
- data/ref/ruby/classes/XX/XHTML.html +145 -0
- data/ref/ruby/classes/XX/XHTML.src/M000039.html +36 -0
- data/ref/ruby/classes/XX/XHTML/Strict.html +138 -0
- data/ref/ruby/classes/XX/XHTML/Strict.src/M000041.html +20 -0
- data/ref/ruby/classes/XX/XHTML/Transitional.html +138 -0
- data/ref/ruby/classes/XX/XHTML/Transitional.src/M000040.html +20 -0
- data/ref/ruby/classes/XX/XML.html +138 -0
- data/ref/ruby/classes/XX/XML.src/M000035.html +20 -0
- data/ref/ruby/classes/XX/XMLish.html +138 -0
- data/ref/ruby/classes/XX/XMLish.src/M000042.html +18 -0
- data/ref/ruby/created.rid +1 -0
- data/ref/ruby/files/bin/generate_test_rb.html +248 -0
- data/ref/ruby/files/bin/generate_test_rb.src/M000001.html +18 -0
- data/ref/ruby/files/bin/generate_test_rb.src/M000002.html +40 -0
- data/ref/ruby/files/bin/header_to_ruby_rb.html +124 -0
- data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +108 -0
- data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +101 -0
- data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +108 -0
- data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +111 -0
- data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +108 -0
- data/ref/ruby/files/lib/ruby-vpi/rspec_rb.html +115 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +108 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +208 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000003.html +24 -0
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000004.html +26 -0
- data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +107 -0
- data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +108 -0
- data/ref/ruby/files/lib/ruby-vpi/xx_rb.html +148 -0
- data/ref/ruby/files/lib/ruby-vpi_rb.html +111 -0
- data/ref/ruby/fr_class_index.html +57 -0
- data/ref/ruby/fr_file_index.html +40 -0
- data/ref/ruby/fr_method_index.html +121 -0
- data/ref/ruby/index.html +24 -0
- data/ref/ruby/rdoc-style.css +208 -0
- data/samp/counter/counter_rspec_bench.rb +1 -0
- data/samp/counter/counter_rspec_bench.v +1 -1
- data/samp/counter/counter_xunit_bench.rb +1 -0
- data/samp/counter/counter_xunit_bench.v +1 -1
- data/samp/pipelined_alu/hw5_unit_test_bench.rb +1 -0
- data/samp/pipelined_alu/hw5_unit_test_bench.v +1 -1
- data/samp/pipelined_alu/int_gen.rb +6 -7
- metadata +269 -2
data/history.part.html
CHANGED
|
@@ -18,6 +18,78 @@ We <em>strictly</em> follow the RubyGems project’s <a href="http://www.rub
|
|
|
18
18
|
<p id="fn1"><sup>1</sup> C. Gross, “Explaining Open Source Version Numbers”, [Online document], 2005 Nov 28, [cited 2006 Aug 27], Available <span class="caps">HTTP</span>: <a href="http://ablog.apress.com/?p=738">http://ablog.apress.com/?p=738</a></p>
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
<h1>Version 11.1.0 (2006-11-08)</h1>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<h2>Summary</h2>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<p>This release fixes a bug in generated benches, improves the <a href="./ref/ruby/classes/Vpi/Handle.html">the <code>Vpi::Handle</code> class</a>, and improves performance by roughly 20%.</p>
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<h2>Acknowledgment</h2>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<p>Thanks to Matt Fischler for finding the bug in generated benches (see below).</p>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<h2>Notice</h2>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<ul>
|
|
40
|
+
<li>A bug in generated Verilog and Ruby benches, which caused this error <pre>ruby: no such file to load -- ruby-vpi (LoadError)</pre> has been fixed.
|
|
41
|
+
<ul>
|
|
42
|
+
<li>Please regenerate your tests to apply this bug fix to your tests.</li>
|
|
43
|
+
</ul></li>
|
|
44
|
+
</ul>
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
<h2>Detail</h2>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<ul>
|
|
51
|
+
<li>The class <code>SWIG::TYPE_p_unsigned_int</code> has been aliased as <code>Vpi::Handle</code> for easier access.</li>
|
|
52
|
+
</ul>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<ul>
|
|
56
|
+
<li><code>Vpi::Handle#to_s</code> and <code>Vpi::Handle#inspect</code> now produce more informative output. For example, what used to appear as <pre>#<SWIG::TYPE_p_unsigned_int:0x2aaab6574fa0></pre> now appears as <pre>#<Vpi::Handle vpiModule fullName=counter_rspec_bench, size=-1, file=counter_rspec_bench.v, lineNo=2></pre> in this release.
|
|
57
|
+
<ul>
|
|
58
|
+
<li>You can also provide a list of <span class="caps">VPI</span> property/type names or integer constants to those methods to see additional information in the output.</li>
|
|
59
|
+
</ul></li>
|
|
60
|
+
</ul>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<ul>
|
|
64
|
+
<li><code>Vpi::Handle</code> now implements all methods from <code>Enumerable</code>, such as <code>map</code>, <code>each</code>, <code>select</code>, and so on. However, unlike their counterparts in <code>Enumerable</code>, these methods also accept a list of <span class="caps">VPI</span> property/type names or integer constants. Thus, you are now able to write <code>handle.select(:reg, :net) {|h| h.size > 5}</code> to obtain a list of child handles to registers and nets whose capacity is greater than 5 bits.</li>
|
|
65
|
+
</ul>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<ul>
|
|
69
|
+
<li>The <code>Vpi::Handle#[]</code>, <code>Vpi::Handle#get_value</code>, and <code>Vpi::Handle#put_value</code> methods now accept names of <span class="caps">VPI</span> types/properties as well as their integer constants. Thus, you are now able to write <code>handle[:reg, :net]</code> to obtain a list of handles to all child registers and nets.</li>
|
|
70
|
+
</ul>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<ul>
|
|
74
|
+
<li><code>Vpi::Handle#method_missing</code> has been refactored to cache queries. There is now, approximately, 20% improvement in performance.</li>
|
|
75
|
+
</ul>
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
<ul>
|
|
79
|
+
<li><code>Vpi::Handle#method_missing</code> has been fixed to accept operations with multiple underscores. For example, before this release, you could not write <code>handle.find_all_reg {|r| r.name =~ /foo/}</code> because the “find_all_reg” method would be interpreted as the operation “find” and the <span class="caps">VPI</span> property “all_reg”.</li>
|
|
80
|
+
</ul>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<ul>
|
|
84
|
+
<li>The <code>IntegerGenerator</code> class, in the pipelined <span class="caps">ALU</span> example, has been fixed so that multiple instances do not interfere with the generation of each other’s prime integers.</li>
|
|
85
|
+
</ul>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<ul>
|
|
89
|
+
<li>Due to a bug in the <code>Rakefile</code>, the reference documentation was not included in the previous few releases. This has been fixed.</li>
|
|
90
|
+
</ul>
|
|
91
|
+
|
|
92
|
+
|
|
21
93
|
<h1>Version 11.0.0 (2006-11-05)</h1>
|
|
22
94
|
|
|
23
95
|
|
|
@@ -138,7 +210,7 @@ end</pre> notation.
|
|
|
138
210
|
|
|
139
211
|
|
|
140
212
|
<ul>
|
|
141
|
-
<li>Revised the stylesheet to make disjoint sections readily distinguishable from
|
|
213
|
+
<li>Revised the stylesheet to make disjoint sections readily distinguishable from each other, through generous spacing and minor coloring.</li>
|
|
142
214
|
</ul>
|
|
143
215
|
|
|
144
216
|
|
data/lib/ruby-vpi.rb
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
=end
|
|
20
20
|
|
|
21
21
|
module RubyVpi
|
|
22
|
-
# Initializes the
|
|
22
|
+
# Initializes the bench by loading:
|
|
23
23
|
# 1. the design.rb file
|
|
24
|
-
# 2. the proto.rb file
|
|
24
|
+
# 2. the proto.rb file if prototyping is enabled
|
|
25
25
|
# 3. the spec.rb file
|
|
26
26
|
#
|
|
27
|
-
# aDesignId:: The name of the Ruby
|
|
28
|
-
# aSpecFormat:: The format
|
|
27
|
+
# aDesignId:: The name of the Ruby design object.
|
|
28
|
+
# aSpecFormat:: The format being used by the specification.
|
|
29
29
|
def RubyVpi.init_bench aDesignId, aSpecFormat
|
|
30
30
|
if caller.find {|s| s =~ /^(.*?)_bench.rb:/}
|
|
31
31
|
testName = $1
|
|
@@ -90,7 +90,7 @@ module RubyVpi
|
|
|
90
90
|
require "#{testName}_spec.rb"
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
# Provides information about
|
|
93
|
+
# Provides information about this project's configuration.
|
|
94
94
|
module Config
|
|
95
95
|
PROJECT_ID = 'ruby-vpi'
|
|
96
96
|
PROJECT_NAME = 'Ruby-VPI'
|
|
@@ -101,7 +101,7 @@ class VerilogParser
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
class String
|
|
104
|
-
# Converts this string containing Verilog code into
|
|
104
|
+
# Converts this string containing Verilog code into syntactically correct Ruby code.
|
|
105
105
|
def verilog_to_ruby
|
|
106
106
|
content = self.dup
|
|
107
107
|
|
data/lib/ruby-vpi/vpi.rb
CHANGED
|
@@ -20,47 +20,35 @@
|
|
|
20
20
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
21
21
|
=end
|
|
22
22
|
|
|
23
|
-
module
|
|
24
|
-
=
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
== Using values directly
|
|
42
|
-
You can read and write values directly, while implicitly specifying their format, through several shortcut methods. The names of these methods can be determined by (1) taking the name of a VPI value format listed in the *VALUE_FORMAT_NAMES* array, (2) removing the "Vpi" prefix, and (3) converting the first character into lower-case.
|
|
43
|
-
|
|
44
|
-
For example, the shortcut methods for reading and writing values using the <tt><b>Vpi</b><em>I</em>ntVal</tt> format are:
|
|
45
|
-
* intVal
|
|
46
|
-
* intVal=
|
|
47
|
-
|
|
48
|
-
The methods shown above can be used like so:
|
|
49
|
-
* value = handle.#intVal
|
|
50
|
-
* handle.#intVal = value
|
|
51
|
-
|
|
52
|
-
== Examples of all approaches
|
|
53
|
-
To read a handle's value as an integer:
|
|
54
|
-
* handle.#get_value(VpiIntVal)
|
|
55
|
-
* handle.intVal
|
|
56
|
-
|
|
57
|
-
To write a handle's value as an integer:
|
|
58
|
-
* handle.#put_value(15, VpiIntVal)
|
|
59
|
-
* handle.intVal = 15
|
|
60
|
-
=end
|
|
61
|
-
class TYPE_p_unsigned_int
|
|
23
|
+
module Vpi
|
|
24
|
+
Handle = SWIG::TYPE_p_unsigned_int
|
|
25
|
+
|
|
26
|
+
# An object inside a Verilog simulation (see *vpiHandle* in IEEE Std. 1364-2005).
|
|
27
|
+
# * VPI types and properties listed in ext/vpi_user.h can be specified by their names (strings or symbols) or integer constants.
|
|
28
|
+
# * example names:
|
|
29
|
+
# * "intVal"
|
|
30
|
+
# * :intVal
|
|
31
|
+
# * "vpiIntVal"
|
|
32
|
+
# * :vpiIntVal
|
|
33
|
+
# * "VpiIntVal"
|
|
34
|
+
# * :VpiIntVal
|
|
35
|
+
# * example constants:
|
|
36
|
+
# * VpiIntVal
|
|
37
|
+
# * VpiModule
|
|
38
|
+
# * VpiReg
|
|
39
|
+
class Handle
|
|
62
40
|
include Vpi
|
|
63
41
|
|
|
42
|
+
# inherit Enumerable methods, such as #each, #map, #select, etc.
|
|
43
|
+
Enumerable.instance_methods.each do |meth|
|
|
44
|
+
# using a string because define_method does not accept a block until Ruby 1.9
|
|
45
|
+
class_eval %{
|
|
46
|
+
def #{meth} *args, &block
|
|
47
|
+
self[*args].send(:#{meth}, &block)
|
|
48
|
+
end
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
64
52
|
# Tests if the logic value of this handle is "don't care" (x).
|
|
65
53
|
def x?
|
|
66
54
|
self.hexStrVal =~ /x/i
|
|
@@ -71,7 +59,7 @@ module SWIG
|
|
|
71
59
|
self.hexStrVal =~ /z/i
|
|
72
60
|
end
|
|
73
61
|
|
|
74
|
-
# Reads the value using the given format and returns a +S_vpi_value+ object.
|
|
62
|
+
# Reads the value using the given format (integer constant) and returns a +S_vpi_value+ object.
|
|
75
63
|
def get_value_wrapper aFormat
|
|
76
64
|
val = S_vpi_value.new
|
|
77
65
|
val.format = aFormat
|
|
@@ -80,9 +68,9 @@ module SWIG
|
|
|
80
68
|
val
|
|
81
69
|
end
|
|
82
70
|
|
|
83
|
-
# Reads the value using the given format and returns it. If a format is not given, then the Verilog simulator will attempt to determine the correct format.
|
|
71
|
+
# Reads the value using the given format (name or integer constant) and returns it. If a format is not given, then the Verilog simulator will attempt to determine the correct format.
|
|
84
72
|
def get_value aFormat = VpiObjTypeVal
|
|
85
|
-
val = get_value_wrapper(aFormat)
|
|
73
|
+
val = get_value_wrapper(resolve_prop_type(aFormat))
|
|
86
74
|
|
|
87
75
|
case val.format
|
|
88
76
|
when VpiBinStrVal, VpiOctStrVal, VpiDecStrVal, VpiHexStrVal, VpiStringVal
|
|
@@ -111,9 +99,14 @@ module SWIG
|
|
|
111
99
|
end
|
|
112
100
|
end
|
|
113
101
|
|
|
114
|
-
# Writes the given value using the given format, time, and delay, and then returns the given value. If a format is not given, then the Verilog simulator will attempt to determine the correct format.
|
|
102
|
+
# Writes the given value using the given format (name or integer constant), time, and delay, and then returns the given value. If a format is not given, then the Verilog simulator will attempt to determine the correct format.
|
|
115
103
|
def put_value aValue, aFormat = nil, aTime = nil, aDelay = VpiNoDelay
|
|
116
|
-
aFormat
|
|
104
|
+
aFormat =
|
|
105
|
+
if aFormat
|
|
106
|
+
resolve_prop_type(aFormat)
|
|
107
|
+
else
|
|
108
|
+
get_value_wrapper(VpiObjTypeVal).format
|
|
109
|
+
end
|
|
117
110
|
|
|
118
111
|
newVal = S_vpi_value.new
|
|
119
112
|
newVal.format = aFormat
|
|
@@ -180,153 +173,175 @@ module SWIG
|
|
|
180
173
|
aValue
|
|
181
174
|
end
|
|
182
175
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
PREFIX_REGEXP = %r{^(.*?)_}
|
|
187
|
-
|
|
188
|
-
# Enables access to (1) child handles and (2) VPI properties of this handle. In the case that a child handle has the same name as a VPI property, the child handle will be accessed instead of the VPI property. However, you can still access the VPI property via #get_value and #put_value.
|
|
189
|
-
def method_missing aMsg, *aArgs, &aBlockArg
|
|
190
|
-
methName = aMsg.to_s
|
|
191
|
-
|
|
192
|
-
# give access to a child handle if possible
|
|
193
|
-
if child = vpi_handle_by_name(methName, self)
|
|
194
|
-
# cache the child for future accesses, in order to cut down number of calls to method_missing
|
|
195
|
-
(class << self; self; end).class_eval do
|
|
196
|
-
define_method aMsg do
|
|
197
|
-
child
|
|
198
|
-
end
|
|
199
|
-
end
|
|
176
|
+
# Returns an array of child handles of the given types (name or integer constant).
|
|
177
|
+
def [] *aTypes
|
|
178
|
+
handles = []
|
|
200
179
|
|
|
201
|
-
|
|
202
|
-
|
|
180
|
+
aTypes.each do |t|
|
|
181
|
+
t = resolve_prop_type(t)
|
|
203
182
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
183
|
+
if itr = vpi_iterate(t, self)
|
|
184
|
+
while h = vpi_scan(itr)
|
|
185
|
+
handles << h
|
|
186
|
+
end
|
|
207
187
|
end
|
|
188
|
+
end
|
|
208
189
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
methName.sub! QUERY_REGEXP, ''
|
|
212
|
-
end
|
|
190
|
+
handles
|
|
191
|
+
end
|
|
213
192
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
193
|
+
# Inspects the given VPI property names, in addition to those common to all handles.
|
|
194
|
+
def inspect *aPropNames
|
|
195
|
+
aPropNames.unshift :fullName, :size, :file, :lineNo
|
|
196
|
+
|
|
197
|
+
aPropNames.map! do |name|
|
|
198
|
+
"#{name}=#{self.send(name.to_sym)}"
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
"#<Vpi::Handle #{vpiType_s} #{aPropNames.join(', ')}>"
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
alias to_s inspect
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
@@propCache = Hash.new {|h, k| h[k] = Property.resolve(k)}
|
|
208
|
+
|
|
209
|
+
# Provides access to this handle's
|
|
210
|
+
# 1. child handles
|
|
211
|
+
# 2. VPI properties
|
|
212
|
+
# through method calls. In the case that a child handle has the same name as a VPI property, the child handle will be accessed instead of the VPI property. However, you can still access the VPI property via #get_value and #put_value.
|
|
213
|
+
def method_missing aMeth, *aArgs, &aBlockArg
|
|
214
|
+
if child = vpi_handle_by_name(aMeth.to_s, self)
|
|
215
|
+
# cache the child for future accesses, in order to cut down number of calls to method_missing
|
|
216
|
+
(class << self; self; end).class_eval do
|
|
217
|
+
define_method aMeth do
|
|
218
|
+
child
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
child
|
|
223
|
+
|
|
224
|
+
else
|
|
225
|
+
prop = @@propCache[aMeth]
|
|
226
|
+
|
|
227
|
+
if prop.operation
|
|
228
|
+
self.send(prop.operation, prop.type, *aArgs, &aBlockArg)
|
|
229
|
+
|
|
230
|
+
else
|
|
231
|
+
case prop.accessor
|
|
232
|
+
when :d # delay values
|
|
233
|
+
raise NotImplementedError, 'processing of delay values is not yet implemented.'
|
|
234
|
+
# TODO: vpi_put_delays
|
|
235
|
+
# TODO: vpi_get_delays
|
|
236
|
+
|
|
237
|
+
when :l # logic values
|
|
238
|
+
if prop.assignment
|
|
239
|
+
value = aArgs.shift
|
|
240
|
+
put_value(value, prop.type, *aArgs)
|
|
241
|
+
else
|
|
242
|
+
get_value(prop.type)
|
|
243
|
+
end
|
|
218
244
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
245
|
+
when :i # integer values
|
|
246
|
+
vpi_get(prop.type, self) unless prop.assignment
|
|
247
|
+
|
|
248
|
+
when :b # boolean values
|
|
249
|
+
unless prop.assignment
|
|
250
|
+
value = vpi_get(prop, self)
|
|
251
|
+
value && (value != 0) # zero is false in C
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
when :s # string values
|
|
255
|
+
vpi_get_str(prop.type, self) unless prop.assignment
|
|
256
|
+
|
|
257
|
+
when :h # handle values
|
|
258
|
+
vpi_handle(prop.type, self) unless prop.assignment
|
|
259
|
+
|
|
260
|
+
else
|
|
261
|
+
raise NoMethodError, "unable to access VPI property #{prop.name.inspect} through method #{aMeth.inspect} with arguments #{aArgs.inspect} for handle #{self}"
|
|
262
|
+
end
|
|
222
263
|
end
|
|
264
|
+
end
|
|
265
|
+
end
|
|
223
266
|
|
|
224
|
-
|
|
225
|
-
propName = methName[0, 1].upcase << methName[1..-1]
|
|
226
|
-
propName.insert(0, 'Vpi') unless methName =~ /^vpi/
|
|
267
|
+
Property = Struct.new :type, :name, :operation, :accessor, :assignment
|
|
227
268
|
|
|
228
|
-
|
|
269
|
+
# Resolves the given shorthand name into a description of its VPI property.
|
|
270
|
+
def Property.resolve aName
|
|
271
|
+
# parse the given property name
|
|
272
|
+
tokens = aName.to_s.split(/_/)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
tokens.last.sub!(/[\?!=]$/, '')
|
|
276
|
+
|
|
277
|
+
addendum = $&
|
|
278
|
+
isAssign = $& == '='
|
|
279
|
+
isQuery = $& == '?'
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
tokens.last =~ /^[a-z]$/ && tokens.pop
|
|
283
|
+
accessor = $&
|
|
284
|
+
|
|
285
|
+
name = tokens.pop
|
|
286
|
+
|
|
287
|
+
operation =
|
|
288
|
+
unless tokens.empty?
|
|
289
|
+
tokens.join('_') << (addendum || '')
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# determine the VPI integer type for the property
|
|
293
|
+
name = name[0, 1].upcase << name[1..-1]
|
|
294
|
+
name.insert 0, 'Vpi' unless name =~ /^[Vv]pi/
|
|
229
295
|
|
|
230
296
|
begin
|
|
231
|
-
|
|
297
|
+
type = Vpi.const_get(name)
|
|
232
298
|
rescue NameError
|
|
233
|
-
raise ArgumentError, "
|
|
299
|
+
raise ArgumentError, "#{name.inspect} is not a valid VPI property"
|
|
234
300
|
end
|
|
235
301
|
|
|
236
|
-
|
|
237
|
-
if
|
|
238
|
-
|
|
239
|
-
else
|
|
240
|
-
loop do
|
|
241
|
-
puts "looping, accessor: #{accessor}" if $DEBUG
|
|
242
|
-
|
|
243
|
-
case accessor
|
|
244
|
-
when 'd' # delay values
|
|
245
|
-
if isAssign
|
|
246
|
-
# TODO: vpi_put_delays
|
|
247
|
-
else
|
|
248
|
-
# TODO: vpi_get_delays
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
when 'l' # logic values
|
|
252
|
-
if isAssign
|
|
253
|
-
value = aArgs.shift
|
|
254
|
-
return put_value(value, prop, *aArgs)
|
|
255
|
-
else
|
|
256
|
-
return get_value(prop)
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
when 'i' # integer values
|
|
260
|
-
return vpi_get(prop, self) unless isAssign
|
|
261
|
-
|
|
262
|
-
when 'b' # boolean values
|
|
263
|
-
unless isAssign
|
|
264
|
-
value = vpi_get(prop, self)
|
|
265
|
-
return value && (value != 0) # zero is false in C
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
when 's' # string values
|
|
269
|
-
return vpi_get_str(prop, self) unless isAssign
|
|
270
|
-
|
|
271
|
-
when 'h' # handle values
|
|
272
|
-
return vpi_handle(prop, self) unless isAssign
|
|
273
|
-
|
|
274
|
-
else # accessor not specified. guess its value from property name
|
|
275
|
-
if isQuery
|
|
276
|
-
accessor = 'b'
|
|
277
|
-
redo
|
|
278
|
-
end
|
|
279
|
-
|
|
280
|
-
case propName
|
|
281
|
-
when /Time$/
|
|
282
|
-
accessor = 'd'
|
|
283
|
-
redo
|
|
284
|
-
|
|
285
|
-
when /Val$/
|
|
286
|
-
accessor = 'l'
|
|
287
|
-
redo
|
|
288
|
-
|
|
289
|
-
when /Type$/, /Direction$/, /Index$/, /Size$/, /Strength\d?$/, /Polarity$/, /Edge$/, /Offset$/, /Mode$/
|
|
290
|
-
accessor = 'i'
|
|
291
|
-
redo
|
|
292
|
-
|
|
293
|
-
when /Is[A-Z]/, /ed$/
|
|
294
|
-
accessor = 'b'
|
|
295
|
-
redo
|
|
296
|
-
|
|
297
|
-
when /Name$/, /File$/, /Decompile$/
|
|
298
|
-
accessor = 's'
|
|
299
|
-
redo
|
|
300
|
-
|
|
301
|
-
when /Parent$/, /Inst$/, /Range$/, /Driver$/, /Net$/, /Load$/, /Conn$/, /Bit$/, /Word$/, /[LR]hs$/, /(In|Out)$/, /Term$/, /Argument$/, /Condition$/, /Use$/, /Operand$/, /Stmt$/, /Expr$/, /Scope$/, /Memory$/, /Delay$/
|
|
302
|
-
accessor = 'h'
|
|
303
|
-
redo
|
|
304
|
-
end
|
|
305
|
-
end
|
|
302
|
+
accessor =
|
|
303
|
+
if accessor
|
|
304
|
+
accessor.to_sym
|
|
306
305
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
306
|
+
else # infer accessor from VPI property name
|
|
307
|
+
if isQuery
|
|
308
|
+
:b
|
|
310
309
|
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
else
|
|
311
|
+
case name
|
|
312
|
+
when /Time$/
|
|
313
|
+
:d
|
|
313
314
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
when /Val$/
|
|
316
|
+
:l
|
|
317
|
+
|
|
318
|
+
when /Type$/, /Direction$/, /Index$/, /Size$/, /Strength\d?$/, /Polarity$/, /Edge$/, /Offset$/, /Mode$/, /LineNo$/
|
|
319
|
+
:i
|
|
317
320
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
+
when /Is[A-Z]/, /ed$/
|
|
322
|
+
:b
|
|
323
|
+
|
|
324
|
+
when /Name$/, /File$/, /Decompile$/
|
|
325
|
+
:s
|
|
326
|
+
|
|
327
|
+
when /Parent$/, /Inst$/, /Range$/, /Driver$/, /Net$/, /Load$/, /Conn$/, /Bit$/, /Word$/, /[LR]hs$/, /(In|Out)$/, /Term$/, /Argument$/, /Condition$/, /Use$/, /Operand$/, /Stmt$/, /Expr$/, /Scope$/, /Memory$/, /Delay$/
|
|
328
|
+
:h
|
|
329
|
+
end
|
|
330
|
+
end
|
|
321
331
|
end
|
|
322
|
-
end
|
|
323
332
|
|
|
324
|
-
|
|
333
|
+
Property.new type, name, operation, accessor, isAssign
|
|
325
334
|
end
|
|
326
335
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
336
|
+
private
|
|
337
|
+
|
|
338
|
+
# resolve type names into type constants
|
|
339
|
+
def resolve_prop_type aNameOrType
|
|
340
|
+
if aNameOrType.is_a? Integer
|
|
341
|
+
aNameOrType
|
|
342
|
+
else
|
|
343
|
+
@@propCache[aNameOrType.to_sym].type
|
|
344
|
+
end
|
|
330
345
|
end
|
|
331
346
|
end
|
|
332
347
|
end
|