ruby-vpi 9.0.0 → 10.0.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 (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
@@ -15,6 +15,14 @@ body {
15
15
  font-family: serif;
16
16
  }
17
17
 
18
+ h3, h4, h5, h6 {
19
+ margin-top: 10em;
20
+ text-align: center;
21
+
22
+ background-color: mistyrose;
23
+ padding: 1em;
24
+ }
25
+
18
26
  /* source code */
19
27
  .screen, .filename {
20
28
  background-color: whitesmoke;
@@ -1,3 +1,3 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Examples</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="usage.html" title="Chapter 3. Usage" /><link rel="prev" href="usage.tools.html" title="Tools" /><link rel="next" href="usage.tutorial.html" title="Tutorial" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usage.tools.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center">Chapter 3. Usage</th><td width="20%" align="right"> <a accesskey="n" href="usage.tutorial.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="usage.examples"></a>Examples</h2></div></div></div><p>The <code class="filename">samp</code> directory contains several example tests which illustrate how <span class="application">Ruby-VPI</span> can be used. Each example has an associated <code class="filename">Rakefile</code> which simplifies the process of running it. Therefore, simply navigate into an example directory and run the command <span><strong class="command">rake</strong></span> to get started.</p><p>Also, some example specifications make use of BDD through the <span class="application">rSpec</span> library. See the <a href="background.methodology.html" title="Methodology">the section called “Methodology”</a> for a discussion of <span class="application">rSpec</span>.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.tools.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"><a accesskey="u" href="usage.html"><img src="images/up.png" alt="Up" /></a></td><td width="40%" align="right"> <a accesskey="n" href="usage.tutorial.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Tools </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Tutorial</td></tr></table></div></body></html>
3
+ <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Examples</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="usage.html" title="Chapter 4. Usage" /><link rel="prev" href="usage.tutorial.html" title="Tutorial" /><link rel="next" href="problems.html" title="Chapter 5. Known problems" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usage.tutorial.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center">Chapter 4. Usage</th><td width="20%" align="right"> <a accesskey="n" href="problems.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="usage.examples"></a>Examples</h2></div></div></div><p>The <code class="filename">samp</code> directory contains several example tests which illustrate how <span class="application">Ruby-VPI</span> can be used. Each example has an associated <code class="filename">Rakefile</code> which simplifies the process of running it. Therefore, simply navigate into an example directory and run the command <span><strong class="command">rake</strong></span> to get started.</p><p>Also, some example specifications make use of BDD through the <span class="application">rSpec</span> library. See the <a href="background.methodology.html" title="Methodology">the section called “Methodology”</a> for a discussion of <span class="application">rSpec</span>.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.tutorial.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"><a accesskey="u" href="usage.html"><img src="images/up.png" alt="Up" /></a></td><td width="40%" align="right"> <a accesskey="n" href="problems.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Tutorial </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Chapter 5. Known problems</td></tr></table></div></body></html>
data/doc/usage.html CHANGED
@@ -1,3 +1,3 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Usage</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="index.html" title="Ruby-VPI user manual" /><link rel="prev" href="background.running-tests.html" title="Running a test" /><link rel="next" href="usage.requirements.html" title="Requirements" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Usage</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="background.running-tests.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="usage.requirements.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="usage"></a>Chapter 3. Usage</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="usage.requirements.html">Requirements</a></span></dt><dt><span class="section"><a href="usage.recommendations.html">Recommendations</a></span></dt><dt><span class="section"><a href="usage.installation.html">Installation and maintenance</a></span></dt><dd><dl><dt><span class="section"><a href="usage.installation.html#usage.installation.windows">Installing on Windows</a></span></dt></dl></dd><dt><span class="section"><a href="usage.tools.html">Tools</a></span></dt><dd><dl><dt><span class="section"><a href="usage.tools.html#usage.tools.generate-test">Automated test generation</a></span></dt><dt><span class="section"><a href="usage.tools.html#usage.tools.verilog-ruby-conv">Verilog to Ruby conversion</a></span></dt></dl></dd><dt><span class="section"><a href="usage.examples.html">Examples</a></span></dt><dt><span class="section"><a href="usage.tutorial.html">Tutorial</a></span></dt><dd><dl><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.declare-design">Start with a design</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.generate-test">Generate a test</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.specification">Specify your expectations</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.implement-proto">Implement the prototype</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.test-proto">Verify the prototype</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.implement-design">Implement the design</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.test-design">Verify the design</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="background.running-tests.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="usage.requirements.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Running a test </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Requirements</td></tr></table></div></body></html>
3
+ <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4. Usage</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="index.html" title="Ruby-VPI user manual" /><link rel="prev" href="setup.maintenance.html" title="Maintenance" /><link rel="next" href="usage.tools.html" title="Tools" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Usage</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="setup.maintenance.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="usage.tools.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="usage"></a>Chapter 4. Usage</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="usage.tools.html">Tools</a></span></dt><dd><dl><dt><span class="section"><a href="usage.tools.html#usage.tools.generate-test">Automated test generation</a></span></dt><dt><span class="section"><a href="usage.tools.html#usage.tools.verilog-ruby-conv">Verilog to Ruby conversion</a></span></dt></dl></dd><dt><span class="section"><a href="usage.tutorial.html">Tutorial</a></span></dt><dd><dl><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.declare-design">Start with a design</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.generate-test">Generate a test</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.specification">Specify your expectations</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.implement-proto">Implement the prototype</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.test-proto">Verify the prototype</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.implement-design">Implement the design</a></span></dt><dt><span class="section"><a href="usage.tutorial.html#usage.tutorial.test-design">Verify the design</a></span></dt></dl></dd><dt><span class="section"><a href="usage.examples.html">Examples</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="setup.maintenance.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="usage.tools.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Maintenance </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Tools</td></tr></table></div></body></html>
data/doc/usage.tools.html CHANGED
@@ -1,3 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Tools</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="usage.html" title="Chapter 3. Usage" /><link rel="prev" href="usage.installation.html" title="Installation and maintenance" /><link rel="next" href="usage.examples.html" title="Examples" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Tools</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usage.installation.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center">Chapter 3. Usage</th><td width="20%" align="right"> <a accesskey="n" href="usage.examples.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="usage.tools"></a>Tools</h2></div></div></div><p>The <code class="filename">bin</code> directory contains various utilities which ease the process of writing tests. Each tool provides help and usage information invoked with the <code class="option">--help</code> option.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tools.generate-test"></a>Automated test generation</h3></div></div></div><p>The <span><strong class="command">generate_test.rb</strong></span> tool can be used to automatically generate tests from Verilog 2001 module declarations (see <a href="usage.tutorial.html#usage.tutorial.generate-test" title="Generate a test">the section called “Generate a test”</a>). You can try it by running the command <span><strong class="command">generate_test.rb <code class="option">--help</code></strong></span>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tools.verilog-ruby-conv"></a>Verilog to Ruby conversion</h3></div></div></div><p>The <span><strong class="command">header_to_ruby.rb</strong></span> tool can be used to convert Verilog header files into Ruby. You can try it by running the command <span><strong class="command">header_to_ruby.rb <code class="option">--help</code></strong></span>.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.installation.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"><a accesskey="u" href="usage.html"><img src="images/up.png" alt="Up" /></a></td><td width="40%" align="right"> <a accesskey="n" href="usage.examples.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Installation and maintenance </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Examples</td></tr></table></div></body></html>
3
+ <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Tools</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="usage.html" title="Chapter 4. Usage" /><link rel="prev" href="usage.html" title="Chapter 4. Usage" /><link rel="next" href="usage.tutorial.html" title="Tutorial" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Tools</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usage.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center">Chapter 4. Usage</th><td width="20%" align="right"> <a accesskey="n" href="usage.tutorial.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="usage.tools"></a>Tools</h2></div></div></div><p>The <code class="filename">bin</code> directory contains various utilities which ease the process of writing tests. Each tool provides help and usage information invoked with the <code class="option">--help</code> option.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tools.generate-test"></a>Automated test generation</h3></div></div></div><p>The automated test generator (<span><strong class="command">generate_test.rb</strong></span>) generates tests from Verilog 2001 module declarations, as demonstrated in <a href="usage.tutorial.html#usage.tutorial.generate-test" title="Generate a test">the section called “Generate a test”</a>. A generated test is composed of the following parts:
4
+ </p><div class="variablelist"><dl><dt><span class="term">Runner</span></dt><dd><p>Written in Rake, this file builds and runs the test.</p></dd><dt><span class="term">Bench</span></dt><dd><p>Written in Verilog and Ruby, these files define the testing environment.</p></dd><dt><span class="term">Design</span></dt><dd><p>Written in Ruby, this file provides an interface to the design being verified.</p></dd><dt><span class="term">Prototype</span></dt><dd><p>Written in Ruby, this file defines a prototype of the design being verified.</p></dd><dt><span class="term">Specification</span></dt><dd><p>Written in Ruby, this file verifies the design.</p></dd></dl></div><p>
5
+ </p><p>The reason for dividing a single test into these parts is mainly to decouple the design from the specification. This allows you to focus on writing the specification while the remainder is automatically generated by the tool. For example, when the interface of a Verilog module changes, you would simply re-run this tool and incorporate those changes (using a <a href="setup.reqs.html#setup.reqs.optional" title="Recommendations">text merging tool</a>) into the test without diverting your focus from the specification.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: Using kdiff3 with the automated test generator"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png" /></td><th align="left">Using <span class="application">kdiff3</span> with the automated test generator</th></tr><tr><td align="left" valign="top"><p>Create a file named <code class="filename">merge2</code> with the content below, make it executable, and put it somewhere accessible by your <code class="varname">PATH</code> environment variable. Next, update the <code class="varname">MERGER</code> environment variable by executing <span><strong class="command">export <code class="varname">MERGER</code>=<em class="replaceable"><code>merge2</code></em></strong></span>.</p><pre class="programlisting">
6
+ #!/bin/sh
7
+ # args: old file, new file
8
+ kdiff3 --auto --merge --output "$2" "$@" 2&gt;/dev/null
9
+ </pre><p>From now on, <span class="application">kdiff3</span> will be invoked to help you transfer your changes between generated files. When you are finished transferring changes, simply issue the "save the file" command and terminate <span class="application">kdiff3</span>. Or, if you do not want to transfer any changes, simply terminate <span class="application">kdiff3</span>.</p></td></tr></table></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tools.verilog-ruby-conv"></a>Verilog to Ruby conversion</h3></div></div></div><p>The <span><strong class="command">header_to_ruby.rb</strong></span> tool can be used to convert Verilog header files into Ruby. You can try it by running the command <span><strong class="command">header_to_ruby.rb <code class="option">--help</code></strong></span>.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"><a accesskey="u" href="usage.html"><img src="images/up.png" alt="Up" /></a></td><td width="40%" align="right"> <a accesskey="n" href="usage.tutorial.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Usage </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Tutorial</td></tr></table></div></body></html>
@@ -1,17 +1,15 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Tutorial</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="usage.html" title="Chapter 3. Usage" /><link rel="prev" href="usage.examples.html" title="Examples" /><link rel="next" href="problems.html" title="Chapter 4. Known problems" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Tutorial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usage.examples.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center">Chapter 3. Usage</th><td width="20%" align="right"> <a accesskey="n" href="problems.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="usage.tutorial"></a>Tutorial</h2></div></div></div><div class="procedure"><a id="id2528462"></a><p class="title"><b>Procedure 3.2. Typical way of using <span class="application">Ruby-VPI</span></b></p><ol type="1"><li><p><a href="usage.tutorial.html#usage.tutorial.declare-design" title="Start with a design">Declare the design</a>, which is a Verilog module, using Verilog 2001 syntax.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.generate-test" title="Generate a test">Generate a test</a> for the design using the <a href="usage.tools.html#usage.tools.generate-test" title="Automated test generation">automated test generator</a> tool.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.specification" title="Specify your expectations">Identify your expectations</a> for the design and implement them in the specification.</p></li><li><p>(Optional) <a href="usage.tutorial.html#usage.tutorial.implement-proto" title="Implement the prototype">Implement the prototype</a> of the design in Ruby.</p></li><li><p>(Optional) <a href="usage.tutorial.html#usage.tutorial.test-proto" title="Verify the prototype">Verify the prototype</a> against the specification.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.implement-design" title="Implement the design">Implement the design</a> in Verilog once the prototype has been verified.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.test-design" title="Verify the design">Verify the design</a> against the specification.</p></li></ol></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.declare-design"></a>Start with a design</h3></div></div></div><p>First, we need a <a href="glossary.html#term..design">Design</a> to verify. In this tutorial, <a href="usage.tutorial.html#fig..counter.v_decl" title="Figure 3.1. Declaration of a simple up-counter with synchronous reset">Figure 3.1, “Declaration of a simple up-counter with synchronous reset”</a> will serve as our design. Its interface is composed of the following parts:
3
+ <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Tutorial</title><link rel="stylesheet" href="styles/manual.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.68.1" /><link rel="start" href="index.html" title="Ruby-VPI user manual" /><link rel="up" href="usage.html" title="Chapter 4. Usage" /><link rel="prev" href="usage.tools.html" title="Tools" /><link rel="next" href="usage.examples.html" title="Examples" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Tutorial</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="usage.tools.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center">Chapter 4. Usage</th><td width="20%" align="right"> <a accesskey="n" href="usage.examples.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="usage.tutorial"></a>Tutorial</h2></div></div></div><div class="procedure"><a id="id2528673"></a><p class="title"><b>Procedure 4.1. Typical way of using <span class="application">Ruby-VPI</span></b></p><ol type="1"><li><p><a href="usage.tutorial.html#usage.tutorial.declare-design" title="Start with a design">Declare the design</a>, which is a Verilog module, using Verilog 2001 syntax.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.generate-test" title="Generate a test">Generate a test</a> for the design using the <a href="usage.tools.html#usage.tools.generate-test" title="Automated test generation">automated test generator</a> tool.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.specification" title="Specify your expectations">Identify your expectations</a> for the design and implement them in the specification.</p></li><li><p>(Optional) <a href="usage.tutorial.html#usage.tutorial.implement-proto" title="Implement the prototype">Implement the prototype</a> of the design in Ruby.</p></li><li><p>(Optional) <a href="usage.tutorial.html#usage.tutorial.test-proto" title="Verify the prototype">Verify the prototype</a> against the specification.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.implement-design" title="Implement the design">Implement the design</a> in Verilog once the prototype has been verified.</p></li><li><p><a href="usage.tutorial.html#usage.tutorial.test-design" title="Verify the design">Verify the design</a> against the specification.</p></li></ol></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.declare-design"></a>Start with a design</h3></div></div></div><p>First, we need a <a href="glossary.html#term..design">Design</a> to verify. In this tutorial, <a href="usage.tutorial.html#fig..counter.v_decl" title="Figure 4.1. Declaration of a simple up-counter with synchronous reset">Figure 4.1, “Declaration of a simple up-counter with synchronous reset”</a> will serve as our design. Its interface is composed of the following parts:
4
4
  </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">Size</code></span></dt><dd><p>This parameter defines the number of bits used to represent the counter's value.</p></dd><dt><span class="term"><code class="varname">clock</code></span></dt><dd><p>Each positive edge of this signal causes the <code class="varname">count</code> register to increment.</p></dd><dt><span class="term"><code class="varname">reset</code></span></dt><dd><p>Assertion of this signal causes the <code class="varname">count</code> register to become zero.</p></dd><dt><span class="term"><code class="varname">count</code></span></dt><dd><p>This register contains the counter's value.</p></dd></dl></div><p>
5
- </p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><p>Save the source code shown in <a href="usage.tutorial.html#fig..counter.v_decl" title="Figure 3.1. Declaration of a simple up-counter with synchronous reset">Figure 3.1, “Declaration of a simple up-counter with synchronous reset”</a> into a file named <code class="filename">counter.v</code>.</p></td></tr></table></div><div class="figure"><a id="fig..counter.v_decl"></a><p class="title"><b>Figure 3.1. Declaration of a simple up-counter with synchronous reset</b></p><pre class="programlisting">
5
+ </p><div class="figure"><a id="fig..counter.v_decl"></a><p class="title"><b>Figure 4.1. Declaration of a simple up-counter with synchronous reset</b></p><pre class="programlisting">
6
6
  <span class="token">module</span> counter #(<span class="token">parameter</span> <code class="constant">Size</code> = <code class="literal">5</code>) (
7
7
  <span class="token">input</span> <code class="varname">clock</code>,
8
8
  <span class="token">input</span> <code class="varname">reset</code>,
9
9
  <span class="token">output</span> <span class="type">reg</span> [<code class="constant">Size</code> - <code class="literal">1</code> : <code class="literal">0</code>] <code class="varname">count</code>
10
10
  );
11
11
  <span class="token">endmodule</span>
12
- </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.generate-test"></a>Generate a test</h3></div></div></div><p>Now that we have a <a href="glossary.html#term..design">Design</a> to verify, let us generate a <a href="glossary.html#term..test">Test</a> for it using the automated test generator tool. This tool allows us to implement our <a href="glossary.html#term..specification">Specification</a> in either rSpec, xUnit, or our very own format. Each format represents a different software development methodology: rSpec represents <a href="glossary.html#term..BDD"><span class="acronym">BDD</span></a>, xUnit represents <a href="glossary.html#term..TDD">TDD</a>, and our own format can represent another methodology.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png" /></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>In this tutorial, you will see how specifications are implemented in <span class="emphasis"><em>both</em></span> rSpec and xUnit formats.</p></td></tr></table></div><p>Once we have decided how we want to implement our specification, we can proceed to generate a test for our design. <a href="usage.tutorial.html#fig..generate-test.rspec" title="Figure 3.2. Generating a test with specification in rSpec format">Figure 3.2, “Generating a test with specification in rSpec format”</a> and <a href="usage.tutorial.html#fig..generate-test.unit-test" title="Figure 3.3. Generating a test with specification in xUnit format">Figure 3.3, “Generating a test with specification in xUnit format”</a> illustrate this process. Here, the test generation tool produces a test composed of the following parts:
13
- </p><div class="variablelist"><dl><dt><span class="term">Runner</span></dt><dd><p>Written in Rake, this file builds and runs the test.</p></dd><dt><span class="term">Bench</span></dt><dd><p>Written in Verilog and Ruby, these files define the testing environment.</p></dd><dt><span class="term">Design</span></dt><dd><p>Written in Ruby, this file provides an interface to the design being verified.</p></dd><dt><span class="term">Prototype</span></dt><dd><p>Written in Ruby, this file defines a prototype of the design being verified.</p></dd><dt><span class="term">Specification</span></dt><dd><p>Written in Ruby, this file verifies the design.</p></dd></dl></div><p>
14
- </p><p>The reason for dividing a single test into these parts is mainly to decouple the design from the specification. This allows you to focus on writing the specification while the remainder is automatically generated by the tool. For example, when the interface of a Verilog module changes, you would simply re-run this tool and <a href="usage.recommendations.html" title="Recommendations">incorporate those changes</a> into the test without diverting your focus from the specification.</p><div class="figure"><a id="fig..generate-test.rspec"></a><p class="title"><b>Figure 3.2. Generating a test with specification in rSpec format</b></p><pre class="screen">
12
+ </pre></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><p>Save the source code shown in <a href="usage.tutorial.html#fig..counter.v_decl" title="Figure 4.1. Declaration of a simple up-counter with synchronous reset">Figure 4.1, “Declaration of a simple up-counter with synchronous reset”</a> into a file named <code class="filename">counter.v</code>.</p></td></tr></table></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.generate-test"></a>Generate a test</h3></div></div></div><p>Now that we have a <a href="glossary.html#term..design">Design</a> to verify, let us generate a <a href="glossary.html#term..test">Test</a> for it using the <a href="usage.tools.html#usage.tools.generate-test" title="Automated test generation">automated test generator</a>. This tool allows us to implement our <a href="glossary.html#term..specification">Specification</a> in either rSpec, xUnit, or our very own format. Each format represents a different software development methodology: rSpec represents <a href="glossary.html#term..BDD"><span class="acronym">BDD</span></a>, xUnit represents <a href="glossary.html#term..TDD">TDD</a>, and our own format can represent another methodology. Both rSpec and xUnit are presented in this tutorial.</p><p>Once we have decided how we want to implement our specification, we can proceed to generate a test for our design. <a href="usage.tutorial.html#fig..generate-test.rspec" title="Figure 4.2. Generating a test with specification in rSpec format">Figure 4.2, “Generating a test with specification in rSpec format”</a> and <a href="usage.tutorial.html#fig..generate-test.unit-test" title="Figure 4.3. Generating a test with specification in xUnit format">Figure 4.3, “Generating a test with specification in xUnit format”</a> illustrate this process.</p><div class="figure"><a id="fig..generate-test.rspec"></a><p class="title"><b>Figure 4.2. Generating a test with specification in rSpec format</b></p><pre class="screen">
15
13
  <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">generate_test.rb <em class="replaceable"><code>counter.v</code></em> <code class="option">--rspec</code> <code class="option">--name</code> <em class="replaceable"><code>rspec</code></em></strong></span></code></strong>
16
14
  <code class="computeroutput">
17
15
  name rspec
@@ -25,7 +23,7 @@
25
23
  create counter_rspec_proto.rb
26
24
  create counter_rspec_spec.rb
27
25
  </code>
28
- </pre></div><div class="figure"><a id="fig..generate-test.unit-test"></a><p class="title"><b>Figure 3.3. Generating a test with specification in xUnit format</b></p><pre class="screen">
26
+ </pre></div><div class="figure"><a id="fig..generate-test.unit-test"></a><p class="title"><b>Figure 4.3. Generating a test with specification in xUnit format</b></p><pre class="screen">
29
27
  <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">generate_test.rb <em class="replaceable"><code>counter.v</code></em> <code class="option">--xunit</code> <code class="option">--name</code> <em class="replaceable"><code>xunit</code></em></strong></span></code></strong>
30
28
  <code class="computeroutput">
31
29
  name xunit
@@ -41,33 +39,25 @@
41
39
  </code>
42
40
  </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.specification"></a>Specify your expectations</h3></div></div></div><p>So far, the test generation tool has created a basic foundation for our <a href="glossary.html#term..test">Test</a>. Now we must build upon this foundation by identifying our <a href="glossary.html#term..expectation">Expectation</a>s of the <a href="glossary.html#term..design">Design</a>. That is, how do we expect the design to <span class="emphasis"><em>behave</em></span> under certain conditions?</p><p>The following is a reasonable set of expectations for our simple counter:
43
41
  </p><div class="itemizedlist"><ul type="disc"><li><p>A resetted counter's value should be zero.</p></li><li><p>A resetted counter's value should increment by one count upon each rising clock edge.</p></li><li><p>A counter with the maximum value should overflow upon increment.</p></li></ul></div><p>
44
- </p><p>Now that we have identified a set of expectations for our design, we are ready to implement them in our specification. <a href="usage.tutorial.html#fig..counter_rspec_spec.rb" title="Figure 3.4. Specification implemented in rSpec format">Figure 3.4, “Specification implemented in rSpec format”</a> and <a href="usage.tutorial.html#fig..counter_xunit_spec.rb" title="Figure 3.5. Specification implemented in xUnit format">Figure 3.5, “Specification implemented in xUnit format”</a> illustrate this process. Note the striking similarities between our expectations and their implementation.</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><div class="itemizedlist"><ul type="disc"><li><p>Append the following code to the files named <code class="filename">counter_rspec_design.rb</code> and <code class="filename">counter_xunit_design.rb</code>.</p><pre class="programlisting">
45
- <span class="token">class</span> <code class="constant">Counter</code>
46
- <span class="token">def</span> <code class="function">reset!</code>
47
- <code class="varname">@reset</code>.<code class="function">intVal</code> = <code class="literal">1</code>
48
- <code class="function">relay_verilog</code> <em><span class="remark"># advance the clock</span></em>
49
- <code class="varname">@reset</code>.<code class="function">intVal</code> = <code class="literal">0</code>
50
- <span class="token">end</span>
51
- <span class="token">end</span>
52
- </pre></li><li><p>Replace the contents of the file named <code class="filename">counter_rspec_spec.rb</code> with the source code shown in <a href="usage.tutorial.html#fig..counter_rspec_spec.rb" title="Figure 3.4. Specification implemented in rSpec format">Figure 3.4, “Specification implemented in rSpec format”</a>.</p></li><li><p>Replace the contents of the file named <code class="filename">counter_xunit_spec.rb</code> with the source code shown in <a href="usage.tutorial.html#fig..counter_xunit_spec.rb" title="Figure 3.5. Specification implemented in xUnit format">Figure 3.5, “Specification implemented in xUnit format”</a>.</p></li></ul></div></td></tr></table></div><div class="figure"><a id="fig..counter_rspec_spec.rb"></a><p class="title"><b>Figure 3.4. Specification implemented in rSpec format</b></p><pre class="programlisting">
53
- <code class="constant">LIMIT</code> = <code class="literal">2</code> ** <code class="constant">Counter</code>::<code class="constant">Size</code> <em><span class="remark"># lowest upper bound of counter's value</span></em>
54
- <code class="constant">MAX</code> = <code class="constant">LIMIT</code> - <code class="literal">1</code> <em><span class="remark"># maximum allowed value for a counter</span></em>
42
+ </p><p>Now that we have identified a set of expectations for our design, we are ready to implement them in our specification. <a href="usage.tutorial.html#fig..counter_rspec_spec.rb" title="Figure 4.4. Specification implemented in rSpec format">Figure 4.4, “Specification implemented in rSpec format”</a> and <a href="usage.tutorial.html#fig..counter_xunit_spec.rb" title="Figure 4.5. Specification implemented in xUnit format">Figure 4.5, “Specification implemented in xUnit format”</a> illustrate this process. Note the striking similarities between our expectations and their implementation.</p><div class="figure"><a id="fig..counter_rspec_spec.rb"></a><p class="title"><b>Figure 4.4. Specification implemented in rSpec format</b></p><pre class="programlisting">
43
+ <em><span class="remark"># lowest upper bound of counter's value</span></em>
44
+ <code class="constant">LIMIT</code> = <code class="literal">2</code> ** <code class="constant">Counter</code>.<code class="function">Size</code>.<code class="function">intVal</code>
55
45
 
56
- <span class="token">include</span> <code class="constant">Vpi</code>
46
+ <em><span class="remark"># maximum allowed value for a counter</span></em>
47
+ <code class="constant">MAX</code> = <code class="constant">LIMIT</code> - <code class="literal">1</code>
57
48
 
58
49
  <code class="function">context</code> <code class="literal">"A resetted counter's value"</code> <span class="token">do</span>
59
50
  <code class="function">setup</code> <span class="token">do</span>
60
- <code class="varname">@design</code> = <code class="constant">Counter</code>.<code class="function">new</code>
61
- <code class="varname">@design</code>.<code class="function">reset!</code>
51
+ <code class="constant">Counter</code>.<code class="function">reset!</code>
62
52
  <span class="token">end</span>
63
53
 
64
54
  <code class="function">specify</code> <code class="literal">"should be zero"</code> <span class="token">do</span>
65
- <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="literal">0</code>
55
+ <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="literal">0</code>
66
56
  <span class="token">end</span>
67
57
 
68
58
  <code class="function">specify</code> <code class="literal">"should increment by one count upon each rising clock edge"</code> <span class="token">do</span>
69
59
  <code class="constant">LIMIT</code>.<code class="function">times</code> <span class="token">do</span> |<code class="varname">i</code>|
70
- <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="varname">i</code>
60
+ <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="varname">i</code>
71
61
  <code class="function">relay_verilog</code> <em><span class="remark"># advance the clock</span></em>
72
62
  <span class="token">end</span>
73
63
  <span class="token">end</span>
@@ -75,72 +65,76 @@
75
65
 
76
66
  <code class="function">context</code> <code class="literal">"A counter with the maximum value"</code> <span class="token">do</span>
77
67
  <code class="function">setup</code> <span class="token">do</span>
78
- <code class="varname">@design</code> = <code class="constant">Counter</code>.<code class="function">new</code>
79
- <code class="varname">@design</code>.<code class="function">reset!</code>
68
+ <code class="constant">Counter</code>.<code class="function">reset!</code>
80
69
 
81
70
  <em><span class="remark"># increment the counter to maximum value</span></em>
82
71
  <code class="constant">MAX</code>.<code class="function">times</code> <span class="token">do</span> <code class="function">relay_verilog</code> <span class="token">end</span>
83
- <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="constant">MAX</code>
72
+ <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="constant">MAX</code>
84
73
  <span class="token">end</span>
85
74
 
86
75
  <code class="function">specify</code> <code class="literal">"should overflow upon increment"</code> <span class="token">do</span>
87
76
  <code class="function">relay_verilog</code> <em><span class="remark"># increment the counter</span></em>
88
- <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="literal">0</code>
77
+ <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>.<code class="function">should_equal</code> <code class="literal">0</code>
89
78
  <span class="token">end</span>
90
79
  <span class="token">end</span>
91
- </pre></div><div class="figure"><a id="fig..counter_xunit_spec.rb"></a><p class="title"><b>Figure 3.5. Specification implemented in xUnit format</b></p><pre class="programlisting">
92
- <code class="constant">LIMIT</code> = <code class="literal">2</code> ** <code class="constant">Counter</code>::<code class="constant">Size</code> <em><span class="remark"># lowest upper bound of counter's value</span></em>
93
- <code class="constant">MAX</code> = <code class="constant">LIMIT</code> - <code class="literal">1</code> <em><span class="remark"># maximum allowed value for a counter</span></em>
80
+ </pre></div><div class="figure"><a id="fig..counter_xunit_spec.rb"></a><p class="title"><b>Figure 4.5. Specification implemented in xUnit format</b></p><pre class="programlisting">
81
+ <em><span class="remark"># lowest upper bound of counter's value</span></em>
82
+ <code class="constant">LIMIT</code> = <code class="literal">2</code> ** <code class="constant">Counter</code>.<code class="function">Size</code>.<code class="function">intVal</code>
94
83
 
95
- <span class="token">class</span> <code class="constant">ResettedCounterValue</code> &lt; <code class="constant">Test</code>::<code class="constant">Unit</code>::<code class="constant">TestCase</code>
96
- <span class="token">include</span> <code class="constant">Vpi</code>
84
+ <em><span class="remark"># maximum allowed value for a counter</span></em>
85
+ <code class="constant">MAX</code> = <code class="constant">LIMIT</code> - <code class="literal">1</code>
97
86
 
87
+ <span class="token">class</span> <code class="constant">ResettedCounterValue</code> &lt; <code class="constant">Test</code>::<code class="constant">Unit</code>::<code class="constant">TestCase</code>
98
88
  <span class="token">def</span> <code class="function">setup</code>
99
- <code class="varname">@design</code> = <code class="constant">Counter</code>.<code class="function">new</code>
100
- <code class="varname">@design</code>.<code class="function">reset!</code>
89
+ <code class="constant">Counter</code>.<code class="function">reset!</code>
101
90
  <span class="token">end</span>
102
91
 
103
92
  <span class="token">def</span> <code class="function">test_zero</code>
104
- <code class="function">assert_equal</code> <code class="literal">0</code>, <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>
93
+ <code class="function">assert_equal</code> <code class="literal">0</code>, <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>
105
94
  <span class="token">end</span>
106
95
 
107
96
  <span class="token">def</span> <code class="function">test_increment</code>
108
97
  <code class="constant">LIMIT</code>.<code class="function">times</code> <span class="token">do</span> |<code class="varname">i</code>|
109
- <code class="function">assert_equal</code> <code class="varname">i</code>, <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>
98
+ <code class="function">assert_equal</code> <code class="varname">i</code>, <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>
110
99
  <code class="function">relay_verilog</code> <em><span class="remark"># advance the clock</span></em>
111
100
  <span class="token">end</span>
112
101
  <span class="token">end</span>
113
102
  <span class="token">end</span>
114
103
 
115
104
  <span class="token">class</span> <code class="constant">MaximumCounterValue</code> &lt; <code class="constant">Test</code>::<code class="constant">Unit</code>::<code class="constant">TestCase</code>
116
- <span class="token">include</span> <code class="constant">Vpi</code>
117
-
118
105
  <span class="token">def</span> <code class="function">setup</code>
119
- <code class="varname">@design</code> = <code class="constant">Counter</code>.<code class="function">new</code>
120
- <code class="varname">@design</code>.<code class="function">reset!</code>
106
+ <code class="constant">Counter</code>.<code class="function">reset!</code>
121
107
 
122
108
  <em><span class="remark"># increment the counter to maximum value</span></em>
123
109
  <code class="constant">MAX</code>.<code class="function">times</code> <span class="token">do</span> <code class="function">relay_verilog</code> <span class="token">end</span>
124
- <code class="function">assert_equal</code> <code class="constant">MAX</code>, <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>
110
+ <code class="function">assert_equal</code> <code class="constant">MAX</code>, <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>
125
111
  <span class="token">end</span>
126
112
 
127
113
  <span class="token">def</span> <code class="function">test_overflow</code>
128
114
  <code class="function">relay_verilog</code> <em><span class="remark"># increment the counter</span></em>
129
- <code class="function">assert_equal</code> <code class="literal">0</code>, <code class="varname">@design</code>.<code class="function">count</code>.<code class="function">intVal</code>
115
+ <code class="function">assert_equal</code> <code class="literal">0</code>, <code class="constant">Counter</code>.<code class="function">count</code>.<code class="function">intVal</code>
116
+ <span class="token">end</span>
117
+ <span class="token">end</span>
118
+ </pre></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><div class="itemizedlist"><ul type="disc"><li><p>Replace the contents of the file named <code class="filename">counter_rspec_spec.rb</code> with the source code shown in <a href="usage.tutorial.html#fig..counter_rspec_spec.rb" title="Figure 4.4. Specification implemented in rSpec format">Figure 4.4, “Specification implemented in rSpec format”</a>.</p></li><li><p>Replace the contents of the file named <code class="filename">counter_xunit_spec.rb</code> with the source code shown in <a href="usage.tutorial.html#fig..counter_xunit_spec.rb" title="Figure 4.5. Specification implemented in xUnit format">Figure 4.5, “Specification implemented in xUnit format”</a>.</p></li><li><p>Replace the contents of the files named <code class="filename">counter_rspec_design.rb</code> and <code class="filename">counter_xunit_design.rb</code> with the following code. This code defines the <code class="function">reset!</code> method which resets our Verilog design.</p><pre class="programlisting">
119
+ <span class="token">class</span> &lt;&lt; <code class="constant">Counter</code>
120
+ <span class="token">def</span> <code class="function">reset!</code>
121
+ <code class="function">reset</code>.<code class="function">intVal</code> = <code class="literal">1</code>
122
+ <code class="function">relay_verilog</code> <em><span class="remark"># advance the clock</span></em>
123
+ <code class="function">reset</code>.<code class="function">intVal</code> = <code class="literal">0</code>
130
124
  <span class="token">end</span>
131
125
  <span class="token">end</span>
132
- </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.implement-proto"></a>Implement the prototype</h3></div></div></div><p>Now that we have a <a href="glossary.html#term..specification">Specification</a> against which to verify our <a href="glossary.html#term..design">Design</a>, let us build a prototype of our design. By doing so, we exercise our specification, experience potential problems that may arise when we later implement our design in Verilog, and gain confidence in our work. <a href="usage.tutorial.html#fig..counter_proto.rb" title="Figure 3.6. Ruby prototype of our Verilog design">Figure 3.6, “Ruby prototype of our Verilog design”</a> shows the completed prototype for our design.</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><p>Replace the contents of the files named <code class="filename">counter_rspec_proto.rb</code> and <code class="filename">counter_xunit_proto.rb</code> with the source code shown in <a href="usage.tutorial.html#fig..counter_proto.rb" title="Figure 3.6. Ruby prototype of our Verilog design">Figure 3.6, “Ruby prototype of our Verilog design”</a>.</p></td></tr></table></div><div class="figure"><a id="fig..counter_proto.rb"></a><p class="title"><b>Figure 3.6. Ruby prototype of our Verilog design</b></p><pre class="programlisting">
133
- <span class="token">class</span> <code class="constant">CounterPrototype</code> &lt; <code class="constant">Counter</code>
126
+ </pre></li></ul></div></td></tr></table></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.implement-proto"></a>Implement the prototype</h3></div></div></div><p>Now that we have a <a href="glossary.html#term..specification">Specification</a> against which to verify our <a href="glossary.html#term..design">Design</a>, let us build a prototype of our design. By doing so, we exercise our specification, experience potential problems that may arise when we later implement our design in Verilog, and gain confidence in our work. <a href="usage.tutorial.html#fig..counter_proto.rb" title="Figure 4.6. Ruby prototype of our Verilog design">Figure 4.6, “Ruby prototype of our Verilog design”</a> shows the completed prototype for our design.</p><div class="figure"><a id="fig..counter_proto.rb"></a><p class="title"><b>Figure 4.6. Ruby prototype of our Verilog design</b></p><pre class="programlisting">
127
+ <span class="token">class</span> &lt;&lt; <code class="constant">Counter</code>
134
128
  <span class="token">def</span> <code class="function">simulate!</code>
135
- <span class="token">if</span> <code class="varname">@reset</code>.<code class="function">intVal</code> == <code class="literal">1</code>
136
- <code class="varname">@count</code>.<code class="function">intVal</code> = <code class="literal">0</code>
129
+ <span class="token">if</span> <code class="function">reset</code>.<code class="function">intVal</code> == <code class="literal">1</code>
130
+ <code class="function">count</code>.<code class="function">intVal</code> = <code class="literal">0</code>
137
131
  <span class="token">else</span>
138
- <code class="varname">@count</code>.<code class="function">intVal</code> += <code class="literal">1</code>
132
+ <code class="function">count</code>.<code class="function">intVal</code> += <code class="literal">1</code>
139
133
  <span class="token">end</span>
140
134
  <span class="token">end</span>
141
135
  <span class="token">end</span>
142
- </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.test-proto"></a>Verify the prototype</h3></div></div></div><p>Now that we have implemented our prototype, we are ready to verify it against our <a href="glossary.html#term..specification">Specification</a> by running the <a href="glossary.html#term..test">Test</a>. <a href="usage.tutorial.html#fig..test-proto.rspec" title="Figure 3.7. Running a test with specification in rSpec format">Figure 3.7, “Running a test with specification in rSpec format”</a> and <a href="usage.tutorial.html#fig..test-proto.unit-test" title="Figure 3.8. Running a test with specification in xUnit format">Figure 3.8, “Running a test with specification in xUnit format”</a> illustrate this process.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png" /></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <span class="emphasis"><em>same</em></span> specification can be used to verify both prototype and design.</p></td></tr></table></div><p>Here, the <code class="varname">PROTOTYPE</code> environment variable is assigned a non-empty value while running the test, so that, instead of our design, our prototype is verified against our specification. You can also assign a value to <code class="varname">PROTOTYPE</code> before running the test, by using your shell's <span><strong class="command">export</strong></span> or <span><strong class="command">setenv</strong></span> command. Finally, the Icarus Verilog simulator, denoted by <em class="replaceable"><code>ivl</code></em>, is used to run the simulation.</p><div class="figure"><a id="fig..test-proto.rspec"></a><p class="title"><b>Figure 3.7. Running a test with specification in rSpec format</b></p><pre class="screen">
143
- <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_rspec_runner.rake</code></em> <em class="replaceable"><code>ivl</code></em> <code class="varname">PROTOTYPE</code>=<em class="replaceable"><code>1</code></em></strong></span></code></strong>
136
+ </pre></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><p>Replace the contents of the files named <code class="filename">counter_rspec_proto.rb</code> and <code class="filename">counter_xunit_proto.rb</code> with the source code shown in <a href="usage.tutorial.html#fig..counter_proto.rb" title="Figure 4.6. Ruby prototype of our Verilog design">Figure 4.6, “Ruby prototype of our Verilog design”</a>.</p></td></tr></table></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.test-proto"></a>Verify the prototype</h3></div></div></div><p>Now that we have implemented our prototype, we are ready to verify it against our <a href="glossary.html#term..specification">Specification</a> by running the <a href="glossary.html#term..test">Test</a>. <a href="usage.tutorial.html#fig..test-proto.rspec" title="Figure 4.7. Running a test with specification in rSpec format">Figure 4.7, “Running a test with specification in rSpec format”</a> and <a href="usage.tutorial.html#fig..test-proto.unit-test" title="Figure 4.8. Running a test with specification in xUnit format">Figure 4.8, “Running a test with specification in xUnit format”</a> illustrate this process.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: Reuse your past efforts!"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png" /></td><th align="left">Reuse your past efforts!</th></tr><tr><td align="left" valign="top"><p>The <span class="emphasis"><em>same</em></span> specification can be used to verify both prototype and design.</p></td></tr></table></div><p>Here, the <code class="varname">PROTOTYPE</code> environment variable is assigned a non-empty value while running the test, so that, instead of our design, our prototype is verified against our specification. You can also assign a value to <code class="varname">PROTOTYPE</code> before running the test, by using your shell's <span><strong class="command">export</strong></span> or <span><strong class="command">setenv</strong></span> command. Finally, the Icarus Verilog simulator, denoted by <em class="replaceable"><code>cver</code></em>, is used to run the simulation.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: What can the test runner do?"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png" /></td><th align="left">What can the test runner do?</th></tr><tr><td align="left" valign="top"><p>If you invoke the test runner (1) without any arguments or (2) with the <code class="option">-T</code> option, it will show you a list of tasks that it can perform for you.</p></td></tr></table></div><div class="figure"><a id="fig..test-proto.rspec"></a><p class="title"><b>Figure 4.7. Running a test with specification in rSpec format</b></p><pre class="screen">
137
+ <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_rspec_runner.rake</code></em> <em class="replaceable"><code>cver</code></em> <code class="varname">PROTOTYPE</code>=<em class="replaceable"><code>1</code></em></strong></span></code></strong>
144
138
  <code class="computeroutput">counter_rspec: verifying prototype instead of design
145
139
 
146
140
  A resetted counter's value
@@ -153,8 +147,8 @@ A counter with the maximum value
153
147
  Finished in 0.018199 seconds
154
148
 
155
149
  3 specifications, 0 failures</code>
156
- </pre></div><div class="figure"><a id="fig..test-proto.unit-test"></a><p class="title"><b>Figure 3.8. Running a test with specification in xUnit format</b></p><pre class="screen">
157
- <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_xunit_runner.rake</code></em> <em class="replaceable"><code>ivl</code></em> <code class="varname">PROTOTYPE</code>=<em class="replaceable"><code>1</code></em></strong></span></code></strong>
150
+ </pre></div><div class="figure"><a id="fig..test-proto.unit-test"></a><p class="title"><b>Figure 4.8. Running a test with specification in xUnit format</b></p><pre class="screen">
151
+ <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_xunit_runner.rake</code></em> <em class="replaceable"><code>cver</code></em> <code class="varname">PROTOTYPE</code>=<em class="replaceable"><code>1</code></em></strong></span></code></strong>
158
152
  <code class="computeroutput">counter_xunit: verifying prototype instead of design
159
153
 
160
154
  Loaded suite counter_xunit_bench
@@ -163,7 +157,7 @@ Started
163
157
  Finished in 0.040668 seconds.
164
158
 
165
159
  3 tests, 35 assertions, 0 failures, 0 errors</code>
166
- </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.implement-design"></a>Implement the design</h3></div></div></div><p>Now that we have implemented and verified our prototype, we are ready to implement our <a href="glossary.html#term..design">Design</a>. This is often quite simple because we translate <span class="emphasis"><em>existing</em></span> code from Ruby (our prototype) into Verilog (our design). <a href="usage.tutorial.html#fig..counter.v_impl" title="Figure 3.9. Implementation of a simple up-counter with synchronous reset">Figure 3.9, “Implementation of a simple up-counter with synchronous reset”</a> illustrates the result of this process. Once again, note the striking similarities between the implementation of our prototype and design.</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><p>Replace the contents of the file named <code class="filename">counter.v</code> with the source code shown in <a href="usage.tutorial.html#fig..counter.v_impl" title="Figure 3.9. Implementation of a simple up-counter with synchronous reset">Figure 3.9, “Implementation of a simple up-counter with synchronous reset”</a>.</p></td></tr></table></div><div class="figure"><a id="fig..counter.v_impl"></a><p class="title"><b>Figure 3.9. Implementation of a simple up-counter with synchronous reset</b></p><pre class="programlisting">
160
+ </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.implement-design"></a>Implement the design</h3></div></div></div><p>Now that we have implemented and verified our prototype, we are ready to implement our <a href="glossary.html#term..design">Design</a>. This is often quite simple because we translate <span class="emphasis"><em>existing</em></span> code from Ruby (our prototype) into Verilog (our design). <a href="usage.tutorial.html#fig..counter.v_impl" title="Figure 4.9. Implementation of a simple up-counter with synchronous reset">Figure 4.9, “Implementation of a simple up-counter with synchronous reset”</a> illustrates the result of this process. Once again, note the striking similarities between the implementation of our prototype and design.</p><div class="figure"><a id="fig..counter.v_impl"></a><p class="title"><b>Figure 4.9. Implementation of a simple up-counter with synchronous reset</b></p><pre class="programlisting">
167
161
  <span class="token">module</span> counter #(<span class="token">parameter</span> <code class="constant">Size</code> = <code class="literal">5</code>) (
168
162
  <span class="token">input</span> <code class="varname">clock</code>,
169
163
  <span class="token">input</span> <code class="varname">reset</code>,
@@ -176,8 +170,8 @@ Finished in 0.040668 seconds.
176
170
  <code class="varname">count</code> &lt;= <code class="varname">count</code> + <code class="literal">1</code>;
177
171
  <span class="token">end</span>
178
172
  <span class="token">endmodule</span>
179
- </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.test-design"></a>Verify the design</h3></div></div></div><p>Now that we have implemented our <a href="glossary.html#term..design">Design</a>, we are ready to verify it against our <a href="glossary.html#term..specification">Specification</a> by running the <a href="glossary.html#term..test">Test</a>. <a href="usage.tutorial.html#fig..test-design.rspec" title="Figure 3.10. Running a test with specification in rSpec format">Figure 3.10, “Running a test with specification in rSpec format”</a> and <a href="usage.tutorial.html#fig..test-design.unit-test" title="Figure 3.11. Running a test with specification in xUnit format">Figure 3.11, “Running a test with specification in xUnit format”</a> illustrate this process.</p><p>Here, the <code class="varname">PROTOTYPE</code> environment variable is <span class="emphasis"><em>not</em></span> specified while running the test, so that our design, instead of our prototype, is verified against our specification. You can also achieve this effect by assigning an empty value to <code class="varname">PROTOTYPE</code>, or by using your shell's <span><strong class="command">unset</strong></span> command. Finally, the Icarus Verilog simulator, denoted by <em class="replaceable"><code>ivl</code></em>, is used to run the simulation.</p><div class="figure"><a id="fig..test-design.rspec"></a><p class="title"><b>Figure 3.10. Running a test with specification in rSpec format</b></p><pre class="screen">
180
- <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_rspec_runner.rake</code></em> <em class="replaceable"><code>ivl</code></em></strong></span></code></strong>
173
+ </pre></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Before we continue…"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="images/important.png" /></td><th align="left">Before we continue…</th></tr><tr><td align="left" valign="top"><p>Replace the contents of the file named <code class="filename">counter.v</code> with the source code shown in <a href="usage.tutorial.html#fig..counter.v_impl" title="Figure 4.9. Implementation of a simple up-counter with synchronous reset">Figure 4.9, “Implementation of a simple up-counter with synchronous reset”</a>.</p></td></tr></table></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="usage.tutorial.test-design"></a>Verify the design</h3></div></div></div><p>Now that we have implemented our <a href="glossary.html#term..design">Design</a>, we are ready to verify it against our <a href="glossary.html#term..specification">Specification</a> by running the <a href="glossary.html#term..test">Test</a>. <a href="usage.tutorial.html#fig..test-design.rspec" title="Figure 4.10. Running a test with specification in rSpec format">Figure 4.10, “Running a test with specification in rSpec format”</a> and <a href="usage.tutorial.html#fig..test-design.unit-test" title="Figure 4.11. Running a test with specification in xUnit format">Figure 4.11, “Running a test with specification in xUnit format”</a> illustrate this process.</p><p>Here, the <code class="varname">PROTOTYPE</code> environment variable is <span class="emphasis"><em>not</em></span> specified while running the test, so that our design, instead of our prototype, is verified against our specification. You can also achieve this effect by assigning an empty value to <code class="varname">PROTOTYPE</code>, or by using your shell's <span><strong class="command">unset</strong></span> command. Finally, the GPL Cver Verilog simulator, denoted by <em class="replaceable"><code>cver</code></em>, is used to run the simulation.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: Running multiple tests"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png" /></td><th align="left">Running multiple tests</th></tr><tr><td align="left" valign="top"><p>Create a file named <code class="filename">Rakefile</code> containing the following line.</p><pre class="programlisting">require 'ruby-vpi/runner_proxy'</pre><p>Now you can invoke all test runners in the current directory simply by executing <span><strong class="command">rake <em class="replaceable"><code>cver</code></em></strong></span> (where <em class="replaceable"><code>cver</code></em> denotes the GPL Cver simulator).</p></td></tr></table></div><div class="figure"><a id="fig..test-design.rspec"></a><p class="title"><b>Figure 4.10. Running a test with specification in rSpec format</b></p><pre class="screen">
174
+ <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_rspec_runner.rake</code></em> <em class="replaceable"><code>cver</code></em></strong></span></code></strong>
181
175
  <code class="computeroutput">A resetted counter's value
182
176
  - should be zero
183
177
  - should increment by one count upon each rising clock edge
@@ -188,12 +182,12 @@ A counter with the maximum value
188
182
  Finished in 0.005628 seconds
189
183
 
190
184
  3 specifications, 0 failures</code>
191
- </pre></div><div class="figure"><a id="fig..test-design.unit-test"></a><p class="title"><b>Figure 3.11. Running a test with specification in xUnit format</b></p><pre class="screen">
192
- <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_xunit_runner.rake</code></em> <em class="replaceable"><code>ivl</code></em></strong></span></code></strong>
185
+ </pre></div><div class="figure"><a id="fig..test-design.unit-test"></a><p class="title"><b>Figure 4.11. Running a test with specification in xUnit format</b></p><pre class="screen">
186
+ <code class="prompt">$</code> <strong class="userinput"><code><span><strong class="command">rake <code class="option">-f</code> <em class="replaceable"><code>counter_xunit_runner.rake</code></em> <em class="replaceable"><code>cver</code></em></strong></span></code></strong>
193
187
  <code class="computeroutput">Loaded suite counter_xunit_bench
194
188
  Started
195
189
  ...
196
190
  Finished in 0.006766 seconds.
197
191
 
198
192
  3 tests, 35 assertions, 0 failures, 0 errors</code>
199
- </pre></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.examples.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"><a accesskey="u" href="usage.html"><img src="images/up.png" alt="Up" /></a></td><td width="40%" align="right"> <a accesskey="n" href="problems.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Examples </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Chapter 4. Known problems</td></tr></table></div></body></html>
193
+ </pre></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="usage.tools.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"><a accesskey="u" href="usage.html"><img src="images/up.png" alt="Up" /></a></td><td width="40%" align="right"> <a accesskey="n" href="usage.examples.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Tools </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Examples</td></tr></table></div></body></html>