ruby-vpi 15.0.2 → 16.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. data/LICENSE +23 -340
  2. data/Rakefile +169 -192
  3. data/bin/generate_test.rb +26 -25
  4. data/bin/generate_test_tpl/runner.rake +4 -10
  5. data/bin/header_to_ruby.rb +3 -20
  6. data/doc/README +11 -0
  7. data/doc/Rakefile +8 -21
  8. data/doc/common.css +44 -10
  9. data/doc/common.tpl +5 -10
  10. data/doc/history.doc +8 -7
  11. data/doc/history.html +228 -560
  12. data/doc/history.rb +7 -11
  13. data/doc/{history.yml → history.yaml} +325 -128
  14. data/doc/images/{feed-icon.png → feed-icon-28x28.png} +0 -0
  15. data/doc/images/ruby/LICENSE +15 -0
  16. data/doc/images/ruby/logo-reflection.png +0 -0
  17. data/doc/images/ruby/logo-reflection.xcf +0 -0
  18. data/doc/images/ruby/logo.png +0 -0
  19. data/doc/images/{LICENSE → tango/LICENSE} +0 -0
  20. data/doc/images/{caution.png → tango/caution.png} +0 -0
  21. data/doc/images/{caution.svg → tango/caution.svg} +0 -0
  22. data/doc/images/{home.png → tango/home.png} +0 -0
  23. data/doc/images/{home.svg → tango/home.svg} +0 -0
  24. data/doc/images/{important.png → tango/important.png} +0 -0
  25. data/doc/images/{important.svg → tango/important.svg} +0 -0
  26. data/doc/images/{next.png → tango/next.png} +0 -0
  27. data/doc/images/{next.svg → tango/next.svg} +0 -0
  28. data/doc/images/{note.png → tango/note.png} +0 -0
  29. data/doc/images/{note.svg → tango/note.svg} +0 -0
  30. data/doc/images/{prev.png → tango/prev.png} +0 -0
  31. data/doc/images/{prev.svg → tango/prev.svg} +0 -0
  32. data/doc/images/{tip.png → tango/tip.png} +0 -0
  33. data/doc/images/{tip.svg → tango/tip.svg} +0 -0
  34. data/doc/images/{up.png → tango/up.png} +0 -0
  35. data/doc/images/{up.svg → tango/up.svg} +0 -0
  36. data/doc/images/{warning.png → tango/warning.png} +0 -0
  37. data/doc/images/{warning.svg → tango/warning.svg} +0 -0
  38. data/doc/intro.inc +105 -36
  39. data/doc/lib/doc_format.rb +151 -29
  40. data/doc/lib/doc_proxy.rb +28 -69
  41. data/doc/lib/erb_content.rb +10 -22
  42. data/doc/lib/erb_proxy.rb +13 -24
  43. data/doc/manual.doc +16 -60
  44. data/doc/manual.html +257 -340
  45. data/doc/memo.doc +2 -0
  46. data/doc/memo.html +11 -11
  47. data/doc/readme.doc +36 -2
  48. data/doc/readme.html +214 -51
  49. data/doc/rss.erb +3 -3
  50. data/doc/rss.xml +217 -269
  51. data/ext/Rakefile +7 -22
  52. data/ext/common.h +10 -21
  53. data/ext/extconf.rb +5 -0
  54. data/ext/main.c +2 -18
  55. data/ext/main.h +1 -16
  56. data/ext/relay.c +3 -17
  57. data/ext/relay.h +3 -17
  58. data/ext/verilog.h +6 -18
  59. data/ext/vlog.c +3 -21
  60. data/ext/vlog.h +3 -17
  61. data/lib/ruby-vpi/erb.rb +7 -20
  62. data/lib/ruby-vpi/float.rb +6 -20
  63. data/lib/ruby-vpi/integer.rb +27 -47
  64. data/lib/ruby-vpi/rake.rb +4 -19
  65. data/lib/ruby-vpi/rcov.rb +6 -21
  66. data/lib/ruby-vpi/rdoc.rb +3 -21
  67. data/lib/ruby-vpi/runner.rb +28 -29
  68. data/lib/ruby-vpi/runner_proxy.rb +5 -21
  69. data/lib/ruby-vpi/verilog_parser.rb +5 -20
  70. data/lib/ruby-vpi/vpi.rb +420 -376
  71. data/lib/ruby-vpi.rb +26 -32
  72. data/ref/c/annotated.html +1 -1
  73. data/ref/c/common_8h.html +1 -1
  74. data/ref/c/files.html +1 -1
  75. data/ref/c/functions.html +1 -1
  76. data/ref/c/functions_vars.html +1 -1
  77. data/ref/c/globals.html +1 -1
  78. data/ref/c/globals_0x63.html +1 -1
  79. data/ref/c/globals_0x65.html +1 -1
  80. data/ref/c/globals_0x66.html +1 -1
  81. data/ref/c/globals_0x6d.html +1 -1
  82. data/ref/c/globals_0x70.html +1 -1
  83. data/ref/c/globals_0x72.html +1 -1
  84. data/ref/c/globals_0x73.html +1 -1
  85. data/ref/c/globals_0x74.html +1 -1
  86. data/ref/c/globals_0x76.html +1 -1
  87. data/ref/c/globals_0x78.html +1 -1
  88. data/ref/c/globals_defs.html +1 -1
  89. data/ref/c/globals_defs_0x65.html +1 -1
  90. data/ref/c/globals_defs_0x70.html +1 -1
  91. data/ref/c/globals_defs_0x76.html +1 -1
  92. data/ref/c/globals_defs_0x78.html +1 -1
  93. data/ref/c/globals_enum.html +1 -1
  94. data/ref/c/globals_eval.html +1 -1
  95. data/ref/c/globals_func.html +1 -1
  96. data/ref/c/globals_type.html +1 -1
  97. data/ref/c/globals_vars.html +1 -1
  98. data/ref/c/index.html +1 -1
  99. data/ref/c/main_8c.html +1 -1
  100. data/ref/c/main_8h.html +1 -1
  101. data/ref/c/relay_8c.html +1 -1
  102. data/ref/c/relay_8h.html +1 -1
  103. data/ref/c/structt__cb__data.html +1 -1
  104. data/ref/c/structt__vpi__delay.html +1 -1
  105. data/ref/c/structt__vpi__error__info.html +1 -1
  106. data/ref/c/structt__vpi__strengthval.html +1 -1
  107. data/ref/c/structt__vpi__systf__data.html +1 -1
  108. data/ref/c/structt__vpi__time.html +1 -1
  109. data/ref/c/structt__vpi__value.html +1 -1
  110. data/ref/c/structt__vpi__vecval.html +1 -1
  111. data/ref/c/structt__vpi__vlog__info.html +1 -1
  112. data/ref/c/verilog_8h.html +1 -1
  113. data/ref/c/vlog_8c.html +1 -1
  114. data/ref/c/vlog_8h.html +1 -1
  115. data/ref/c/vpi__user_8h.html +1 -1
  116. data/ref/ruby/classes/ERB.html +5 -5
  117. data/ref/ruby/classes/ERB.src/{M000026.html → M000024.html} +15 -15
  118. data/ref/ruby/classes/FileUtils.html +10 -10
  119. data/ref/ruby/classes/FileUtils.src/{M000027.html → M000025.html} +4 -4
  120. data/ref/ruby/classes/FileUtils.src/{M000028.html → M000026.html} +4 -4
  121. data/ref/ruby/classes/Float.html +5 -5
  122. data/ref/ruby/classes/Float.src/{M000022.html → M000020.html} +5 -5
  123. data/ref/ruby/classes/Integer.html +20 -56
  124. data/ref/ruby/classes/Integer.src/M000008.html +11 -11
  125. data/ref/ruby/classes/Integer.src/M000009.html +4 -4
  126. data/ref/ruby/classes/Integer.src/M000010.html +4 -4
  127. data/ref/ruby/classes/Integer.src/M000011.html +4 -4
  128. data/ref/ruby/classes/Integer.src/M000012.html +4 -4
  129. data/ref/ruby/classes/Integer.src/M000013.html +4 -4
  130. data/ref/ruby/classes/Integer.src/M000016.html +12 -9
  131. data/ref/ruby/classes/Integer.src/M000017.html +18 -9
  132. data/ref/ruby/classes/Integer.src/M000018.html +12 -12
  133. data/ref/ruby/classes/Integer.src/M000019.html +17 -18
  134. data/ref/ruby/classes/RDoc.src/M000053.html +25 -25
  135. data/ref/ruby/classes/RubyVpi/Config.html +3 -3
  136. data/ref/ruby/classes/RubyVpi.html +11 -5
  137. data/ref/ruby/classes/RubyVpi.src/{M000029.html → M000027.html} +103 -101
  138. data/ref/ruby/classes/String.html +21 -15
  139. data/ref/ruby/classes/String.src/M000021.html +36 -0
  140. data/ref/ruby/classes/String.src/{M000024.html → M000022.html} +24 -24
  141. data/ref/ruby/classes/String.src/M000023.html +5 -23
  142. data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000007.html +5 -5
  143. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000003.html +7 -7
  144. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000004.html +4 -4
  145. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000005.html +4 -4
  146. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000006.html +4 -4
  147. data/ref/ruby/classes/VerilogParser/Module.src/M000002.html +20 -20
  148. data/ref/ruby/classes/VerilogParser.html +6 -0
  149. data/ref/ruby/classes/VerilogParser.src/M000001.html +20 -20
  150. data/ref/ruby/classes/Vpi/Handle.html +89 -88
  151. data/ref/ruby/classes/Vpi/Handle.src/M000036.html +18 -0
  152. data/ref/ruby/classes/Vpi/Handle.src/M000037.html +5 -5
  153. data/ref/ruby/classes/Vpi/Handle.src/M000038.html +5 -5
  154. data/ref/ruby/classes/Vpi/Handle.src/M000039.html +5 -5
  155. data/ref/ruby/classes/Vpi/Handle.src/M000040.html +8 -5
  156. data/ref/ruby/classes/Vpi/Handle.src/M000041.html +8 -8
  157. data/ref/ruby/classes/Vpi/Handle.src/M000042.html +7 -6
  158. data/ref/ruby/classes/Vpi/Handle.src/M000043.html +31 -9
  159. data/ref/ruby/classes/Vpi/Handle.src/M000044.html +74 -31
  160. data/ref/ruby/classes/Vpi/Handle.src/M000045.html +17 -74
  161. data/ref/ruby/classes/Vpi/Handle.src/M000046.html +11 -17
  162. data/ref/ruby/classes/Vpi/Handle.src/M000048.html +31 -0
  163. data/ref/ruby/classes/Vpi/Handle.src/M000049.html +53 -52
  164. data/ref/ruby/classes/Vpi/S_vpi_time.src/M000050.html +4 -4
  165. data/ref/ruby/classes/Vpi/S_vpi_time.src/M000051.html +5 -5
  166. data/ref/ruby/classes/Vpi/S_vpi_value.html +15 -15
  167. data/ref/ruby/classes/Vpi/S_vpi_value.src/{M000036.html → M000033.html} +5 -5
  168. data/ref/ruby/classes/Vpi/S_vpi_value.src/M000034.html +5 -5
  169. data/ref/ruby/classes/Vpi/S_vpi_value.src/M000035.html +5 -5
  170. data/ref/ruby/classes/Vpi.html +48 -19
  171. data/ref/ruby/classes/Vpi.src/M000028.html +28 -0
  172. data/ref/ruby/classes/Vpi.src/M000029.html +18 -0
  173. data/ref/ruby/classes/Vpi.src/M000030.html +25 -15
  174. data/ref/ruby/classes/Vpi.src/M000031.html +9 -5
  175. data/ref/ruby/classes/Vpi.src/M000032.html +9 -25
  176. data/ref/ruby/created.rid +1 -1
  177. data/ref/ruby/files/bin/generate_test_rb.html +2 -1
  178. data/ref/ruby/files/bin/header_to_ruby_rb.html +1 -1
  179. data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +7 -1
  180. data/ref/ruby/files/lib/ruby-vpi/float_rb.html +7 -1
  181. data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +7 -1
  182. data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +7 -1
  183. data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +7 -1
  184. data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +1 -1
  185. data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +1 -1
  186. data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +1 -1
  187. data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +1 -1
  188. data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +1 -1
  189. data/ref/ruby/files/lib/ruby-vpi_rb.html +7 -1
  190. data/ref/ruby/fr_method_index.html +34 -34
  191. data/samp/counter/counter_rspec_runner.rake +4 -0
  192. data/samp/counter/counter_xunit_runner.rake +4 -0
  193. data/samp/pipelined_alu/Hw5UnitModel.rb +3 -19
  194. data/samp/pipelined_alu/README +38 -13
  195. data/samp/pipelined_alu/TestHw5UnitModel.rb +9 -20
  196. data/samp/pipelined_alu/hw5_unit.v +1 -16
  197. data/samp/pipelined_alu/hw5_unit_test_runner.rake +4 -0
  198. data/samp/pipelined_alu/hw5_unit_test_spec.rb +3 -20
  199. data/samp/pipelined_alu/int_gen.rb +6 -20
  200. metadata +47 -43
  201. data/doc/LICENSE +0 -397
  202. data/doc/images/feed-icon.LICENSE +0 -2
  203. data/doc/images/feed-icon.svg +0 -18
  204. data/ref/ruby/classes/Integer.src/M000020.html +0 -25
  205. data/ref/ruby/classes/Integer.src/M000021.html +0 -30
  206. data/ref/ruby/classes/String.src/M000025.html +0 -18
  207. data/ref/ruby/classes/Vpi/Handle.src/M000047.html +0 -24
  208. data/ref/ruby/classes/Vpi.src/M000033.html +0 -22
File without changes
@@ -0,0 +1,15 @@
1
+ The Ruby Logo is Copyright (c) 2006, Yukihiro Matsumoto. It is licensed
2
+ under the terms of the Creative Commons Attribution-ShareAlike 2.5
3
+ agreement:
4
+
5
+ http://creativecommons.org/licenses/by-sa/2.5/
6
+
7
+ We ask that you do not use the logo to represent something other than
8
+ the Ruby Programming language. If you have questions about the logo,
9
+ please join the VIT-Discuss mailing list and ask your questions there:
10
+
11
+ http://rubyforge.org/mailman/listinfo/vit-discuss/
12
+
13
+ Thank you,
14
+
15
+ The Ruby Visual Identity Team
Binary file
Binary file
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/doc/intro.inc CHANGED
@@ -1,5 +1,29 @@
1
- Ruby-VPI is a "Ruby":http://www.ruby-lang.org interface to "IEEE 1364-2005 Verilog VPI":http://ieeexplore.ieee.org/xpl/standardstoc.jsp?isnumber=33945. It lets you create complex Verilog test benches easily and wholly in Ruby.
1
+ Ruby-VPI is a platform for unit testing, rapid prototyping, and systems integration of Verilog modules through the "Ruby programming language":http://www.ruby-lang.org. It lets you:
2
2
 
3
+ * Access the _entire_ "IEEE 1364-2005 Verilog VPI":http://ieeexplore.ieee.org/xpl/standardstoc.jsp?isnumber=33945 interface from Ruby.
4
+ * Create complex Verilog test benches easily and wholly in Ruby.
5
+ * Apply agile software development practices to develop hardware.
6
+ * Perform "specification-driven functional verification":http://ruby-vpi.rubyforge.org/papers/masters_thesis.html ("PDF version":http://ruby-vpi.rubyforge.org/papers/masters_thesis.pdf).
7
+
8
+ Ruby-VPI is "open source software":http://en.wikipedia.org/wiki/Open_source_software released under "this license":#intro.license.
9
+
10
+
11
+ <div id="resources">
12
+
13
+ h2. Resources
14
+
15
+ p(title). Records
16
+
17
+ <a type="application/rss+xml" href="<%= RSS_URL %>"><img src="images/feed-icon-28x28.png" alt="RSS feed for release notifications" style="float: right"/></a>
18
+
19
+ * "What's new?":history.html
20
+ - a record of all release notes.
21
+ * "Plans":memo.html
22
+ - pending tasks for future releases.
23
+ * "Talks":http://ruby-vpi.rubyforge.org/talks/
24
+ - materials from presentations and seminars.
25
+ * "Papers":http://ruby-vpi.rubyforge.org/papers/
26
+ - research publications.
3
27
 
4
28
  p(title). Documentation
5
29
 
@@ -10,53 +34,36 @@ p(title). Documentation
10
34
  * "Reference":../ref/
11
35
  - API documentation for Ruby libraries and C extension.
12
36
 
13
-
14
- p(title). Records
15
-
16
- * <a type="application/rss+xml" href="<%= RSS_URL %>">!images/feed-icon.png(RSS feed icon)! RSS feed</a>
17
- - keep track of new releases at your leisure.
18
- * "Release history":history.html
19
- - record of all release notes.
20
- * "Memorandum":memo.html
21
- - pending tasks for future releases.
22
-
23
-
24
37
  p(title). Facilities
25
38
 
26
- * "Project portal":http://rubyforge.org/projects/ruby-vpi
27
- - hosted generously by "RubyForge":http://rubyforge.org.
28
- * "Source code":http://ruby-vpi.rubyforge.org/src/ruby-vpi
29
- - browse online or obtain through "Darcs":http://abridgegame.org/darcs/.
30
39
  * "Downloads":http://rubyforge.org/frs/?group_id=1339
31
40
  - obtain release packages.
41
+ * "Source code":http://ruby-vpi.rubyforge.org/src/ruby-vpi
42
+ - browse online or obtain with "Darcs":http://darcs.net.
43
+ * "Forums":http://rubyforge.org/forum/?group_id=1339
44
+ - discuss things and ask questions.
32
45
  * "Bugs":http://rubyforge.org/tracker/?group_id=1339
33
46
  - report defects in the software.
34
47
  * "Patches":http://rubyforge.org/tracker/?group_id=1339
35
48
  - submit patches to source code.
36
49
  * "Requests":http://rubyforge.org/tracker/?group_id=1339
37
50
  - request new features or get support.
38
- * "Forums":http://rubyforge.org/forum/?group_id=1339
39
- - discuss things and ask questions.
40
-
41
-
42
- p(title). Outreach
51
+ * "Project portal":http://rubyforge.org/projects/ruby-vpi
52
+ - hosted generously by "RubyForge":http://rubyforge.org.
43
53
 
44
- * "News":http://ruby-vpi.rubyforge.org/news
45
- - see what's cooking for the next release.
46
- * "Talks":http://ruby-vpi.rubyforge.org/talks
47
- - materials from presentations and seminars.
48
54
 
55
+ </div>
49
56
 
50
- h2(#intro.features). Prominent features
51
57
 
52
- h3. Portable
58
+ h2(#intro.features). Features
53
59
 
54
- * Supports the _entire_ "IEEE Std 1364-2005":http://ieeexplore.ieee.org/xpl/standardstoc.jsp?isnumber=33945 VPI standard.
60
+ p(title). Portable
55
61
 
56
- * Works with all "major Verilog simulators":manual.html#setup.reqs available today.
57
- ** Compiled _just once_ during "installation":manual.html#setup.installation and used forever!
62
+ * Supports the _entire_ "IEEE 1364-2005 Verilog VPI":http://ieeexplore.ieee.org/xpl/standardstoc.jsp?isnumber=33945 standard.
63
+ * Works with all "major Verilog simulators":#intro.reqs available today.
64
+ * Compiled _just once_ during "installation":manual.html#setup.installation and used forever!
58
65
 
59
- h3. Agile
66
+ p(title). Agile
60
67
 
61
68
  * Enables "agile practices":http://agilemanifesto.org/ such as
62
69
  ** "test-driven":http://www.testdriven.com development
@@ -68,7 +75,7 @@ h3. Agile
68
75
  ** The "automated test generator":manual.html#usage.tools.generate-test helps you accomodate design changes with _minimal_ effort.
69
76
  ** There is absolutely _no compiling_!
70
77
 
71
- h3. Powerful
78
+ p(title). Powerful
72
79
 
73
80
  * Inherits the "power and elegance":http://www.ruby-lang.org/en/about/ of Ruby:
74
81
  ** Unlimited length integers
@@ -80,14 +87,53 @@ h3. Powerful
80
87
  * Uses "ruby-debug":http://rubyforge.org/projects/ruby-debug/ for "interactive debugging":manual.html#usage.debugger.
81
88
  * Uses "rcov":http://eigenclass.org/hiki.rb?rcov for test "coverage analysis and report generation":manual.html#usage.test-runner.env-vars.
82
89
 
83
- h3. Free
84
90
 
85
- * Gives you the _freedom_ to study, modify, and distribute this software, in accordance with the "GNU General Public License":http://www.gnu.org/copyleft/gpl.html.
91
+ h2(#intro.reqs). Requirements
92
+
93
+ The following software is necessary in order to use Ruby-VPI.
94
+
95
+ p(title). Verilog simulator
96
+
97
+ Ruby-VPI is known to work with the following simulators. However, you should be able to use it with any Verilog simulator that supports VPI.
98
+
99
+ * "Synopsys VCS":http://www.synopsys.com/products/simulation/simulation.html
100
+ - any version that supports the <tt>-load</tt> option is acceptable.
101
+
102
+ * "Mentor Modelsim":http://www.model.com
103
+ - any version that supports the <tt>-pli</tt> option is acceptable.
104
+
105
+ * "Cadence NC-Sim / NC-Verilog":http://www.cadence.com/products/functional_ver/nc-verilog/
106
+ - any version that supports the <tt>+loadvpi</tt> option is acceptable.
107
+
108
+ * "GPL Cver":http://www.pragmatic-c.com/gpl-cver/
109
+ - version 2.11a or newer is acceptable.
110
+
111
+ * "Icarus Verilog":http://www.icarus.com/eda/Verilog/
112
+ - version 0.8 is _mostly_ acceptable -- you *will not* be able to "access child handles through method calls":manual.html#background.org.vpi.util. The reason for this limitation is explained "in the user manual":#problems.ivl.vpi_handle_by_name.absolute-paths.
113
+
114
+ p(title). Compilers
115
+
116
+ * "make":http://en.wikipedia.org/wiki/Make
117
+ - any flavor should be acceptable.
118
+
119
+ * C compiler
120
+ - the "GNU Compiler Collection (GCC)":http://www.gnu.org/software/gcc/ is preferred, but any C compiler should be acceptable.
121
+
122
+ * "Ruby":http://www.ruby-lang.org
123
+ - version 1.8 or newer, including header and linkable object files for building extensions, is necessary. You can install Ruby by following "these instructions":http://www.rubygarden.org/faq/section/show/3.
124
+
125
+ p(title). Libraries
126
+
127
+ * "POSIX threads (pthreads)":http://en.wikipedia.org/wiki/Pthreads
128
+ - header and linkable object files, and operating system support for this library are necessary.
129
+
130
+ * "RubyGems":http://rubyforge.org/frs/?group_id=126
131
+ - any recent version should be acceptable. You can install RubyGems by following "these instructions":http://www.rubygems.org/read/chapter/3.
86
132
 
87
133
 
88
134
  h2(#intro.applications). Applications
89
135
 
90
- Here is a modest sampling of tasks that Ruby-VPI can be used to perform.
136
+ Examples of tasks that can be performed with Ruby-VPI are:
91
137
 
92
138
  * From the second edition of "_The Verilog PLI Handbook_":http://www.sutherland-hdl.com/publications.html:
93
139
  ** C language bus-functional models
@@ -110,7 +156,7 @@ Here is a modest sampling of tasks that Ruby-VPI can be used to perform.
110
156
 
111
157
  h2(#intro.appetizers). Appetizers
112
158
 
113
- Here is a modest sampling of code to whet your appetite.
159
+ Here is a tiny sampling of code to whet your appetite. See "the tutorial":manual.html#usage.tutorial for more samples.
114
160
 
115
161
  * Assign the value 2^2048^ to a register:
116
162
 
@@ -127,3 +173,26 @@ bq. @puts some_register@
127
173
  * Simulate fifteen clock cycles:
128
174
 
129
175
  bq. @15.times { simulate }@
176
+
177
+
178
+ h2(#intro.license). License
179
+
180
+ <%= File.read '../LICENSE' %>
181
+
182
+
183
+ h2(#intro.related-works). Related works
184
+
185
+ * "JOVE":http://jove.sourceforge.net is a Java interface to VPI.
186
+ * "Teal":http://teal.sourceforge.net is a C++ interface to VPI.
187
+ * "ScriptEDA":http://embedded.eecs.berkeley.edu/Alumni/pinhong/scriptEDA/ is a Perl, Python, and Tcl interface to VPI.
188
+ * "RHDL":http://rhdl.rubyforge.org is a hardware description and verification language based on Ruby.
189
+ * "MyHDL":http://myhdl.jandecaluwe.com is a hardware description and verification language based on Python, which features conversion to Verilog and co-simulation.
190
+
191
+
192
+ h3(#intro.related-works.pli). Ye olde PLI
193
+
194
+ The following projects utilize the archaic *tf* and *acc* PLI interfaces, which have been officially deprecated in IEEE Std 1364-2005.
195
+
196
+ * "ScriptSim":http://www.nelsim.com is a Perl, Python, and Tcl/Tk interface to PLI.
197
+ * "Verilog::Pli":http://www.veripool.com/verilog-pli.html is a Perl interface to PLI.
198
+ * "JPLI":http://www.time-rover.com/jpli/ is a proprietary Java interface to PLI.
@@ -1,22 +1,6 @@
1
- =begin
2
- Copyright 2006 Suraj N. Kurapati
3
-
4
- This file is part of Ruby-VPI.
5
-
6
- Ruby-VPI is free software; you can redistribute it and/or
7
- modify it under the terms of the GNU General Public License
8
- as published by the Free Software Foundation; either version 2
9
- of the License, or (at your option) any later version.
10
-
11
- Ruby-VPI is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with Ruby-VPI; if not, write to the Free Software Foundation,
18
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
- =end
1
+ #--
2
+ # Copyright 2006-2007 Suraj N. Kurapati
3
+ # See the file named LICENSE for details.
20
4
 
21
5
  require 'cgi'
22
6
  require 'rubygems'
@@ -24,29 +8,49 @@ require 'coderay'
24
8
  require 'redcloth'
25
9
 
26
10
  class String
27
- # The content of these HTML tags will be preserved verbatim when they are processed by Textile.
11
+ # The content of these HTML tags will be preserved verbatim when they are
12
+ # processed by Textile.
28
13
  PRESERVED_TAGS = [:code, :tt]
29
14
 
30
15
  # Transforms this string into HTML.
31
16
  def to_html
32
17
  text = dup
33
18
 
34
- # prevent the content of these tags from being transformed by Textile
35
- # for example, Textile transforms quotation marks in code into curly ones (&#8192;) -- this ruins any source code in the content of the tags!
19
+ # prevent the content of these tags from being transformed by Textile.
20
+ # for example, Textile transforms quotation marks in code into curly ones
21
+ # (&#8192;) -- this ruins any source code in the content of the tags!
36
22
  PRESERVED_TAGS.each do |tag|
37
- text.gsub! %r{<#{tag}(.*?)>(.*?)</#{tag}>}m, %{<pre tag=#{tag.inspect}\\1>\\2</pre>}
23
+ text.gsub! \
24
+ %r{<#{tag}(.*?)>(.*?)</#{tag}>}m,
25
+ %{<pre tag=#{tag.inspect}\\1>\\2</pre>}
38
26
  end
39
27
 
40
28
  html = text.redcloth
41
29
 
30
+ # redcloth wraps a single item within paragraph tags, which prevents the
31
+ # item's HTML from being validly injected within other block-level
32
+ # elements, such as headings (h1, h2, etc.)
33
+ html.sub! %r{^<p>(.*)</p>$}m do |match|
34
+ payload = $1
35
+
36
+ if payload =~ /<p>/
37
+ match
38
+ else
39
+ payload
40
+ end
41
+ end
42
+
42
43
  # restore the original tags for the preserved tags
43
- # unescape content of <pre> tags because they may contain nested preserved tags (redcloth escapes the content of <pre> tags)
44
+ # unescape content of <pre> tags because they may contain nested
45
+ # preserved tags (redcloth escapes the content of <pre> tags)
44
46
  html.gsub! %r{(<pre>)(.*?)(</pre>)}m do
45
47
  $1 + CGI.unescapeHTML($2) + $3
46
48
  end
47
49
 
48
50
  PRESERVED_TAGS.each do |tag|
49
- html.gsub! %r{<pre tag=#{tag.inspect}(.*?)>(.*?)</pre>}m, %{<#{tag}\\1>\\2</#{tag}>}
51
+ html.gsub! \
52
+ %r{<pre tag=#{tag.inspect}(.*?)>(.*?)</pre>}m,
53
+ %{<#{tag}\\1>\\2</#{tag}>}
50
54
  end
51
55
 
52
56
  # assume that indented text in Textile is NOT source code
@@ -65,10 +69,10 @@ class String
65
69
  RedCloth.new(self).to_html
66
70
  end
67
71
 
68
- # Adds syntax coloring to <code> elements in the given text. If
69
- # the <code> tag has an attribute lang="...", then that is considered the
70
- # programming language for which appropriate syntax coloring should be
71
- # applied. Otherwise, the programming language is assumed to be ruby.
72
+ # Adds syntax coloring to <code> elements in the given text. If the <code>
73
+ # tag has an attribute lang="...", then that is considered the programming
74
+ # language for which appropriate syntax coloring should be applied.
75
+ # Otherwise, the programming language is assumed to be ruby.
72
76
  def coderay
73
77
  gsub %r{<(code)(.*?)>(.*?)</\1>}m do
74
78
  code = CGI.unescapeHTML $3
@@ -93,4 +97,122 @@ class String
93
97
  %{<#{tag} class="code"#{atts}>#{html}</#{tag}>}
94
98
  end
95
99
  end
100
+
101
+
102
+ # Transforms this string into a valid XHTML anchor (ID attribute).
103
+ # See http://www.nmt.edu/tcc/help/pubs/xhtml/id-type.html
104
+ def to_html_anchor
105
+ # The first or only character must be a letter.
106
+ buf =
107
+ if self[0,1] =~ /[[:alpha:]]/
108
+ self
109
+ else
110
+ 'a' + self
111
+ end
112
+
113
+ # The remaining characters must be letters, digits, hyphens (-),
114
+ # underscores (_), colons (:), or periods (.) [or Unicode characters]
115
+ buf.unpack('U*').map! do |code|
116
+ if code > 0xFF or code.chr =~ /[[:alnum:]\-_:\.]/
117
+ code
118
+ else
119
+ ?_
120
+ end
121
+ end.pack('U*')
122
+ end
123
+
124
+ @@anchors = []
125
+
126
+ # Resets the list of anchors encountered thus far.
127
+ def String.reset_anchors
128
+ @@anchors.clear
129
+ end
130
+
131
+ # Builds a table of contents from XHTML headings (<h1>, <h2>, etc.) found
132
+ # in this string and returns an array containing [toc, text] where:
133
+ #
134
+ # toc:: the generated table of contents
135
+ #
136
+ # text:: a modified version of this string which contains anchors for the
137
+ # hyperlinks in the table of contents (so that the TOC can link to
138
+ # the content in this string)
139
+ #
140
+ # If a block is given, it will be invoked every time a heading is found, with
141
+ # information about the found heading.
142
+ #
143
+ def table_of_contents
144
+ toc = '<ul>'
145
+ prevDepth = 0
146
+ prevIndex = ''
147
+
148
+ text = gsub %r{<h(\d)(.*?)>(.*?)</h\1>$}m do
149
+ depth, atts, title = $1.to_i, $2, $3.strip
150
+
151
+ # generate a LaTeX-style index (section number) for the heading
152
+ depthDiff = (depth - prevDepth).abs
153
+
154
+ index =
155
+ if depth > prevDepth
156
+ toc << '<li><ul>' * depthDiff
157
+
158
+ s = prevIndex + ('.1' * depthDiff)
159
+ s.sub(/^\./, '')
160
+
161
+ elsif depth < prevDepth
162
+ toc << '</ul></li>' * depthDiff
163
+
164
+ s = prevIndex.sub(/(\.\d+){#{depthDiff}}$/, '')
165
+ s.next
166
+
167
+ else
168
+ prevIndex.next
169
+
170
+ end
171
+
172
+ prevDepth = depth
173
+ prevIndex = index
174
+
175
+ # generate a unique HTML anchor for the heading
176
+ anchor = CGI.unescape(
177
+ if atts =~ /id=('|")(.*?)\1/
178
+ atts = $` + $'
179
+ $2
180
+ else
181
+ title
182
+ end
183
+ ).to_html_anchor
184
+
185
+ anchor << anchor.object_id.to_s while @@anchors.include? anchor
186
+ @@anchors << anchor
187
+
188
+ yield title, anchor, index, depth, atts if block_given?
189
+
190
+ # provide hyperlinks for traveling between TOC and heading
191
+ dst = anchor
192
+ src = dst.object_id.to_s.to_html_anchor
193
+
194
+ # forward link from TOC to heading
195
+ toc << %{<li><a id="#{src}" href="##{dst}">#{title}</a></li>}
196
+
197
+ # reverse link from heading to TOC
198
+ %{<h#{depth}#{atts}><a id="#{dst}" href="##{src}">#{index}</a> &nbsp; #{title}</h#{depth}>}
199
+ end
200
+
201
+ if prevIndex.empty?
202
+ toc = nil # there were no headings
203
+ else
204
+ toc << '</ul></li>' * prevDepth
205
+ toc << '</ul>'
206
+
207
+ # collapse redundant list elements
208
+ while toc.gsub! %r{(<li>.*?)</li><li>(<ul>)}, '\1\2'
209
+ end
210
+
211
+ # collapse unnecessary levels
212
+ while toc.gsub! %r{(<ul>)<li><ul>(.*)</ul></li>(</ul>)}, '\1\2\3'
213
+ end
214
+ end
215
+
216
+ [toc, text]
217
+ end
96
218
  end
data/doc/lib/doc_proxy.rb CHANGED
@@ -1,31 +1,17 @@
1
- =begin
2
- Copyright 2006 Suraj N. Kurapati
3
-
4
- This file is part of Ruby-VPI.
5
-
6
- Ruby-VPI is free software; you can redistribute it and/or
7
- modify it under the terms of the GNU General Public License
8
- as published by the Free Software Foundation; either version 2
9
- of the License, or (at your option) any later version.
10
-
11
- Ruby-VPI is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with Ruby-VPI; if not, write to the Free Software Foundation,
18
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
- =end
1
+ #--
2
+ # Copyright 2006 Suraj N. Kurapati
3
+ # See the file named LICENSE for details.
20
4
 
21
5
  require 'erb_proxy'
6
+ require 'doc_format'
22
7
 
23
- # Processes ERB templates to produce documentation. Templates may contain "<xref...>" tags where the ... represents the target anchor of the cross-reference.
8
+ # Processes ERB templates to produce documentation. Templates may contain
9
+ # "<xref...>" tags where the ... represents the target anchor of the
10
+ # cross-reference.
24
11
  class DocProxy < ErbProxy
25
12
  Block = Struct.new :anchor, :title, :type
26
13
  Heading = Struct.new :anchor, :title, :depth, :index
27
14
  Index = Struct.new :name, :items
28
- @@anchorNum = 0
29
15
 
30
16
  CATEGORIES = {
31
17
  :admonition => [:tip, :note, :important, :caution, :warning],
@@ -46,7 +32,7 @@ class DocProxy < ErbProxy
46
32
  CATEGORIES[:admonition].each do |type|
47
33
  add_block_handler :admonition, type do |index, title, text|
48
34
  join_redcloth_elements [
49
- %{!<images/#{type}.png(#{type})!},
35
+ %{!<images/tango/#{type}.png(#{type})!},
50
36
  %{p(title). #{type.to_s.capitalize}: #{title}},
51
37
  text,
52
38
  ]
@@ -63,61 +49,28 @@ class DocProxy < ErbProxy
63
49
  end
64
50
  end
65
51
 
66
- # Post-processes the given ERB template result by parsing the document structure and expanding cross-references, and returns the result.
67
- def post_process! aResult
68
- buffer = aResult
69
-
70
- # parse document structure and insert anchors (so that the table of contents can link directly to these headings) where necessary
71
- buffer.gsub! %r{^(\s*h(\d))(.*)$} do
72
- head, depth, rest = $1, $2.to_i, $3
73
-
74
- # parse title and class attributes
75
- rest =~ /^([\{\(\[].*?[\]\)\}])?\.(.*)$/
76
- atts, title = $1, $2.strip
77
-
78
- # put heading index in title
79
- prevDepth = @headings.last.depth rescue 0
80
- prevIndex = @headings.last.index rescue ""
81
- depthDiff = (depth - prevDepth).abs
82
-
83
- index =
84
- if depth > prevDepth
85
- s = prevIndex + ('.1' * depthDiff)
86
- s.sub /^\./, ''
87
-
88
- elsif depth < prevDepth
89
- s = prevIndex.sub /(\.\d+){#{depthDiff}}$/, ''
90
- s.next
91
-
92
- else
93
- prevIndex.next
94
- end
95
-
96
- rest = "#{atts}. #{index} &nbsp; #{title}"
97
-
98
- # parse and insert anchor if necessary
99
- if atts =~ /#(.*?)\)/
100
- anchor = $1
101
- else
102
- anchor = "anchor#{@@anchorNum += 1}"
103
- rest.insert 0, "(##{anchor})"
104
- end
52
+ # Post-processes the given ERB template result by parsing the document
53
+ # structure and expanding cross-references, and returns the result.
54
+ def post_process aResult
55
+ text = aResult.to_html
56
+ anchors = []
105
57
 
58
+ # parse document structure and insert anchors (so that the table of contents
59
+ # can link directly to these headings) where necessary
60
+ toc, text = text.table_of_contents do |title, anchor, index, depth, atts|
106
61
  @headings << Heading.new(anchor, title, depth, index)
107
62
  @blocks[:section] << Block.new(anchor, title, :section)
108
-
109
- head + rest
110
63
  end
111
64
 
112
65
  # expand cross-references into links to their targets
113
66
  blocks = @blocks.values.flatten
114
67
 
115
- buffer.gsub! %r{<xref\s*(.+?)\s*/?>} do
68
+ text.gsub! %r{<xref\s*(.+?)\s*/?>} do
116
69
  anchor = unanchor($1)
117
70
  target = blocks.find {|b| b.anchor == anchor}
118
71
 
119
72
  if target
120
- %{"the #{target.type} named &ldquo;#{target.title}&rdquo;":##{target.anchor}}
73
+ %{<a href="##{target.anchor}">the #{target.type} named &ldquo;#{target.title}&rdquo;</a>}
121
74
  else
122
75
  warn "unresolved cross-reference to #{anchor}"
123
76
  %{"#{anchor}":##{anchor}}
@@ -138,14 +91,19 @@ class DocProxy < ErbProxy
138
91
  end
139
92
  end
140
93
 
141
- buffer
94
+ [toc, text]
142
95
  end
143
96
 
144
- # Adds a block handler for the given type of block and outputs the result in a <div> whose CSS class is the given category.
145
- # The arguments for the block handler are:
97
+ # Adds a block handler for the given type of block and outputs the result in a
98
+ # <div> whose CSS class is the given category. The arguments for the block
99
+ # handler are:
100
+ #
146
101
  # 1. number of the block
102
+ #
147
103
  # 2. title of the block
104
+ #
148
105
  # 3. content of the block
106
+ #
149
107
  def add_block_handler aCategory, aType
150
108
  raise ArgumentError unless block_given?
151
109
 
@@ -175,7 +133,8 @@ class DocProxy < ErbProxy
175
133
 
176
134
  private
177
135
 
178
- # Joins the given elements by putting enough white-space between them so that RedCloth knows they're different elements.
136
+ # Joins the given elements by putting enough white-space between them so that
137
+ # RedCloth knows they're different elements.
179
138
  def join_redcloth_elements *args
180
139
  args.join("\n\n\n") << "\n\n\n"
181
140
  end