ruby-vpi 9.0.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. data/HISTORY +120 -56
  2. data/MEMO +8 -0
  3. data/README +1 -1
  4. data/Rakefile +2 -2
  5. data/bin/generate_test.rb +11 -12
  6. data/bin/generate_test_tpl/bench.rb +2 -2
  7. data/bin/generate_test_tpl/bench.v +1 -4
  8. data/bin/generate_test_tpl/design.rb +6 -20
  9. data/bin/generate_test_tpl/proto.rb +5 -3
  10. data/bin/generate_test_tpl/runner.rake +2 -1
  11. data/bin/generate_test_tpl/spec.rb +5 -12
  12. data/doc/background.organization.html +1 -1
  13. data/doc/background.running-tests.html +1 -1
  14. data/doc/index.html +2 -2
  15. data/doc/manual.txt +276 -223
  16. data/doc/problem.ivl.html +3 -3
  17. data/doc/problems.html +1 -1
  18. data/doc/problems.ruby.html +1 -1
  19. data/doc/problems.vsim.html +1 -1
  20. data/doc/setup.html +3 -0
  21. data/doc/setup.installation.html +9 -0
  22. data/doc/setup.maintenance.html +3 -0
  23. data/doc/setup.reqs.html +3 -0
  24. data/doc/src/manual.xml +232 -195
  25. data/doc/styles/manual.css +8 -0
  26. data/doc/usage.examples.html +1 -1
  27. data/doc/usage.html +1 -1
  28. data/doc/usage.tools.html +7 -1
  29. data/doc/usage.tutorial.html +50 -56
  30. data/history.html +195 -77
  31. data/history.part.html +195 -77
  32. data/lib/ruby-vpi/vpi.rb +13 -1
  33. data/lib/ruby-vpi.rb +18 -7
  34. data/memo.html +19 -0
  35. data/memo.part.html +19 -0
  36. data/readme.html +1 -1
  37. data/readme.part.html +1 -1
  38. data/samp/counter/counter_rspec_bench.rb +2 -2
  39. data/samp/counter/counter_rspec_bench.v +1 -4
  40. data/samp/counter/counter_rspec_design.rb +4 -18
  41. data/samp/counter/counter_rspec_proto.rb +7 -5
  42. data/samp/counter/counter_rspec_runner.rake +2 -1
  43. data/samp/counter/counter_rspec_spec.rb +8 -12
  44. data/samp/counter/counter_xunit_bench.rb +2 -2
  45. data/samp/counter/counter_xunit_bench.v +1 -4
  46. data/samp/counter/counter_xunit_design.rb +4 -18
  47. data/samp/counter/counter_xunit_proto.rb +7 -5
  48. data/samp/counter/counter_xunit_runner.rake +2 -1
  49. data/samp/counter/counter_xunit_spec.rb +8 -14
  50. data/samp/pipelined_alu/hw5_unit_test_bench.rb +3 -3
  51. data/samp/pipelined_alu/hw5_unit_test_bench.v +1 -4
  52. data/samp/pipelined_alu/hw5_unit_test_design.rb +49 -65
  53. data/samp/pipelined_alu/hw5_unit_test_proto.rb +9 -5
  54. data/samp/pipelined_alu/hw5_unit_test_runner.rake +2 -1
  55. data/samp/pipelined_alu/hw5_unit_test_spec.rb +18 -21
  56. metadata +8 -242
  57. data/doc/usage.installation.html +0 -9
  58. data/doc/usage.recommendations.html +0 -3
  59. data/doc/usage.requirements.html +0 -3
  60. data/ref/c/annotated.html +0 -35
  61. data/ref/c/common_8h.html +0 -146
  62. data/ref/c/doxygen.css +0 -358
  63. data/ref/c/doxygen.png +0 -0
  64. data/ref/c/files.html +0 -34
  65. data/ref/c/functions.html +0 -134
  66. data/ref/c/functions_vars.html +0 -134
  67. data/ref/c/globals.html +0 -55
  68. data/ref/c/globals_0x63.html +0 -86
  69. data/ref/c/globals_0x65.html +0 -55
  70. data/ref/c/globals_0x66.html +0 -55
  71. data/ref/c/globals_0x70.html +0 -71
  72. data/ref/c/globals_0x72.html +0 -62
  73. data/ref/c/globals_0x73.html +0 -65
  74. data/ref/c/globals_0x74.html +0 -55
  75. data/ref/c/globals_0x76.html +0 -472
  76. data/ref/c/globals_0x78.html +0 -55
  77. data/ref/c/globals_defs.html +0 -81
  78. data/ref/c/globals_defs_0x65.html +0 -50
  79. data/ref/c/globals_defs_0x70.html +0 -51
  80. data/ref/c/globals_defs_0x76.html +0 -463
  81. data/ref/c/globals_defs_0x78.html +0 -50
  82. data/ref/c/globals_enum.html +0 -39
  83. data/ref/c/globals_eval.html +0 -40
  84. data/ref/c/globals_func.html +0 -49
  85. data/ref/c/globals_type.html +0 -63
  86. data/ref/c/globals_vars.html +0 -42
  87. data/ref/c/index.html +0 -20
  88. data/ref/c/relay_8c.html +0 -214
  89. data/ref/c/relay_8h.html +0 -129
  90. data/ref/c/structrelay____RubyOptions____def.html +0 -67
  91. data/ref/c/structt__cb__data.html +0 -151
  92. data/ref/c/structt__vpi__delay.html +0 -134
  93. data/ref/c/structt__vpi__error__info.html +0 -151
  94. data/ref/c/structt__vpi__strengthval.html +0 -83
  95. data/ref/c/structt__vpi__systf__data.html +0 -151
  96. data/ref/c/structt__vpi__time.html +0 -100
  97. data/ref/c/structt__vpi__value.html +0 -204
  98. data/ref/c/structt__vpi__vecval.html +0 -66
  99. data/ref/c/structt__vpi__vlog__info.html +0 -100
  100. data/ref/c/swig_8c.html +0 -80
  101. data/ref/c/swig_8h.html +0 -83
  102. data/ref/c/tab_b.gif +0 -0
  103. data/ref/c/tab_l.gif +0 -0
  104. data/ref/c/tab_r.gif +0 -0
  105. data/ref/c/tabs.css +0 -102
  106. data/ref/c/verilog_8h.html +0 -117
  107. data/ref/c/vlog_8c.html +0 -168
  108. data/ref/c/vlog_8h.html +0 -128
  109. data/ref/c/vpi__user_8h.html +0 -8739
  110. data/ref/ruby/classes/ERB.html +0 -158
  111. data/ref/ruby/classes/ERB.src/M000034.html +0 -29
  112. data/ref/ruby/classes/FileUtils.html +0 -165
  113. data/ref/ruby/classes/FileUtils.src/M000089.html +0 -18
  114. data/ref/ruby/classes/FileUtils.src/M000090.html +0 -18
  115. data/ref/ruby/classes/Integer.html +0 -398
  116. data/ref/ruby/classes/Integer.src/M000012.html +0 -25
  117. data/ref/ruby/classes/Integer.src/M000013.html +0 -18
  118. data/ref/ruby/classes/Integer.src/M000014.html +0 -18
  119. data/ref/ruby/classes/Integer.src/M000015.html +0 -18
  120. data/ref/ruby/classes/Integer.src/M000016.html +0 -18
  121. data/ref/ruby/classes/Integer.src/M000017.html +0 -18
  122. data/ref/ruby/classes/Integer.src/M000020.html +0 -22
  123. data/ref/ruby/classes/Integer.src/M000021.html +0 -22
  124. data/ref/ruby/classes/Integer.src/M000022.html +0 -25
  125. data/ref/ruby/classes/Integer.src/M000023.html +0 -31
  126. data/ref/ruby/classes/Integer.src/M000024.html +0 -25
  127. data/ref/ruby/classes/Integer.src/M000025.html +0 -30
  128. data/ref/ruby/classes/OutputInfo.html +0 -299
  129. data/ref/ruby/classes/OutputInfo.src/M000030.html +0 -51
  130. data/ref/ruby/classes/RDoc.html +0 -135
  131. data/ref/ruby/classes/RDoc.src/M000093.html +0 -40
  132. data/ref/ruby/classes/RubyVpi/Config.html +0 -148
  133. data/ref/ruby/classes/RubyVpi.html +0 -186
  134. data/ref/ruby/classes/RubyVpi.src/M000091.html +0 -50
  135. data/ref/ruby/classes/RubyVpi.src/M000092.html +0 -20
  136. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.html +0 -407
  137. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000081.html +0 -18
  138. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000082.html +0 -18
  139. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000083.html +0 -22
  140. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000084.html +0 -44
  141. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000085.html +0 -82
  142. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000086.html +0 -127
  143. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000087.html +0 -26
  144. data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000088.html +0 -18
  145. data/ref/ruby/classes/SWIG.html +0 -111
  146. data/ref/ruby/classes/String.html +0 -158
  147. data/ref/ruby/classes/String.src/M000032.html +0 -41
  148. data/ref/ruby/classes/String.src/M000033.html +0 -18
  149. data/ref/ruby/classes/Table.html +0 -191
  150. data/ref/ruby/classes/Table.src/M000026.html +0 -38
  151. data/ref/ruby/classes/Table.src/M000027.html +0 -18
  152. data/ref/ruby/classes/Table.src/M000028.html +0 -18
  153. data/ref/ruby/classes/Table.src/M000029.html +0 -18
  154. data/ref/ruby/classes/Template.html +0 -158
  155. data/ref/ruby/classes/Template.src/M000031.html +0 -18
  156. data/ref/ruby/classes/VerilogParser/Module/Parameter.html +0 -160
  157. data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000011.html +0 -21
  158. data/ref/ruby/classes/VerilogParser/Module/Port.html +0 -207
  159. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000007.html +0 -21
  160. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000008.html +0 -18
  161. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000009.html +0 -18
  162. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000010.html +0 -18
  163. data/ref/ruby/classes/VerilogParser/Module.html +0 -172
  164. data/ref/ruby/classes/VerilogParser/Module.src/M000006.html +0 -29
  165. data/ref/ruby/classes/VerilogParser.html +0 -187
  166. data/ref/ruby/classes/VerilogParser.src/M000005.html +0 -34
  167. data/ref/ruby/classes/XX/Document.html +0 -295
  168. data/ref/ruby/classes/XX/Document.src/M000072.html +0 -22
  169. data/ref/ruby/classes/XX/Document.src/M000073.html +0 -20
  170. data/ref/ruby/classes/XX/Document.src/M000074.html +0 -20
  171. data/ref/ruby/classes/XX/Document.src/M000075.html +0 -20
  172. data/ref/ruby/classes/XX/Document.src/M000076.html +0 -22
  173. data/ref/ruby/classes/XX/Document.src/M000077.html +0 -21
  174. data/ref/ruby/classes/XX/Document.src/M000078.html +0 -21
  175. data/ref/ruby/classes/XX/Document.src/M000079.html +0 -34
  176. data/ref/ruby/classes/XX/Document.src/M000080.html +0 -98
  177. data/ref/ruby/classes/XX/HTML4/Strict.html +0 -138
  178. data/ref/ruby/classes/XX/HTML4/Strict.src/M000038.html +0 -20
  179. data/ref/ruby/classes/XX/HTML4/Transitional.html +0 -138
  180. data/ref/ruby/classes/XX/HTML4/Transitional.src/M000037.html +0 -20
  181. data/ref/ruby/classes/XX/HTML4.html +0 -145
  182. data/ref/ruby/classes/XX/HTML4.src/M000036.html +0 -20
  183. data/ref/ruby/classes/XX/Markup/ClassMethods.html +0 -236
  184. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000044.html +0 -22
  185. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000045.html +0 -20
  186. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000046.html +0 -25
  187. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000047.html +0 -20
  188. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000048.html +0 -27
  189. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000049.html +0 -20
  190. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000050.html +0 -27
  191. data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000051.html +0 -22
  192. data/ref/ruby/classes/XX/Markup/Error.html +0 -111
  193. data/ref/ruby/classes/XX/Markup/InstanceMethods.html +0 -474
  194. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000052.html +0 -56
  195. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000053.html +0 -33
  196. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000054.html +0 -31
  197. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000055.html +0 -48
  198. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000056.html +0 -20
  199. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000057.html +0 -31
  200. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000058.html +0 -32
  201. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000059.html +0 -32
  202. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000060.html +0 -28
  203. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000061.html +0 -23
  204. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000062.html +0 -26
  205. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000063.html +0 -20
  206. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000064.html +0 -20
  207. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000065.html +0 -20
  208. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000066.html +0 -20
  209. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000067.html +0 -20
  210. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000068.html +0 -21
  211. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000069.html +0 -20
  212. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000070.html +0 -20
  213. data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000071.html +0 -20
  214. data/ref/ruby/classes/XX/Markup.html +0 -160
  215. data/ref/ruby/classes/XX/Markup.src/M000043.html +0 -28
  216. data/ref/ruby/classes/XX/XHTML/Strict.html +0 -138
  217. data/ref/ruby/classes/XX/XHTML/Strict.src/M000041.html +0 -20
  218. data/ref/ruby/classes/XX/XHTML/Transitional.html +0 -138
  219. data/ref/ruby/classes/XX/XHTML/Transitional.src/M000040.html +0 -20
  220. data/ref/ruby/classes/XX/XHTML.html +0 -145
  221. data/ref/ruby/classes/XX/XHTML.src/M000039.html +0 -36
  222. data/ref/ruby/classes/XX/XML.html +0 -138
  223. data/ref/ruby/classes/XX/XML.src/M000035.html +0 -20
  224. data/ref/ruby/classes/XX/XMLish.html +0 -138
  225. data/ref/ruby/classes/XX/XMLish.src/M000042.html +0 -18
  226. data/ref/ruby/classes/XX.html +0 -138
  227. data/ref/ruby/created.rid +0 -1
  228. data/ref/ruby/files/bin/generate_test_rb.html +0 -245
  229. data/ref/ruby/files/bin/generate_test_rb.src/M000001.html +0 -18
  230. data/ref/ruby/files/bin/generate_test_rb.src/M000002.html +0 -39
  231. data/ref/ruby/files/bin/header_to_ruby_rb.html +0 -125
  232. data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +0 -108
  233. data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +0 -101
  234. data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +0 -108
  235. data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +0 -111
  236. data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +0 -108
  237. data/ref/ruby/files/lib/ruby-vpi/rspec_rb.html +0 -115
  238. data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +0 -108
  239. data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +0 -208
  240. data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000003.html +0 -24
  241. data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000004.html +0 -26
  242. data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +0 -107
  243. data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +0 -108
  244. data/ref/ruby/files/lib/ruby-vpi/xx_rb.html +0 -148
  245. data/ref/ruby/files/lib/ruby-vpi_rb.html +0 -109
  246. data/ref/ruby/fr_class_index.html +0 -56
  247. data/ref/ruby/fr_file_index.html +0 -40
  248. data/ref/ruby/fr_method_index.html +0 -119
  249. data/ref/ruby/index.html +0 -24
  250. data/ref/ruby/rdoc-style.css +0 -208
data/memo.html CHANGED
@@ -104,6 +104,11 @@ Ask for help, give feedback, or discuss.</p>
104
104
  <h1>Pending tasks</h1>
105
105
 
106
106
 
107
+ <ul>
108
+ <li>interactive console <span class="caps">IRB</span> wrapper for spec (just like Breakpoints in Rails)</li>
109
+ </ul>
110
+
111
+
107
112
  <ul>
108
113
  <li>add support for reading &#38; writing vpi_delay values</li>
109
114
  </ul>
@@ -125,6 +130,15 @@ Ask for help, give feedback, or discuss.</p>
125
130
  </ul>
126
131
 
127
132
 
133
+ <ul>
134
+ <li>need to dump signal values when expectation fails in rSpec
135
+ <ul>
136
+ <li>maybe a waveform dump will also help</li>
137
+ <li>this will help in debugging the problem</li>
138
+ </ul></li>
139
+ </ul>
140
+
141
+
128
142
  <h1>Finished tasks</h1>
129
143
 
130
144
 
@@ -170,6 +184,11 @@ Ask for help, give feedback, or discuss.</p>
170
184
  </ul>
171
185
 
172
186
 
187
+ <ul>
188
+ <li>method_missing for Design class</li>
189
+ </ul>
190
+
191
+
173
192
  <h1>Obsolete tasks</h1>
174
193
 
175
194
 
data/memo.part.html CHANGED
@@ -9,6 +9,11 @@
9
9
  <h1>Pending tasks</h1>
10
10
 
11
11
 
12
+ <ul>
13
+ <li>interactive console <span class="caps">IRB</span> wrapper for spec (just like Breakpoints in Rails)</li>
14
+ </ul>
15
+
16
+
12
17
  <ul>
13
18
  <li>add support for reading &#38; writing vpi_delay values</li>
14
19
  </ul>
@@ -30,6 +35,15 @@
30
35
  </ul>
31
36
 
32
37
 
38
+ <ul>
39
+ <li>need to dump signal values when expectation fails in rSpec
40
+ <ul>
41
+ <li>maybe a waveform dump will also help</li>
42
+ <li>this will help in debugging the problem</li>
43
+ </ul></li>
44
+ </ul>
45
+
46
+
33
47
  <h1>Finished tasks</h1>
34
48
 
35
49
 
@@ -75,6 +89,11 @@
75
89
  </ul>
76
90
 
77
91
 
92
+ <ul>
93
+ <li>method_missing for Design class</li>
94
+ </ul>
95
+
96
+
78
97
  <h1>Obsolete tasks</h1>
79
98
 
80
99
 
data/readme.html CHANGED
@@ -105,7 +105,7 @@ Ask for help, give feedback, or discuss.</p>
105
105
  <ul>
106
106
  <li>Prototype and verify designs <em>quickly</em> using <a href="http://behaviour-driven.org/" title="behavior-driven development"><span class="caps">BDD</span></a>, <a href="http://www.agiledata.org/essays/tdd.html" title="test-driven development"><span class="caps">TDD</span></a>, and more.</li>
107
107
  <li>Reuse the <em>same</em> specification to verify both prototype and design.</li>
108
- <li>Specifications are executable <em>and</em> human-readable. (See this <a href="./doc/usage.tutorial.html#fig..counter_rspecTest_spec.rb">example specification</a> and its <a href="./doc/usage.tutorial.html#fig..test-proto.rspec">boss-friendly output</a>.)</li>
108
+ <li>Specifications are executable <em>and</em> human-readable. (See this <a href="./doc/usage.tutorial.html#fig..counter_rspec_spec.rb">example specification</a> and its <a href="./doc/usage.tutorial.html#fig..test-proto.rspec">boss-friendly output</a>.)</li>
109
109
  </ul>
110
110
 
111
111
 
data/readme.part.html CHANGED
@@ -10,7 +10,7 @@
10
10
  <ul>
11
11
  <li>Prototype and verify designs <em>quickly</em> using <a href="http://behaviour-driven.org/" title="behavior-driven development"><span class="caps">BDD</span></a>, <a href="http://www.agiledata.org/essays/tdd.html" title="test-driven development"><span class="caps">TDD</span></a>, and more.</li>
12
12
  <li>Reuse the <em>same</em> specification to verify both prototype and design.</li>
13
- <li>Specifications are executable <em>and</em> human-readable. (See this <a href="./doc/usage.tutorial.html#fig..counter_rspecTest_spec.rb">example specification</a> and its <a href="./doc/usage.tutorial.html#fig..test-proto.rspec">boss-friendly output</a>.)</li>
13
+ <li>Specifications are executable <em>and</em> human-readable. (See this <a href="./doc/usage.tutorial.html#fig..counter_rspec_spec.rb">example specification</a> and its <a href="./doc/usage.tutorial.html#fig..test-proto.rspec">boss-friendly output</a>.)</li>
14
14
  </ul>
15
15
 
16
16
 
@@ -1,9 +1,9 @@
1
- ## This is the Ruby side of the bench.
1
+ # This file is the Ruby side of the bench.
2
2
 
3
3
  require 'ruby-vpi'
4
4
  require 'ruby-vpi/rspec'
5
5
 
6
- RubyVpi.init_bench 'counter_rspec', :CounterPrototype
6
+ RubyVpi.init_bench 'counter_rspec', :Counter
7
7
 
8
8
  # service the $ruby_relay callback
9
9
  # The rSpec library will take control henceforth.
@@ -1,7 +1,4 @@
1
- /* This is the Verilog side of the bench. */
2
-
3
- `include "counter.v"
4
-
1
+ /* This file is the Verilog side of the bench. */
5
2
  module counter_rspec_bench;
6
3
 
7
4
  // instantiate the design under test
@@ -1,22 +1,8 @@
1
- # An interface to the design under test.
2
- class Counter
3
- include Vpi
4
-
5
- Size = 5
6
-
7
- attr_reader :clock, :reset, :count
8
-
9
- def initialize
10
- @clock = vpi_handle_by_name("counter_rspec_bench.clock", nil)
11
- @reset = vpi_handle_by_name("counter_rspec_bench.reset", nil)
12
- @count = vpi_handle_by_name("counter_rspec_bench.count", nil)
13
- end
14
-
1
+ # This is a Ruby interface to the design under test.
2
+ class << Counter
15
3
  def reset!
16
- @reset.hexStrVal = 'x'
17
-
18
- @reset.intVal = 1
4
+ reset.intVal = 1
19
5
  relay_verilog
20
- @reset.intVal = 0
6
+ reset.intVal = 0
21
7
  end
22
8
  end
@@ -1,10 +1,12 @@
1
- # A prototype of the design under test.
2
- class CounterPrototype < Counter
1
+ # This is a prototype of the design under test.
2
+ class << Counter
3
+ # When prototyping is enabled, this method is invoked
4
+ # instead of Vpi::relay_verilog to simulate the design.
3
5
  def simulate!
4
- if @reset.intVal == 1
5
- @count.intVal = 0
6
+ if reset.intVal == 1
7
+ count.intVal = 0
6
8
  else
7
- @count.intVal += 1
9
+ count.intVal += 1
8
10
  end
9
11
  end
10
12
  end
@@ -1,7 +1,8 @@
1
- ## This file builds and runs the test.
1
+ # This file runs the test.
2
2
 
3
3
  # These are source files that are to be compiled.
4
4
  SIMULATOR_SOURCES = [
5
+ 'counter.v',
5
6
  'counter_rspec_bench.v',
6
7
  ]
7
8
 
@@ -1,26 +1,23 @@
1
- ## This specification verifies the design under test.
1
+ # This file is a behavioral specification for the design under test.
2
2
 
3
3
  # lowest upper bound of counter's value
4
- LIMIT = 2 ** Counter::Size
4
+ LIMIT = 2 ** Counter.Size.intVal
5
5
 
6
6
  # maximum allowed value for a counter
7
7
  MAX = LIMIT - 1
8
8
 
9
- include Vpi
10
-
11
9
  context "A resetted counter's value" do
12
10
  setup do
13
- @design = Counter.new
14
- @design.reset!
11
+ Counter.reset!
15
12
  end
16
13
 
17
14
  specify "should be zero" do
18
- @design.count.intVal.should_equal 0
15
+ Counter.count.intVal.should_equal 0
19
16
  end
20
17
 
21
18
  specify "should increment by one count upon each rising clock edge" do
22
19
  LIMIT.times do |i|
23
- @design.count.intVal.should_equal i
20
+ Counter.count.intVal.should_equal i
24
21
 
25
22
  # advance the clock
26
23
  relay_verilog
@@ -30,18 +27,17 @@ end
30
27
 
31
28
  context "A counter with the maximum value" do
32
29
  setup do
33
- @design = Counter.new
34
- @design.reset!
30
+ Counter.reset!
35
31
 
36
32
  # increment the counter to maximum value
37
33
  MAX.times do relay_verilog end
38
- @design.count.intVal.should_equal MAX
34
+ Counter.count.intVal.should_equal MAX
39
35
  end
40
36
 
41
37
  specify "should overflow upon increment" do
42
38
  # increment the counter
43
39
  relay_verilog
44
40
 
45
- @design.count.intVal.should_equal 0
41
+ Counter.count.intVal.should_equal 0
46
42
  end
47
43
  end
@@ -1,9 +1,9 @@
1
- ## This is the Ruby side of the bench.
1
+ # This file is the Ruby side of the bench.
2
2
 
3
3
  require 'ruby-vpi'
4
4
  require 'test/unit'
5
5
 
6
- RubyVpi.init_bench 'counter_xunit', :CounterPrototype
6
+ RubyVpi.init_bench 'counter_xunit', :Counter
7
7
 
8
8
  # service the $ruby_relay callback
9
9
  # The xUnit library will take control henceforth.
@@ -1,7 +1,4 @@
1
- /* This is the Verilog side of the bench. */
2
-
3
- `include "counter.v"
4
-
1
+ /* This file is the Verilog side of the bench. */
5
2
  module counter_xunit_bench;
6
3
 
7
4
  // instantiate the design under test
@@ -1,22 +1,8 @@
1
- # An interface to the design under test.
2
- class Counter
3
- include Vpi
4
-
5
- Size = 5
6
-
7
- attr_reader :clock, :reset, :count
8
-
9
- def initialize
10
- @clock = vpi_handle_by_name("counter_xunit_bench.clock", nil)
11
- @reset = vpi_handle_by_name("counter_xunit_bench.reset", nil)
12
- @count = vpi_handle_by_name("counter_xunit_bench.count", nil)
13
- end
14
-
1
+ # This is a Ruby interface to the design under test.
2
+ class << Counter
15
3
  def reset!
16
- @reset.hexStrVal = 'x'
17
-
18
- @reset.intVal = 1
4
+ reset.intVal = 1
19
5
  relay_verilog
20
- @reset.intVal = 0
6
+ reset.intVal = 0
21
7
  end
22
8
  end
@@ -1,10 +1,12 @@
1
- # A prototype of the design under test.
2
- class CounterPrototype < Counter
1
+ # This is a prototype of the design under test.
2
+ class << Counter
3
+ # When prototyping is enabled, this method is invoked
4
+ # instead of Vpi::relay_verilog to simulate the design.
3
5
  def simulate!
4
- if @reset.intVal == 1
5
- @count.intVal = 0
6
+ if reset.intVal == 1
7
+ count.intVal = 0
6
8
  else
7
- @count.intVal += 1
9
+ count.intVal += 1
8
10
  end
9
11
  end
10
12
  end
@@ -1,7 +1,8 @@
1
- ## This file builds and runs the test.
1
+ # This file runs the test.
2
2
 
3
3
  # These are source files that are to be compiled.
4
4
  SIMULATOR_SOURCES = [
5
+ 'counter.v',
5
6
  'counter_xunit_bench.v',
6
7
  ]
7
8
 
@@ -1,26 +1,23 @@
1
- ## This specification verifies the design under test.
1
+ # This file is a behavioral specification for the design under test.
2
2
 
3
3
  # lowest upper bound of counter's value
4
- LIMIT = 2 ** Counter::Size
4
+ LIMIT = 2 ** Counter.Size.intVal
5
5
 
6
6
  # maximum allowed value for a counter
7
7
  MAX = LIMIT - 1
8
8
 
9
9
  class ResettedCounterValue < Test::Unit::TestCase
10
- include Vpi
11
-
12
10
  def setup
13
- @design = Counter.new
14
- @design.reset!
11
+ Counter.reset!
15
12
  end
16
13
 
17
14
  def test_zero
18
- assert_equal 0, @design.count.intVal
15
+ assert_equal 0, Counter.count.intVal
19
16
  end
20
17
 
21
18
  def test_increment
22
19
  LIMIT.times do |i|
23
- assert_equal i, @design.count.intVal
20
+ assert_equal i, Counter.count.intVal
24
21
 
25
22
  # advance the clock
26
23
  relay_verilog
@@ -29,21 +26,18 @@ class ResettedCounterValue < Test::Unit::TestCase
29
26
  end
30
27
 
31
28
  class MaximumCounterValue < Test::Unit::TestCase
32
- include Vpi
33
-
34
29
  def setup
35
- @design = Counter.new
36
- @design.reset!
30
+ Counter.reset!
37
31
 
38
32
  # increment the counter to maximum value
39
33
  MAX.times do relay_verilog end
40
- assert_equal MAX, @design.count.intVal
34
+ assert_equal MAX, Counter.count.intVal
41
35
  end
42
36
 
43
37
  def test_overflow
44
38
  # increment the counter
45
39
  relay_verilog
46
40
 
47
- assert_equal 0, @design.count.intVal
41
+ assert_equal 0, Counter.count.intVal
48
42
  end
49
43
  end
@@ -1,9 +1,9 @@
1
- ## This is the Ruby side of the bench.
1
+ # This file is the Ruby side of the bench.
2
2
 
3
3
  require 'ruby-vpi'
4
4
  require 'test/unit'
5
5
 
6
- RubyVpi.init_bench 'hw5_unit_test', :Hw5_unitPrototype
6
+ RubyVpi.init_bench 'hw5_unit_test', :Hw5_unit
7
7
 
8
8
  # service the $ruby_relay callback
9
- # The UnitTest library will take control henceforth.
9
+ # The xUnit library will take control henceforth.
@@ -1,7 +1,4 @@
1
- /* This is the Verilog side of the bench. */
2
-
3
- `include "hw5_unit.v"
4
-
1
+ /* This file is the Verilog side of the bench. */
5
2
  module hw5_unit_test_bench;
6
3
 
7
4
  // instantiate the design under test
@@ -1,88 +1,72 @@
1
- # An interface to the design under test.
2
- class Hw5_unit
3
- include Vpi
4
-
5
- WIDTH = 32
6
- DATABITS = 7
7
- OP_NOP = 0
8
- OP_ADD = 1
9
- OP_SUB = 2
10
- OP_MULT = 3
11
-
12
- # Supported types of ALU operations.
13
- OPERATIONS = constants.grep(/^OP_/).map {|s| const_get s}
14
-
15
- # Number of cycles needed to reset this design.
16
- RESET_DELAY = 5
17
-
18
- attr_reader :clk, :reset, :in_databits, :a, :b, :in_op, :res, :out_databits, :out_op
19
-
20
- def initialize
21
- @clk = vpi_handle_by_name("hw5_unit_test_bench.clk", nil)
22
- @reset = vpi_handle_by_name("hw5_unit_test_bench.reset", nil)
23
- @in_databits = vpi_handle_by_name("hw5_unit_test_bench.in_databits", nil)
24
- @a = vpi_handle_by_name("hw5_unit_test_bench.a", nil)
25
- @b = vpi_handle_by_name("hw5_unit_test_bench.b", nil)
26
- @in_op = vpi_handle_by_name("hw5_unit_test_bench.in_op", nil)
27
- @res = vpi_handle_by_name("hw5_unit_test_bench.res", nil)
28
- @out_databits = vpi_handle_by_name("hw5_unit_test_bench.out_databits", nil)
29
- @out_op = vpi_handle_by_name("hw5_unit_test_bench.out_op", nil)
30
- end
1
+ # This is a Ruby interface to the design under test.
2
+
3
+ WIDTH = 32
4
+ DATABITS = 7
5
+ OP_NOP = 0
6
+ OP_ADD = 1
7
+ OP_SUB = 2
8
+ OP_MULT = 3
9
+ OPERATIONS = (OP_NOP..OP_MULT).to_a
10
+
11
+ # Number of cycles needed to reset this design.
12
+ RESET_DELAY = 5
31
13
 
14
+ class << Hw5_unit
32
15
  def reset!
33
- @reset.hexStrVal = 'x'
34
- @in_databits.hexStrVal = 'x'
35
- @a.hexStrVal = 'x'
36
- @b.hexStrVal = 'x'
37
- @in_op.hexStrVal = 'x'
16
+ reset.hexStrVal = 'x'
17
+ in_databits.hexStrVal = 'x'
18
+ a.hexStrVal = 'x'
19
+ b.hexStrVal = 'x'
20
+ in_op.hexStrVal = 'x'
38
21
 
39
22
 
40
- @reset.intVal = 1
23
+ reset.intVal = 1
41
24
 
42
25
  RESET_DELAY.times do
43
26
  relay_verilog
44
27
  end
45
28
 
46
- @reset.intVal = 0
29
+ reset.intVal = 0
47
30
  end
31
+ end
48
32
 
49
- # Represents an ALU operation.
50
- class Operation
51
- attr_accessor :type, :tag, :arg1, :arg2, :stage, :result
52
33
 
53
- def initialize(type, tag, arg1 = 0, arg2 = 0)
54
- raise ArgumentError unless OPERATIONS.include? type
34
+ # Represents an ALU operation.
35
+ class Operation
36
+ attr_accessor :type, :tag, :arg1, :arg2, :stage, :result
55
37
 
56
- @type = type
57
- @tag = tag
58
- @arg1 = arg1
59
- @arg2 = arg2
38
+ def initialize(type, tag, arg1 = 0, arg2 = 0)
39
+ raise ArgumentError unless OPERATIONS.include? type
60
40
 
61
- @stage = 0
62
- end
41
+ @type = type
42
+ @tag = tag
43
+ @arg1 = arg1
44
+ @arg2 = arg2
63
45
 
64
- # Computes the result of this operation.
65
- def compute
66
- case @type
67
- when OP_ADD
68
- @arg1 + @arg2
46
+ @stage = 0
47
+ end
69
48
 
70
- when OP_SUB
71
- @arg1 - @arg2
49
+ # Computes the result of this operation.
50
+ def compute
51
+ case @type
52
+ when OP_ADD
53
+ @arg1 + @arg2
72
54
 
73
- when OP_MULT
74
- @arg1 * @arg2
55
+ when OP_SUB
56
+ @arg1 - @arg2
75
57
 
76
- when OP_NOP
77
- nil
58
+ when OP_MULT
59
+ @arg1 * @arg2
78
60
 
79
- else
80
- raise
81
- end
82
- end
61
+ when OP_NOP
62
+ nil
83
63
 
84
- def compute!
85
- @result = compute
64
+ else
65
+ raise
86
66
  end
87
67
  end
68
+
69
+ def compute!
70
+ @result = compute
71
+ end
88
72
  end
@@ -1,10 +1,14 @@
1
- # A prototype of the design under test.
2
- class Hw5_unitPrototype < Hw5_unit
1
+ # This is a prototype of the design under test.
2
+ class << Hw5_unit
3
+ # When prototyping is enabled, this method is invoked
4
+ # instead of Vpi::relay_verilog to simulate the design.
3
5
  def simulate!
6
+ raise NotImplementedError, "Prototype is not yet implemented."
7
+
4
8
  # discard old outputs
5
- @res.hexStrVal = 'x'
6
- @out_databits.hexStrVal = 'x'
7
- @out_op.hexStrVal = 'x'
9
+ res.hexStrVal = 'x'
10
+ out_databits.hexStrVal = 'x'
11
+ out_op.hexStrVal = 'x'
8
12
 
9
13
  # process new inputs
10
14
 
@@ -1,7 +1,8 @@
1
- ## This file builds and runs the test.
1
+ # This file runs the test.
2
2
 
3
3
  # These are source files that are to be compiled.
4
4
  SIMULATOR_SOURCES = [
5
+ 'hw5_unit.v',
5
6
  'hw5_unit_test_bench.v',
6
7
  ]
7
8
 
@@ -1,4 +1,3 @@
1
- ## This specification verifies the design under test.
2
1
  =begin
3
2
  Copyright 2006 Suraj N. Kurapati
4
3
 
@@ -19,25 +18,23 @@
19
18
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
19
  =end
21
20
 
21
+ # This file is a behavioral specification for the design under test.
22
+
22
23
  require 'InputGenerator'
23
24
 
24
25
  class Hw5_unit_test_spec < Test::Unit::TestCase
25
- include Vpi
26
-
27
26
  # Number of input sequences to test.
28
27
  NUM_TESTS = 4000
29
28
 
30
29
  # Bitmask capable of capturing ALU result.
31
- ALU_RESULT_MASK = (2 ** Hw5_unit::WIDTH) - 1
30
+ ALU_RESULT_MASK = (2 ** WIDTH) - 1
32
31
 
33
32
  # Upper limit of values allowed for an operation's tag.
34
- OPERATION_TAG_LIMIT = 2 ** Hw5_unit::DATABITS
33
+ OPERATION_TAG_LIMIT = 2 ** DATABITS
35
34
 
36
35
  def setup
37
- @design = Hw5_unit.new
38
- @design.reset!
39
-
40
- @inputGen = InputGenerator.new(Hw5_unit::WIDTH)
36
+ Hw5_unit.reset!
37
+ @inputGen = InputGenerator.new(WIDTH)
41
38
  end
42
39
 
43
40
  def test_pipeline
@@ -47,17 +44,17 @@ class Hw5_unit_test_spec < Test::Unit::TestCase
47
44
  until numVerified == NUM_TESTS
48
45
  # issue a new operation
49
46
  if numIssued < NUM_TESTS
50
- op = Hw5_unit::Operation.new(
51
- Hw5_unit::OPERATIONS[rand(Hw5_unit::OPERATIONS.size)],
47
+ op = Operation.new(
48
+ OPERATIONS[rand(OPERATIONS.size)],
52
49
  numIssued % OPERATION_TAG_LIMIT,
53
50
  @inputGen.gen,
54
51
  @inputGen.gen
55
52
  )
56
53
 
57
- @design.a.intVal = op.arg1
58
- @design.b.intVal = op.arg2
59
- @design.in_op.intVal = op.type
60
- @design.in_databits.intVal = op.tag
54
+ Hw5_unit.a.intVal = op.arg1
55
+ Hw5_unit.b.intVal = op.arg2
56
+ Hw5_unit.in_op.intVal = op.type
57
+ Hw5_unit.in_databits.intVal = op.tag
61
58
 
62
59
  issuedOps << op
63
60
  numIssued += 1
@@ -66,18 +63,18 @@ class Hw5_unit_test_spec < Test::Unit::TestCase
66
63
  relay_verilog
67
64
 
68
65
  # verify result of finished operation
69
- unless @design.out_databits.x?
70
- finishedOp = Hw5_unit::Operation.new(
71
- @design.out_op.intVal,
72
- @design.out_databits.intVal
66
+ unless Hw5_unit.out_databits.x?
67
+ finishedOp = Operation.new(
68
+ Hw5_unit.out_op.intVal,
69
+ Hw5_unit.out_databits.intVal
73
70
  )
74
- finishedOp.result = @design.res.intVal & ALU_RESULT_MASK
71
+ finishedOp.result = Hw5_unit.res.intVal & ALU_RESULT_MASK
75
72
 
76
73
  expectedOp = issuedOps.shift
77
74
  assert_equal expectedOp.type, finishedOp.type, "incorrect operation"
78
75
  assert_equal expectedOp.tag, finishedOp.tag, "incorrect tag"
79
76
 
80
- unless finishedOp.type == Hw5_unit::OP_NOP
77
+ unless finishedOp.type == OP_NOP
81
78
  assert_equal expectedOp.compute & ALU_RESULT_MASK, finishedOp.result, "incorrect result"
82
79
  end
83
80