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.
Files changed (260) hide show
  1. data/HEADER +15 -14
  2. data/HISTORY +36 -1
  3. data/MEMO +17 -14
  4. data/README +2 -19
  5. data/Rakefile +1 -2
  6. data/bin/generate_test.rb +4 -4
  7. data/bin/generate_test_tpl/bench.rb +1 -0
  8. data/bin/generate_test_tpl/bench.v +1 -1
  9. data/bin/header_to_ruby.rb +2 -2
  10. data/doc/background.organization.html +1 -1
  11. data/doc/hacking.html +3 -0
  12. data/doc/hacking.release-packages.html +7 -0
  13. data/doc/index.html +2 -2
  14. data/doc/manual.txt +69 -13
  15. data/doc/problem.ivl.html +3 -3
  16. data/doc/problems.html +1 -1
  17. data/doc/problems.ruby.html +1 -1
  18. data/doc/problems.vsim.html +1 -1
  19. data/doc/setup.installation.html +1 -1
  20. data/doc/src/manual.xml +130 -20
  21. data/doc/usage.examples.html +1 -1
  22. data/doc/usage.tutorial.html +1 -1
  23. data/header.html +15 -14
  24. data/header.part.html +15 -14
  25. data/history.html +88 -15
  26. data/history.part.html +73 -1
  27. data/lib/ruby-vpi.rb +5 -5
  28. data/lib/ruby-vpi/verilog_parser.rb +1 -1
  29. data/lib/ruby-vpi/vpi.rb +184 -169
  30. data/memo.html +44 -38
  31. data/memo.part.html +29 -24
  32. data/readme.html +17 -47
  33. data/readme.part.html +2 -33
  34. data/ref/c/annotated.html +40 -0
  35. data/ref/c/common_8h.html +146 -0
  36. data/ref/c/doxygen.css +358 -0
  37. data/ref/c/doxygen.png +0 -0
  38. data/ref/c/files.html +36 -0
  39. data/ref/c/functions.html +154 -0
  40. data/ref/c/functions_vars.html +154 -0
  41. data/ref/c/globals.html +261 -0
  42. data/ref/c/globals_0x62.html +62 -0
  43. data/ref/c/globals_0x63.html +103 -0
  44. data/ref/c/globals_0x65.html +62 -0
  45. data/ref/c/globals_0x66.html +72 -0
  46. data/ref/c/globals_0x67.html +64 -0
  47. data/ref/c/globals_0x69.html +62 -0
  48. data/ref/c/globals_0x6c.html +64 -0
  49. data/ref/c/globals_0x6d.html +62 -0
  50. data/ref/c/globals_0x6e.html +63 -0
  51. data/ref/c/globals_0x70.html +78 -0
  52. data/ref/c/globals_0x72.html +73 -0
  53. data/ref/c/globals_0x73.html +251 -0
  54. data/ref/c/globals_0x74.html +62 -0
  55. data/ref/c/globals_0x75.html +63 -0
  56. data/ref/c/globals_0x76.html +483 -0
  57. data/ref/c/globals_0x78.html +62 -0
  58. data/ref/c/globals_defs.html +86 -0
  59. data/ref/c/globals_defs_0x65.html +55 -0
  60. data/ref/c/globals_defs_0x6c.html +57 -0
  61. data/ref/c/globals_defs_0x6e.html +56 -0
  62. data/ref/c/globals_defs_0x70.html +56 -0
  63. data/ref/c/globals_defs_0x72.html +57 -0
  64. data/ref/c/globals_defs_0x73.html +164 -0
  65. data/ref/c/globals_defs_0x75.html +56 -0
  66. data/ref/c/globals_defs_0x76.html +470 -0
  67. data/ref/c/globals_defs_0x78.html +55 -0
  68. data/ref/c/globals_enum.html +39 -0
  69. data/ref/c/globals_eval.html +40 -0
  70. data/ref/c/globals_func.html +208 -0
  71. data/ref/c/globals_func_0x66.html +62 -0
  72. data/ref/c/globals_func_0x67.html +55 -0
  73. data/ref/c/globals_func_0x69.html +53 -0
  74. data/ref/c/globals_func_0x70.html +53 -0
  75. data/ref/c/globals_func_0x72.html +57 -0
  76. data/ref/c/globals_func_0x73.html +114 -0
  77. data/ref/c/globals_func_0x76.html +57 -0
  78. data/ref/c/globals_type.html +66 -0
  79. data/ref/c/globals_vars.html +126 -0
  80. data/ref/c/index.html +20 -0
  81. data/ref/c/relay_8c.html +214 -0
  82. data/ref/c/relay_8h.html +129 -0
  83. data/ref/c/structrelay____RubyOptions____def.html +67 -0
  84. data/ref/c/structswig__cast__info.html +98 -0
  85. data/ref/c/structswig__class.html +115 -0
  86. data/ref/c/structswig__module__info.html +132 -0
  87. data/ref/c/structswig__type__info.html +132 -0
  88. data/ref/c/structt__cb__data.html +168 -0
  89. data/ref/c/structt__vpi__delay.html +151 -0
  90. data/ref/c/structt__vpi__error__info.html +219 -0
  91. data/ref/c/structt__vpi__strengthval.html +83 -0
  92. data/ref/c/structt__vpi__systf__data.html +185 -0
  93. data/ref/c/structt__vpi__time.html +100 -0
  94. data/ref/c/structt__vpi__value.html +314 -0
  95. data/ref/c/structt__vpi__vecval.html +66 -0
  96. data/ref/c/structt__vpi__vlog__info.html +151 -0
  97. data/ref/c/swig_8c.html +80 -0
  98. data/ref/c/swig_8h.html +83 -0
  99. data/ref/c/swig__vpi_8h.html +8739 -0
  100. data/ref/c/swig__wrap_8cin.html +11556 -0
  101. data/ref/c/tab_b.gif +0 -0
  102. data/ref/c/tab_l.gif +0 -0
  103. data/ref/c/tab_r.gif +0 -0
  104. data/ref/c/tabs.css +102 -0
  105. data/ref/c/unions__vpi__value__value.html +166 -0
  106. data/ref/c/verilog_8h.html +117 -0
  107. data/ref/c/vlog_8c.html +168 -0
  108. data/ref/c/vlog_8h.html +128 -0
  109. data/ref/c/vpi__user_8h.html +8739 -0
  110. data/ref/ruby/classes/ERB.html +158 -0
  111. data/ref/ruby/classes/ERB.src/M000034.html +29 -0
  112. data/ref/ruby/classes/FileUtils.html +165 -0
  113. data/ref/ruby/classes/FileUtils.src/M000081.html +18 -0
  114. data/ref/ruby/classes/FileUtils.src/M000082.html +18 -0
  115. data/ref/ruby/classes/Integer.html +398 -0
  116. data/ref/ruby/classes/Integer.src/M000012.html +25 -0
  117. data/ref/ruby/classes/Integer.src/M000013.html +18 -0
  118. data/ref/ruby/classes/Integer.src/M000014.html +18 -0
  119. data/ref/ruby/classes/Integer.src/M000015.html +18 -0
  120. data/ref/ruby/classes/Integer.src/M000016.html +18 -0
  121. data/ref/ruby/classes/Integer.src/M000017.html +18 -0
  122. data/ref/ruby/classes/Integer.src/M000020.html +22 -0
  123. data/ref/ruby/classes/Integer.src/M000021.html +22 -0
  124. data/ref/ruby/classes/Integer.src/M000022.html +25 -0
  125. data/ref/ruby/classes/Integer.src/M000023.html +31 -0
  126. data/ref/ruby/classes/Integer.src/M000024.html +25 -0
  127. data/ref/ruby/classes/Integer.src/M000025.html +30 -0
  128. data/ref/ruby/classes/OutputInfo.html +294 -0
  129. data/ref/ruby/classes/OutputInfo.src/M000030.html +50 -0
  130. data/ref/ruby/classes/RDoc.html +135 -0
  131. data/ref/ruby/classes/RDoc.src/M000095.html +40 -0
  132. data/ref/ruby/classes/RubyVpi.html +206 -0
  133. data/ref/ruby/classes/RubyVpi.src/M000083.html +78 -0
  134. data/ref/ruby/classes/RubyVpi.src/M000084.html +20 -0
  135. data/ref/ruby/classes/RubyVpi/Config.html +159 -0
  136. data/ref/ruby/classes/String.html +159 -0
  137. data/ref/ruby/classes/String.src/M000032.html +41 -0
  138. data/ref/ruby/classes/String.src/M000033.html +18 -0
  139. data/ref/ruby/classes/Table.html +191 -0
  140. data/ref/ruby/classes/Table.src/M000026.html +38 -0
  141. data/ref/ruby/classes/Table.src/M000027.html +18 -0
  142. data/ref/ruby/classes/Table.src/M000028.html +18 -0
  143. data/ref/ruby/classes/Table.src/M000029.html +18 -0
  144. data/ref/ruby/classes/Template.html +158 -0
  145. data/ref/ruby/classes/Template.src/M000031.html +18 -0
  146. data/ref/ruby/classes/VerilogParser.html +187 -0
  147. data/ref/ruby/classes/VerilogParser.src/M000005.html +34 -0
  148. data/ref/ruby/classes/VerilogParser/Module.html +172 -0
  149. data/ref/ruby/classes/VerilogParser/Module.src/M000006.html +29 -0
  150. data/ref/ruby/classes/VerilogParser/Module/Parameter.html +160 -0
  151. data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000011.html +21 -0
  152. data/ref/ruby/classes/VerilogParser/Module/Port.html +207 -0
  153. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000007.html +21 -0
  154. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000008.html +18 -0
  155. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000009.html +18 -0
  156. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000010.html +18 -0
  157. data/ref/ruby/classes/Vpi.html +124 -0
  158. data/ref/ruby/classes/Vpi/Handle.html +383 -0
  159. data/ref/ruby/classes/Vpi/Handle.src/M000085.html +18 -0
  160. data/ref/ruby/classes/Vpi/Handle.src/M000086.html +18 -0
  161. data/ref/ruby/classes/Vpi/Handle.src/M000087.html +22 -0
  162. data/ref/ruby/classes/Vpi/Handle.src/M000088.html +44 -0
  163. data/ref/ruby/classes/Vpi/Handle.src/M000089.html +87 -0
  164. data/ref/ruby/classes/Vpi/Handle.src/M000090.html +30 -0
  165. data/ref/ruby/classes/Vpi/Handle.src/M000091.html +24 -0
  166. data/ref/ruby/classes/Vpi/Handle.src/M000093.html +68 -0
  167. data/ref/ruby/classes/Vpi/Handle/Property.html +130 -0
  168. data/ref/ruby/classes/Vpi/Handle/Property.src/M000094.html +80 -0
  169. data/ref/ruby/classes/XX.html +138 -0
  170. data/ref/ruby/classes/XX/Document.html +295 -0
  171. data/ref/ruby/classes/XX/Document.src/M000072.html +22 -0
  172. data/ref/ruby/classes/XX/Document.src/M000073.html +20 -0
  173. data/ref/ruby/classes/XX/Document.src/M000074.html +20 -0
  174. data/ref/ruby/classes/XX/Document.src/M000075.html +20 -0
  175. data/ref/ruby/classes/XX/Document.src/M000076.html +22 -0
  176. data/ref/ruby/classes/XX/Document.src/M000077.html +21 -0
  177. data/ref/ruby/classes/XX/Document.src/M000078.html +21 -0
  178. data/ref/ruby/classes/XX/Document.src/M000079.html +34 -0
  179. data/ref/ruby/classes/XX/Document.src/M000080.html +98 -0
  180. data/ref/ruby/classes/XX/HTML4.html +145 -0
  181. data/ref/ruby/classes/XX/HTML4.src/M000036.html +20 -0
  182. data/ref/ruby/classes/XX/HTML4/Strict.html +138 -0
  183. data/ref/ruby/classes/XX/HTML4/Strict.src/M000038.html +20 -0
  184. data/ref/ruby/classes/XX/HTML4/Transitional.html +138 -0
  185. data/ref/ruby/classes/XX/HTML4/Transitional.src/M000037.html +20 -0
  186. data/ref/ruby/classes/XX/Markup.html +160 -0
  187. data/ref/ruby/classes/XX/Markup.src/M000043.html +28 -0
  188. data/ref/ruby/classes/XX/Markup/ClassMethods.html +236 -0
  189. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000044.html +22 -0
  190. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000045.html +20 -0
  191. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000046.html +25 -0
  192. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000047.html +20 -0
  193. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000048.html +27 -0
  194. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000049.html +20 -0
  195. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000050.html +27 -0
  196. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000051.html +22 -0
  197. data/ref/ruby/classes/XX/Markup/Error.html +111 -0
  198. data/ref/ruby/classes/XX/Markup/InstanceMethods.html +474 -0
  199. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000052.html +56 -0
  200. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000053.html +33 -0
  201. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000054.html +31 -0
  202. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000055.html +48 -0
  203. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000056.html +20 -0
  204. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000057.html +31 -0
  205. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000058.html +32 -0
  206. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000059.html +32 -0
  207. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000060.html +28 -0
  208. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000061.html +23 -0
  209. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000062.html +26 -0
  210. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000063.html +20 -0
  211. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000064.html +20 -0
  212. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000065.html +20 -0
  213. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000066.html +20 -0
  214. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000067.html +20 -0
  215. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000068.html +21 -0
  216. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000069.html +20 -0
  217. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000070.html +20 -0
  218. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000071.html +20 -0
  219. data/ref/ruby/classes/XX/XHTML.html +145 -0
  220. data/ref/ruby/classes/XX/XHTML.src/M000039.html +36 -0
  221. data/ref/ruby/classes/XX/XHTML/Strict.html +138 -0
  222. data/ref/ruby/classes/XX/XHTML/Strict.src/M000041.html +20 -0
  223. data/ref/ruby/classes/XX/XHTML/Transitional.html +138 -0
  224. data/ref/ruby/classes/XX/XHTML/Transitional.src/M000040.html +20 -0
  225. data/ref/ruby/classes/XX/XML.html +138 -0
  226. data/ref/ruby/classes/XX/XML.src/M000035.html +20 -0
  227. data/ref/ruby/classes/XX/XMLish.html +138 -0
  228. data/ref/ruby/classes/XX/XMLish.src/M000042.html +18 -0
  229. data/ref/ruby/created.rid +1 -0
  230. data/ref/ruby/files/bin/generate_test_rb.html +248 -0
  231. data/ref/ruby/files/bin/generate_test_rb.src/M000001.html +18 -0
  232. data/ref/ruby/files/bin/generate_test_rb.src/M000002.html +40 -0
  233. data/ref/ruby/files/bin/header_to_ruby_rb.html +124 -0
  234. data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +108 -0
  235. data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +101 -0
  236. data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +108 -0
  237. data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +111 -0
  238. data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +108 -0
  239. data/ref/ruby/files/lib/ruby-vpi/rspec_rb.html +115 -0
  240. data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +108 -0
  241. data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +208 -0
  242. data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000003.html +24 -0
  243. data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000004.html +26 -0
  244. data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +107 -0
  245. data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +108 -0
  246. data/ref/ruby/files/lib/ruby-vpi/xx_rb.html +148 -0
  247. data/ref/ruby/files/lib/ruby-vpi_rb.html +111 -0
  248. data/ref/ruby/fr_class_index.html +57 -0
  249. data/ref/ruby/fr_file_index.html +40 -0
  250. data/ref/ruby/fr_method_index.html +121 -0
  251. data/ref/ruby/index.html +24 -0
  252. data/ref/ruby/rdoc-style.css +208 -0
  253. data/samp/counter/counter_rspec_bench.rb +1 -0
  254. data/samp/counter/counter_rspec_bench.v +1 -1
  255. data/samp/counter/counter_xunit_bench.rb +1 -0
  256. data/samp/counter/counter_xunit_bench.v +1 -1
  257. data/samp/pipelined_alu/hw5_unit_test_bench.rb +1 -0
  258. data/samp/pipelined_alu/hw5_unit_test_bench.v +1 -1
  259. data/samp/pipelined_alu/int_gen.rb +6 -7
  260. metadata +269 -2
@@ -18,6 +18,78 @@ We <em>strictly</em> follow the RubyGems project&#8217;s <a href="http://www.rub
18
18
  <p id="fn1"><sup>1</sup> C. Gross, &#8220;Explaining Open Source Version Numbers&#8221;, [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>#&lt;SWIG::TYPE_p_unsigned_int:0x2aaab6574fa0&gt;</pre> now appears as <pre>#&lt;Vpi::Handle vpiModule fullName=counter_rspec_bench, size=-1, file=counter_rspec_bench.v, lineNo=2&gt;</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 &gt; 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 &#8220;find_all_reg&#8221; method would be interpreted as the operation &#8220;find&#8221; and the <span class="caps">VPI</span> property &#8220;all_reg&#8221;.</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&#8217;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 eachother, through generous spacing and minor coloring.</li>
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
 
@@ -19,13 +19,13 @@
19
19
  =end
20
20
 
21
21
  module RubyVpi
22
- # Initializes the current bench by loading:
22
+ # Initializes the bench by loading:
23
23
  # 1. the design.rb file
24
- # 2. the proto.rb file (if prototyping is enabled)
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 interface to the design under test.
28
- # aSpecFormat:: The format of the specification.
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 the Ruby-VPI project's configuration.
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 loadable Ruby code.
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
 
@@ -20,47 +20,35 @@
20
20
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
21
  =end
22
22
 
23
- module SWIG
24
- =begin rdoc
25
- This class represents an object inside a Verilog simulation. Such an object is known as a _handle_ in Verilog jargon. See *vpiHandle* in IEEE Std. 1364-2005 for details.
26
-
27
- = Reading and writing values
28
- There are several ways to read and write a handle's value, depending on its representation.
29
-
30
- == Using +S_vpi_value+ objects
31
- You can read and write values using +S_vpi_value+ objects through the following methods.
32
- * #get_value_wrapper
33
- * Vpi::vpi_get_value
34
- * Vpi::vpi_put_value
35
-
36
- == Using values and formats
37
- You can read and write values, while specifying their format, through the following methods.
38
- * value = handle.#get_value(format)
39
- * handle.#put_value(value, format)
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 ||= get_value_wrapper(VpiObjTypeVal).format
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
- HINT_REGEXP = %r{_([a-z])$}
184
- ASSIGN_REGEXP = %r{=$}
185
- QUERY_REGEXP = %r{\?$}
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
- return child
202
- end
180
+ aTypes.each do |t|
181
+ t = resolve_prop_type(t)
203
182
 
204
- # determine if property is being written
205
- if isAssign = methName =~ ASSIGN_REGEXP
206
- methName.sub! ASSIGN_REGEXP, ''
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
- # determine if property is being queried
210
- if isQuery = methName =~ QUERY_REGEXP
211
- methName.sub! QUERY_REGEXP, ''
212
- end
190
+ handles
191
+ end
213
192
 
214
- # parse Accessor parameter
215
- if accessor = methName[HINT_REGEXP, 1]
216
- methName.sub! HINT_REGEXP, ''
217
- end
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
- # parse Operation parameter
220
- if operation = methName[PREFIX_REGEXP, 1]
221
- methName.sub! PREFIX_REGEXP, ''
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
- # resolve Property parameter into a valid VPI property
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
- puts '', Kernel.caller.join("\n"), '', "operation: #{operation}", "meth: #{aMsg}", "args: #{aArgs.inspect}", "name: #{methName}", "prop: #{propName}", "assign: #{isAssign}", "query: #{isQuery}" if $DEBUG
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
- prop = Vpi.const_get(propName)
297
+ type = Vpi.const_get(name)
232
298
  rescue NameError
233
- raise ArgumentError, "invalid VPI property #{propName.inspect}"
299
+ raise ArgumentError, "#{name.inspect} is not a valid VPI property"
234
300
  end
235
301
 
236
- # access the VPI property
237
- if operation
238
- return self.send(operation.to_sym, prop, *aArgs, &aBlockArg)
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
- break
308
- end
309
- end
306
+ else # infer accessor from VPI property name
307
+ if isQuery
308
+ :b
310
309
 
311
- raise NoMethodError, "unable to access VPI property #{propName.inspect} through method #{aMsg.inspect} with arguments #{aArgs.inspect} for handle #{self}"
312
- end
310
+ else
311
+ case name
312
+ when /Time$/
313
+ :d
313
314
 
314
- # Returns an array of handles of the given type.
315
- def [] aType
316
- handles = []
315
+ when /Val$/
316
+ :l
317
+
318
+ when /Type$/, /Direction$/, /Index$/, /Size$/, /Strength\d?$/, /Polarity$/, /Edge$/, /Offset$/, /Mode$/, /LineNo$/
319
+ :i
317
320
 
318
- if itr = vpi_iterate(aType, self)
319
- while h = vpi_scan(itr)
320
- handles << h
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
- handles
333
+ Property.new type, name, operation, accessor, isAssign
325
334
  end
326
335
 
327
- # Iterates over all handles of the given type and executes the given block once for each handle.
328
- def each aType, &aBlock # :yields: handle
329
- self[aType].each(&aBlock)
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