ruby-vpi 16.0.1 → 17.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 (247) hide show
  1. data/LICENSE +19 -19
  2. data/README +1 -1
  3. data/Rakefile +35 -32
  4. data/bin/convert.rb +28 -0
  5. data/bin/generate/design.rb +16 -0
  6. data/bin/generate/proto.rb +13 -0
  7. data/bin/generate/runner.rake +33 -0
  8. data/bin/generate/spec.rb +45 -0
  9. data/bin/generate.rb +177 -0
  10. data/bin/ruby-vpi +56 -0
  11. data/doc/Rakefile +20 -4
  12. data/doc/common.css +92 -33
  13. data/doc/common.inc +13 -0
  14. data/doc/common.tpl +42 -28
  15. data/doc/history.doc +11 -11
  16. data/doc/history.html +769 -248
  17. data/doc/history.inc +909 -0
  18. data/doc/history.rb +9 -0
  19. data/doc/history.yaml +69 -0
  20. data/doc/intro.inc +170 -178
  21. data/doc/lib/doc_format.rb +57 -144
  22. data/doc/lib/doc_proxy.rb +504 -88
  23. data/doc/lib/erb_content.rb +8 -8
  24. data/doc/lib/erb_proxy.rb +17 -17
  25. data/doc/manual.doc +626 -777
  26. data/doc/manual.html +1541 -1031
  27. data/doc/memo.doc +38 -36
  28. data/doc/memo.html +64 -28
  29. data/doc/readme.doc +4 -31
  30. data/doc/readme.html +221 -163
  31. data/doc/rss.erb +1 -1
  32. data/doc/rss.xml +73 -1761
  33. data/ext/Rakefile +6 -5
  34. data/ext/main.c +17 -15
  35. data/ext/relay.c +4 -7
  36. data/ext/relay.h +2 -2
  37. data/ext/swig_vpi.h +2 -2
  38. data/ext/swig_vpi.i +1 -2
  39. data/ext/swig_wrap.cin +12 -16
  40. data/ext/vlog.c +5 -5
  41. data/ext/vlog.h +2 -2
  42. data/lib/ruby-vpi/erb.rb +3 -3
  43. data/lib/ruby-vpi/float.rb +2 -2
  44. data/lib/ruby-vpi/rcov.rb +5 -7
  45. data/lib/ruby-vpi/runner.rb +43 -41
  46. data/lib/ruby-vpi/runner_boot_loader.rb +117 -0
  47. data/lib/ruby-vpi/runner_proxy.rb +6 -8
  48. data/lib/ruby-vpi/util.rb +10 -0
  49. data/lib/ruby-vpi/verilog_parser.rb +28 -56
  50. data/lib/ruby-vpi/vpi.rb +168 -123
  51. data/lib/ruby-vpi.rb +22 -143
  52. data/ref/c/annotated.html +1 -1
  53. data/ref/c/common_8h.html +1 -1
  54. data/ref/c/files.html +1 -1
  55. data/ref/c/functions.html +1 -1
  56. data/ref/c/functions_vars.html +1 -1
  57. data/ref/c/globals.html +1 -1
  58. data/ref/c/globals_0x63.html +1 -1
  59. data/ref/c/globals_0x65.html +1 -1
  60. data/ref/c/globals_0x66.html +1 -1
  61. data/ref/c/globals_0x6d.html +1 -1
  62. data/ref/c/globals_0x70.html +1 -1
  63. data/ref/c/globals_0x72.html +1 -1
  64. data/ref/c/globals_0x73.html +1 -1
  65. data/ref/c/globals_0x74.html +1 -1
  66. data/ref/c/globals_0x76.html +1 -1
  67. data/ref/c/globals_0x78.html +1 -1
  68. data/ref/c/globals_defs.html +1 -1
  69. data/ref/c/globals_defs_0x65.html +1 -1
  70. data/ref/c/globals_defs_0x70.html +1 -1
  71. data/ref/c/globals_defs_0x76.html +1 -1
  72. data/ref/c/globals_defs_0x78.html +1 -1
  73. data/ref/c/globals_enum.html +1 -1
  74. data/ref/c/globals_eval.html +1 -1
  75. data/ref/c/globals_func.html +1 -1
  76. data/ref/c/globals_type.html +1 -1
  77. data/ref/c/globals_vars.html +1 -1
  78. data/ref/c/index.html +1 -1
  79. data/ref/c/main_8c.html +1 -1
  80. data/ref/c/main_8h.html +1 -1
  81. data/ref/c/relay_8c.html +1 -1
  82. data/ref/c/relay_8h.html +1 -1
  83. data/ref/c/structt__cb__data.html +1 -1
  84. data/ref/c/structt__vpi__delay.html +1 -1
  85. data/ref/c/structt__vpi__error__info.html +1 -1
  86. data/ref/c/structt__vpi__strengthval.html +1 -1
  87. data/ref/c/structt__vpi__systf__data.html +1 -1
  88. data/ref/c/structt__vpi__time.html +1 -1
  89. data/ref/c/structt__vpi__value.html +1 -1
  90. data/ref/c/structt__vpi__vecval.html +1 -1
  91. data/ref/c/structt__vpi__vlog__info.html +1 -1
  92. data/ref/c/verilog_8h.html +1 -1
  93. data/ref/c/vlog_8c.html +1 -1
  94. data/ref/c/vlog_8h.html +1 -1
  95. data/ref/c/vpi__user_8h.html +1 -1
  96. data/ref/ruby/classes/ERB.html +5 -5
  97. data/ref/ruby/classes/ERB.src/{M000024.html → M000026.html} +0 -0
  98. data/ref/ruby/classes/FileUtils.html +11 -11
  99. data/ref/ruby/classes/FileUtils.src/{M000025.html → M000027.html} +0 -0
  100. data/ref/ruby/classes/FileUtils.src/{M000026.html → M000028.html} +0 -0
  101. data/ref/ruby/classes/Float.html +6 -6
  102. data/ref/ruby/classes/Float.src/{M000020.html → M000021.html} +0 -0
  103. data/ref/ruby/classes/Integer.html +65 -65
  104. data/ref/ruby/classes/Integer.src/M000009.html +12 -5
  105. data/ref/ruby/classes/Integer.src/M000010.html +5 -5
  106. data/ref/ruby/classes/Integer.src/M000011.html +5 -5
  107. data/ref/ruby/classes/Integer.src/M000012.html +5 -5
  108. data/ref/ruby/classes/Integer.src/M000013.html +5 -5
  109. data/ref/ruby/classes/Integer.src/M000014.html +18 -0
  110. data/ref/ruby/classes/Integer.src/M000017.html +12 -18
  111. data/ref/ruby/classes/Integer.src/M000018.html +18 -12
  112. data/ref/ruby/classes/Integer.src/M000019.html +12 -17
  113. data/ref/ruby/classes/Integer.src/M000020.html +30 -0
  114. data/ref/ruby/classes/RDoc.html +5 -5
  115. data/ref/ruby/classes/RDoc.src/{M000053.html → M000058.html} +0 -0
  116. data/ref/ruby/classes/{RubyVpi/Config.html → RubyVPI.html} +20 -6
  117. data/ref/ruby/classes/String.html +34 -15
  118. data/ref/ruby/classes/String.src/M000022.html +5 -28
  119. data/ref/ruby/classes/String.src/M000023.html +5 -5
  120. data/ref/ruby/classes/String.src/{M000021.html → M000024.html} +0 -0
  121. data/ref/ruby/classes/String.src/M000025.html +41 -0
  122. data/ref/ruby/classes/VerilogParser/Module/Port.html +16 -36
  123. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000006.html +10 -5
  124. data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000004.html → M000007.html} +4 -4
  125. data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000005.html → M000008.html} +4 -4
  126. data/ref/ruby/classes/VerilogParser/Module.html +28 -9
  127. data/ref/ruby/classes/VerilogParser/Module.src/M000005.html +29 -0
  128. data/ref/ruby/classes/VerilogParser.html +5 -39
  129. data/ref/ruby/classes/VerilogParser.src/M000004.html +26 -0
  130. data/ref/ruby/classes/Vpi/Handle.html +179 -77
  131. data/ref/ruby/classes/Vpi/Handle.src/M000035.html +18 -0
  132. data/ref/ruby/classes/Vpi/Handle.src/M000036.html +5 -5
  133. data/ref/ruby/classes/Vpi/Handle.src/M000037.html +5 -5
  134. data/ref/ruby/classes/Vpi/Handle.src/M000038.html +5 -5
  135. data/ref/ruby/classes/Vpi/Handle.src/M000039.html +5 -5
  136. data/ref/ruby/classes/Vpi/Handle.src/M000040.html +5 -8
  137. data/ref/ruby/classes/Vpi/Handle.src/M000041.html +5 -8
  138. data/ref/ruby/classes/Vpi/Handle.src/M000042.html +5 -9
  139. data/ref/ruby/classes/Vpi/Handle.src/M000043.html +8 -31
  140. data/ref/ruby/classes/Vpi/Handle.src/M000044.html +8 -74
  141. data/ref/ruby/classes/Vpi/Handle.src/M000045.html +9 -17
  142. data/ref/ruby/classes/Vpi/Handle.src/M000046.html +31 -11
  143. data/ref/ruby/classes/Vpi/Handle.src/M000047.html +86 -0
  144. data/ref/ruby/classes/Vpi/Handle.src/M000048.html +17 -18
  145. data/ref/ruby/classes/Vpi/Handle.src/M000050.html +18 -0
  146. data/ref/ruby/classes/Vpi/Handle.src/M000051.html +24 -0
  147. data/ref/ruby/classes/Vpi/Handle.src/M000053.html +31 -0
  148. data/ref/ruby/classes/Vpi/Handle.src/M000054.html +89 -0
  149. data/ref/ruby/classes/Vpi/S_vpi_time.html +16 -16
  150. data/ref/ruby/classes/Vpi/S_vpi_time.src/{M000050.html → M000055.html} +4 -4
  151. data/ref/ruby/classes/Vpi/S_vpi_time.src/{M000051.html → M000056.html} +5 -5
  152. data/ref/ruby/classes/Vpi/S_vpi_value.html +15 -15
  153. data/ref/ruby/classes/Vpi/S_vpi_value.src/{M000035.html → M000032.html} +5 -5
  154. data/ref/ruby/classes/Vpi/S_vpi_value.src/M000033.html +5 -5
  155. data/ref/ruby/classes/Vpi/S_vpi_value.src/M000034.html +5 -5
  156. data/ref/ruby/classes/Vpi.html +6 -42
  157. data/ref/ruby/classes/Vpi.src/M000029.html +15 -5
  158. data/ref/ruby/classes/Vpi.src/M000030.html +24 -24
  159. data/ref/ruby/classes/Vpi.src/M000031.html +6 -8
  160. data/ref/ruby/created.rid +1 -1
  161. data/ref/ruby/files/bin/{header_to_ruby_rb.html → convert_rb.html} +5 -5
  162. data/ref/ruby/files/bin/{generate_test_rb.html → generate_rb.html} +8 -21
  163. data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +1 -1
  164. data/ref/ruby/files/lib/ruby-vpi/float_rb.html +1 -1
  165. data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +1 -1
  166. data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +1 -1
  167. data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +1 -1
  168. data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +1 -1
  169. data/ref/ruby/files/lib/ruby-vpi/runner_boot_loader_rb.html +197 -0
  170. data/ref/ruby/files/lib/ruby-vpi/runner_boot_loader_rb.src/M000001.html +17 -0
  171. data/ref/ruby/files/lib/ruby-vpi/runner_boot_loader_rb.src/M000002.html +18 -0
  172. data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +1 -1
  173. data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +6 -19
  174. data/ref/ruby/files/lib/ruby-vpi/util_rb.html +101 -0
  175. data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +8 -1
  176. data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +1 -1
  177. data/ref/ruby/files/lib/ruby-vpi_rb.html +2 -14
  178. data/ref/ruby/fr_class_index.html +1 -3
  179. data/ref/ruby/fr_file_index.html +4 -2
  180. data/ref/ruby/fr_method_index.html +56 -51
  181. data/ref/ruby/index.html +1 -1
  182. data/samp/counter/RSpec/Rakefile +1 -0
  183. data/samp/counter/RSpec/counter_design.rb +15 -0
  184. data/samp/counter/RSpec/counter_proto.rb +10 -0
  185. data/samp/counter/RSpec/counter_runner.rake +44 -0
  186. data/samp/counter/RSpec/counter_spec.rb +39 -0
  187. data/samp/counter/Rakefile +1 -1
  188. data/samp/counter/counter.v +7 -7
  189. data/samp/counter/xUnit/Rakefile +1 -0
  190. data/samp/counter/xUnit/counter_bench.rb +95 -0
  191. data/samp/counter/{counter_xunit_bench.v → xUnit/counter_bench.v} +0 -0
  192. data/samp/counter/xUnit/counter_design.rb +15 -0
  193. data/samp/counter/xUnit/counter_proto.rb +10 -0
  194. data/samp/counter/xUnit/counter_runner.rake +44 -0
  195. data/samp/counter/{counter_xunit_spec.rb → xUnit/counter_spec.rb} +9 -9
  196. data/samp/pipelined_alu/Rakefile +1 -1
  197. data/samp/pipelined_alu/TestHw5UnitModel.rb +4 -5
  198. data/samp/pipelined_alu/hw5_unit.v +55 -85
  199. data/samp/pipelined_alu/hw5_unit_design.rb +51 -0
  200. data/samp/pipelined_alu/hw5_unit_proto.rb +4 -0
  201. data/samp/pipelined_alu/hw5_unit_runner.rake +43 -0
  202. data/samp/pipelined_alu/hw5_unit_spec.rb +64 -0
  203. data/samp/register_file/LICENSE +20 -0
  204. data/samp/register_file/README +4 -0
  205. data/samp/register_file/Rakefile +1 -0
  206. data/samp/register_file/register_file.v +18 -0
  207. data/samp/register_file/register_file_design.rb +11 -0
  208. data/samp/register_file/register_file_proto.rb +11 -0
  209. data/samp/register_file/register_file_runner.rake +43 -0
  210. data/samp/register_file/register_file_spec.rb +58 -0
  211. metadata +78 -66
  212. data/bin/generate_test.rb +0 -200
  213. data/bin/generate_test_tpl/bench.rb +0 -89
  214. data/bin/generate_test_tpl/bench.v +0 -26
  215. data/bin/generate_test_tpl/design.rb +0 -11
  216. data/bin/generate_test_tpl/proto.rb +0 -16
  217. data/bin/generate_test_tpl/runner.rake +0 -42
  218. data/bin/generate_test_tpl/spec.rb +0 -37
  219. data/bin/header_to_ruby.rb +0 -27
  220. data/ref/ruby/classes/Integer.src/M000008.html +0 -25
  221. data/ref/ruby/classes/Integer.src/M000016.html +0 -25
  222. data/ref/ruby/classes/RubyVpi.html +0 -199
  223. data/ref/ruby/classes/RubyVpi.src/M000027.html +0 -121
  224. data/ref/ruby/classes/VerilogParser/Module/Parameter.html +0 -160
  225. data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000007.html +0 -19
  226. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000003.html +0 -21
  227. data/ref/ruby/classes/VerilogParser/Module.src/M000002.html +0 -34
  228. data/ref/ruby/classes/VerilogParser.src/M000001.html +0 -34
  229. data/ref/ruby/classes/Vpi/Handle.src/M000049.html +0 -69
  230. data/ref/ruby/classes/Vpi.src/M000028.html +0 -28
  231. data/ref/ruby/classes/Vpi.src/M000032.html +0 -22
  232. data/samp/counter/counter_rspec_bench.rb +0 -86
  233. data/samp/counter/counter_rspec_bench.v +0 -9
  234. data/samp/counter/counter_rspec_design.rb +0 -8
  235. data/samp/counter/counter_rspec_proto.rb +0 -13
  236. data/samp/counter/counter_rspec_runner.rake +0 -52
  237. data/samp/counter/counter_rspec_spec.rb +0 -39
  238. data/samp/counter/counter_xunit_bench.rb +0 -86
  239. data/samp/counter/counter_xunit_design.rb +0 -8
  240. data/samp/counter/counter_xunit_proto.rb +0 -13
  241. data/samp/counter/counter_xunit_runner.rake +0 -52
  242. data/samp/pipelined_alu/hw5_unit_test_bench.rb +0 -86
  243. data/samp/pipelined_alu/hw5_unit_test_bench.v +0 -14
  244. data/samp/pipelined_alu/hw5_unit_test_design.rb +0 -61
  245. data/samp/pipelined_alu/hw5_unit_test_proto.rb +0 -7
  246. data/samp/pipelined_alu/hw5_unit_test_runner.rake +0 -52
  247. data/samp/pipelined_alu/hw5_unit_test_spec.rb +0 -68
data/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- Copyright (c) 2006-2007 Suraj N. Kurapati
1
+ Copyright 2006 Suraj N. Kurapati <snk@gna.org>
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a
4
- copy of this software and associated documentation files (the "Software"),
5
- to deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
9
 
10
- All copies and portions of the Software (together the "Derivatives") and
11
- their corresponding machine-readable source code (the "Code") must include the
12
- above copyright notice and this permission notice. The Code must reflect all
13
- modifications made to the Derivatives. The Derivatives must be distributed
14
- either with the Code or, if the Code is obtainable for no more than the cost
15
- of distribution plus a nominal fee, with information on how to obtain the Code.
10
+ 1. All modified and unmodified copies and substantial portions of the Software
11
+ (the "Derivatives") and their corresponding machine-readable source code (the
12
+ "Code") must include the above copyright notice and this permission notice.
13
+
14
+ 2. Upon distribution, the Derivatives must be accompanied either by the Code or,
15
+ if the Code is obtainable for no more than the cost of distribution plus a
16
+ nominal fee, by information on how to obtain the Code.
16
17
 
17
18
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README CHANGED
@@ -1 +1 @@
1
- Please see ./index.html or ./doc/readme.html in your Web browser.
1
+ Please see ./index.html or ./doc/readme.html in your web browser.
data/Rakefile CHANGED
@@ -2,11 +2,9 @@
2
2
  # CFLAGS:: Arguments to the compiler.
3
3
  # LDFLAGS:: Arguments to the linker.
4
4
  #--
5
- # Copyright 2006-2007 Suraj N. Kurapati
5
+ # Copyright 2006 Suraj N. Kurapati
6
6
  # See the file named LICENSE for details.
7
7
 
8
- CFLAGS, LDFLAGS = ENV['CFLAGS'], ENV['LDFLAGS']
9
-
10
8
  require 'rake/clean'
11
9
  require 'rake/rdoctask'
12
10
  require 'rake/gempackagetask'
@@ -24,21 +22,22 @@ task :default => :build
24
22
 
25
23
 
26
24
  # load project information
27
- include RubyVpi::Config
28
- PROJECT_SSH_URL = "snk@rubyforge.org:/var/www/gforge-projects/#{PROJECT_ID}"
25
+ include RubyVPI
26
+ PROJECT_SSH_URL = "snk@rubyforge.org:/var/www/gforge-projects/#{PROJECT_ID}"
29
27
 
30
28
  load 'doc/history.rb'
31
- head = @history.first
32
- PROJECT_VERSION = head['Version']
29
+ head = @history.first
30
+ PROJECT_VERSION = head['Version']
33
31
  PROJECT_BIRTHDAY = head['Date']
34
32
 
35
33
 
36
34
  # utility
37
35
 
38
- # Returns a temporary, unique path ready for use. No file exists at the
39
- # returned path.
36
+ # Returns a temporary, unique path ready for
37
+ # use. No file exists at the returned path.
40
38
  def generate_temp_path
41
- rm_f path = Tempfile.new($$).path
39
+ path = Tempfile.new($$).path
40
+ rm_f path
42
41
  path
43
42
  end
44
43
 
@@ -48,7 +47,7 @@ task :default => :build
48
47
  end
49
48
 
50
49
  # propogate cleaning tasks recursively to lower levels
51
- [:clean, :clobber].each do |t|
50
+ %w[clean clobber].each do |t|
52
51
  task t do
53
52
  files = FileList['**/Rakefile'].exclude('_darcs')
54
53
  files.shift # avoid infinite loop on _this_ file
@@ -58,7 +57,7 @@ task :default => :build
58
57
 
59
58
  files.each do |f|
60
59
  cd File.dirname(f) do
61
- sh 'rake', t.to_s
60
+ sh 'rake', t
62
61
  end
63
62
  end
64
63
  end
@@ -73,6 +72,9 @@ task :default => :build
73
72
  directory 'obj'
74
73
  CLOBBER.include 'obj'
75
74
 
75
+ ccFlags = ENV['CFLAGS']
76
+ ldFlags = ENV['LDFLAGS']
77
+
76
78
  SIMULATORS.each_pair do |id, sim|
77
79
  taskName = "build_#{id}"
78
80
 
@@ -83,8 +85,8 @@ task :default => :build
83
85
 
84
86
  unless File.exist? dst
85
87
  cd 'ext' do
86
- ENV['CFLAGS'] = "#{CFLAGS} #{sim.compiler_args}"
87
- ENV['LDFLAGS'] = "#{LDFLAGS} #{sim.linker_args}"
88
+ ENV['CFLAGS'] = "#{ccFlags} #{sim.compiler_args}"
89
+ ENV['LDFLAGS'] = "#{ldFlags} #{sim.linker_args}"
88
90
 
89
91
  sh 'rake'
90
92
  mv src, dst
@@ -120,7 +122,7 @@ task :default => :build
120
122
  desc 'Generate reference for Ruby.'
121
123
  Rake::RDocTask.new 'ref/ruby' do |t|
122
124
  t.rdoc_dir = t.name
123
- t.title = "#{PROJECT_NAME}: #{PROJECT_SUMMARY}"
125
+ t.title = "#{PROJECT_NAME}: #{PROJECT_SUMMARY}"
124
126
  t.options.concat %w(--charset utf-8 --line-numbers)
125
127
  t.rdoc_files.include '{bin,lib/**}/*.rb'
126
128
  end
@@ -200,25 +202,26 @@ task :default => :build
200
202
  end
201
203
 
202
204
  spec = Gem::Specification.new do |s|
203
- s.name = s.rubyforge_project = PROJECT_ID
204
- s.summary = PROJECT_SUMMARY
205
- s.description = PROJECT_DETAIL
206
- s.homepage = PROJECT_URL
207
- s.version = PROJECT_VERSION
208
-
209
- s.add_dependency 'rake', '>= 0.7.0'
210
- s.add_dependency 'rspec', '>= 0.7.0'
211
- s.add_dependency 'rcov', '>= 0.7.0'
212
- s.add_dependency 'xx' # needed by rcov
205
+ s.name = PROJECT_ID
206
+ s.rubyforge_project = PROJECT_ID
207
+ s.summary = PROJECT_SUMMARY
208
+ s.description = PROJECT_DETAIL
209
+ s.homepage = PROJECT_URL
210
+ s.version = PROJECT_VERSION
211
+
212
+ s.add_dependency 'rake', '>= 0.7.0'
213
+ s.add_dependency 'rspec', '>= 1.0.0'
214
+ s.add_dependency 'rcov', '>= 0.7.0'
215
+ s.add_dependency 'xx' # needed by rcov
213
216
  s.add_dependency 'ruby-debug', '>= 0.5.2'
214
217
 
215
218
  s.requirements << "POSIX threads library"
216
219
  s.requirements << "C language compiler"
217
220
 
218
- s.files = FileList['**/*'].exclude('_darcs')
221
+ s.files = FileList['**/*'].exclude('_darcs')
219
222
  s.autorequire = PROJECT_ID
220
223
  s.extensions << 'gem_extconf.rb'
221
- s.executables = FileList['bin/*.rb'].map {|f| File.basename f}
224
+ s.executables = PROJECT_ID
222
225
  end
223
226
 
224
227
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -231,9 +234,9 @@ task :default => :build
231
234
  desc "Configures the gem during installation."
232
235
  task :gem_config_inst do |t|
233
236
  # make documentation available to gem_server
234
- gemDir = File.dirname(__FILE__)
237
+ gemDir = File.dirname(__FILE__)
235
238
  gemName = File.basename(gemDir)
236
- docDir = File.join('..', '..', 'doc', gemName)
239
+ docDir = File.join('..', '..', 'doc', gemName)
237
240
 
238
241
  mkdir_p docDir
239
242
  ln_s gemDir, File.join(docDir, 'rdoc')
@@ -247,9 +250,9 @@ task :default => :build
247
250
  # ensures that current sources are tested instead of the installed gem
248
251
  ENV['RUBYLIB'] = PROJECT_LIBS
249
252
 
250
- FileList['samp/*/'].each do |s|
251
- cd s do
252
- sh 'rake', ENV['SIMULATOR'] || 'cver'
253
+ FileList['samp/**/*.rake'].each do |runner|
254
+ cd File.dirname(runner) do
255
+ sh 'rake', '-f', File.basename(runner), ENV['SIMULATOR'] || 'cver'
253
256
  end
254
257
  end
255
258
  end
data/bin/convert.rb ADDED
@@ -0,0 +1,28 @@
1
+ # Converts Verilog source code into Ruby.
2
+ # * The standard input stream is read if no input files are specified.
3
+ # * Output is written to the standard output stream.
4
+
5
+ #--
6
+ # Copyright 2006 Suraj N. Kurapati
7
+ # See the file named LICENSE for details.
8
+
9
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
10
+
11
+ # parse command-line options
12
+ require 'optparse'
13
+
14
+ opts = OptionParser.new
15
+ opts.banner = "Usage: ruby-vpi convert [options] [files]"
16
+
17
+ opts.on '-h', '--help', 'show this help message' do
18
+ require 'ruby-vpi/rdoc'
19
+ RDoc.usage_from_file __FILE__
20
+
21
+ puts opts
22
+ exit
23
+ end
24
+
25
+ opts.parse! ARGV
26
+
27
+ require 'ruby-vpi/verilog_parser'
28
+ puts ARGF.read.verilog_to_ruby
@@ -0,0 +1,16 @@
1
+ <% clock = aModuleInfo.clock_port.name rescue "YOUR_CLOCK_SIGNAL_HERE" %>
2
+ # Simulates the design under test for one clock cycle.
3
+ def cycle!
4
+ <%= clock %>.high!
5
+ advance_time
6
+ <%= clock %>.low!
7
+ advance_time
8
+ end
9
+
10
+ <% reset = aModuleInfo.reset_port.name rescue "YOUR_RESET_SIGNAL_HERE" %>
11
+ # Brings the design under test into a blank state.
12
+ def reset!
13
+ <%= reset %>.high!
14
+ cycle!
15
+ <%= reset %>.low!
16
+ end
@@ -0,0 +1,13 @@
1
+ # Ruby prototype of the design under test's Verilog implementation.
2
+ def feign!
3
+ if <%= aModuleInfo.clock_port.name rescue "YOUR_CLOCK_SIGNAL_HERE" %>.posedge?
4
+ # discard old outputs
5
+ <% aModuleInfo.output_ports.each do |port| %>
6
+ <%= port.name %>.x!
7
+ <% end %>
8
+
9
+ # process new inputs
10
+
11
+ # produce new outputs
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ # Array of paths and shell globs (see the Dir.glob method's documentation for
2
+ # details) to source files and directories that contain source files. These
3
+ # source files will be loaded by the simulator before the simulation begins.
4
+ SIMULATOR_SOURCES = FileList[
5
+ '<%= aModuleInfo.name %>.v',
6
+ ]
7
+
8
+ # Command-line arguments for the simulator. These arguments can be
9
+ # specified as a string or an array of strings, as demonstrated below:
10
+ #
11
+ # :cver => "this is a single string argument",
12
+ # :cver => ["these", "are", "separate", "arguments"],
13
+ # :cver => %w[these are also separate arguments],
14
+ #
15
+ SIMULATOR_ARGUMENTS = {
16
+ <% RubyVPI::SIMULATORS.each_pair do |id, sim| %>
17
+ # <%= sim.name %>
18
+ :<%= id %> => "",
19
+
20
+ <% end %>
21
+ }
22
+
23
+ # This task is invoked before the simulator runs. It
24
+ # can be used to make preprations, such as converting
25
+ # Verilog header files into Ruby, for the simulation.
26
+ task :setup do
27
+ # To learn how to write Rake tasks, please see:
28
+ # http://docs.rubyrake.org/read/chapter/4#page16
29
+ end
30
+
31
+ # This command loads the Ruby-VPI runner template,
32
+ # which runs the simulator using the above parameters.
33
+ require 'ruby-vpi/runner'
@@ -0,0 +1,45 @@
1
+ <% dut = aOutputInfo.designClassName %>
2
+
3
+ <% case aOutputInfo.specFormat %>
4
+ <% when :xUnit %>
5
+ require 'test/unit'
6
+
7
+ class <%= aOutputInfo.specClassName %> < Test::Unit::TestCase
8
+ def setup
9
+ <%= dut %>.reset!
10
+ end
11
+ <% aModuleInfo.ports.each do |port| %>
12
+
13
+ def test_<%= port.name %>
14
+ # assert <%= dut %>.<%= port.name %> ..., "<%= port.name %> should ..."
15
+ end
16
+ <% end %>
17
+ end
18
+ <% when :tSpec %>
19
+ require 'test/spec'
20
+
21
+ context "A resetted <%= dut %>" do
22
+ setup do
23
+ <%= dut %>.reset!
24
+ end
25
+
26
+ specify "should ..." do
27
+ # <%= dut %>.should ...
28
+ end
29
+ end
30
+ <% when :rSpec %>
31
+ require 'spec'
32
+
33
+ describe <%= dut %>, " when resetted" do
34
+ before do
35
+ <%= dut %>.reset!
36
+ end
37
+
38
+ it "should ..." do
39
+ # <%= dut %>.should ...
40
+ end
41
+ end
42
+ <% else %>
43
+ <%= dut %>.reset!
44
+ # raise "should ..." unless <%= dut %> ...
45
+ <% end %>
data/bin/generate.rb ADDED
@@ -0,0 +1,177 @@
1
+ # Generates Ruby-VPI tests from Verilog 2001 and Verilog 95 module declarations.
2
+ #
3
+ # * The standard input stream is read if no input files are specified.
4
+ #
5
+ # = Progress indicators
6
+ #
7
+ # module:: A Verilog module has been identified.
8
+ #
9
+ # create:: A file is being created because it does not exist.
10
+ #
11
+ # skip:: A file is being skipped because it is already up to date.
12
+ #
13
+ # update:: A file will be updated because it is out of date. A text
14
+ # merging tool (see MERGER) will be launched to transfer
15
+ # content from the old file (*.old) and the new file (*.new)
16
+ # to the out of date file. If a text merging tool is not
17
+ # specified, then you will have to do the merging by hand.
18
+ #
19
+ #
20
+ # = Environment variables
21
+ #
22
+ # MERGER:: A command that invokes a text merging tool with three
23
+ # arguments: (1) old file, (2) new file, (3) output file.
24
+ # The tool's output should be written to the output file.
25
+
26
+ #--
27
+ # Copyright 2006-2007 Suraj N. Kurapati
28
+ # See the file named LICENSE for details.
29
+
30
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
31
+
32
+ require 'ruby-vpi' # for project info
33
+ require 'ruby-vpi/verilog_parser'
34
+ require 'fileutils'
35
+ require 'digest/md5'
36
+
37
+
38
+ # Notify the user about some action being performed.
39
+ def notify *args # :nodoc:
40
+ printf "%8s %s\n", *args
41
+ end
42
+
43
+ # Writes the given contents to the file at the given path. If the given path
44
+ # already exists, then a backup is created before invoking the merging tool.
45
+ def write_file aPath, aContent # :nodoc:
46
+ if File.exist? aPath
47
+ oldDigest = Digest::MD5.digest(File.read(aPath))
48
+ newDigest = Digest::MD5.digest(aContent)
49
+
50
+ if oldDigest == newDigest
51
+ notify :skip, aPath
52
+ else
53
+ notify :update, aPath
54
+ cur, old, new = aPath, "#{aPath}.old", "#{aPath}.new"
55
+
56
+ FileUtils.cp cur, old, :preserve => true
57
+ File.open(new, 'w') {|f| f << aContent}
58
+
59
+ if m = ENV['MERGER']
60
+ system "#{m} #{old.inspect} #{new.inspect} #{cur.inspect}"
61
+ end
62
+ end
63
+ else
64
+ notify :create, aPath
65
+ File.open(aPath, 'w') {|f| f << aContent}
66
+ end
67
+ end
68
+
69
+
70
+ require 'ruby-vpi/erb'
71
+
72
+ # Template used for generating output.
73
+ class Template < ERB # :nodoc:
74
+ TEMPLATE_PATH = __FILE__.sub(/\.rb$/, '')
75
+
76
+ def initialize aName
77
+ super File.read(File.join(TEMPLATE_PATH, aName))
78
+ end
79
+ end
80
+
81
+
82
+ # Holds information about the output destinations of a parsed Verilog module.
83
+ class OutputInfo # :nodoc:
84
+ RUBY_EXT = '.rb'
85
+ VERILOG_EXT = '.v'
86
+ RUNNER_EXT = '.rake'
87
+
88
+ DESIGN_SUFFIX = '_design'
89
+ SPEC_SUFFIX = '_spec'
90
+ RUNNER_SUFFIX = '_runner'
91
+ PROTO_SUFFIX = '_proto'
92
+
93
+ SPEC_FORMATS = [:rSpec, :tSpec, :xUnit, :generic]
94
+
95
+ attr_reader :designPath, :designName, :designClassName,
96
+ :specPath, :specName, :specClassName, :specFormat,
97
+ :runnerPath, :runnerName,
98
+ :protoPath, :protoName
99
+
100
+ def initialize aModuleName, aSpecFormat
101
+ raise ArgumentError unless SPEC_FORMATS.include? aSpecFormat
102
+ @specFormat = aSpecFormat
103
+
104
+ @designName = aModuleName + DESIGN_SUFFIX
105
+ @designPath = @designName + RUBY_EXT
106
+
107
+ @protoName = aModuleName + PROTO_SUFFIX
108
+ @protoPath = @protoName + RUBY_EXT
109
+
110
+ @specName = aModuleName + SPEC_SUFFIX
111
+ @specPath = @specName + RUBY_EXT
112
+
113
+ @designClassName = aModuleName.to_ruby_const_name
114
+ @specClassName = @specName.to_ruby_const_name
115
+
116
+ @runnerName = aModuleName + RUNNER_SUFFIX
117
+ @runnerPath = @runnerName + RUNNER_EXT
118
+ end
119
+ end
120
+
121
+
122
+ # obtain templates for output generation
123
+ DESIGN_TEMPLATE = Template.new('design.rb')
124
+ PROTO_TEMPLATE = Template.new('proto.rb')
125
+ SPEC_TEMPLATE = Template.new('spec.rb')
126
+ RUNNER_TEMPLATE = Template.new('runner.rake')
127
+
128
+
129
+ # parse command-line options
130
+ require 'optparse'
131
+
132
+ optSpecFmt = :generic
133
+ optTestName = 'test'
134
+
135
+ opts = OptionParser.new
136
+ opts.banner = "Usage: ruby-vpi generate [options] [files]"
137
+
138
+ opts.on '-h', '--help', 'show this help message' do
139
+ require 'ruby-vpi/rdoc'
140
+ RDoc.usage_from_file __FILE__
141
+
142
+ puts opts
143
+ exit
144
+ end
145
+
146
+ opts.on '--xUnit',
147
+ 'use xUnit (Test::Unit) specification format' do
148
+ optSpecFmt = :xUnit
149
+ end
150
+
151
+ opts.on '--rSpec',
152
+ 'use rSpec specification format' do
153
+ optSpecFmt = :rSpec
154
+ end
155
+
156
+ opts.on '--tSpec',
157
+ 'use test/spec specification format' do
158
+ optSpecFmt = :tSpec
159
+ end
160
+
161
+ opts.parse! ARGV
162
+
163
+
164
+ v = VerilogParser.new(ARGF.read)
165
+ v.modules.each do |m|
166
+ puts
167
+ notify :module, m.name
168
+
169
+ o = OutputInfo.new(m.name, optSpecFmt)
170
+ aParseInfo, aModuleInfo, aOutputInfo = v.freeze, m.freeze, o.freeze
171
+
172
+ write_file o.runnerPath, RUNNER_TEMPLATE.result(binding)
173
+ write_file o.designPath, DESIGN_TEMPLATE.result(binding)
174
+ write_file o.protoPath, PROTO_TEMPLATE.result(binding)
175
+ write_file o.specPath, SPEC_TEMPLATE.result(binding)
176
+ write_file 'Rakefile', "require 'ruby-vpi/runner_proxy'"
177
+ end
data/bin/ruby-vpi ADDED
@@ -0,0 +1,56 @@
1
+ # This is a front-end for tools provided by Ruby-VPI.
2
+ #
3
+ # Usage:
4
+ # ruby-vpi Show this help message
5
+ # ruby-vpi TOOL --help Show help message for TOOL
6
+ # ruby-vpi TOOL arguments... Run TOOL with some arguments
7
+
8
+ #--
9
+ # Copyright 2006 Suraj N. Kurapati
10
+ # See the file named LICENSE for details.
11
+
12
+ TOOL_DIR = File.dirname(__FILE__)
13
+ TOOL_EXT = '.rb'
14
+
15
+ $: << File.join(TOOL_DIR, '..', 'lib')
16
+
17
+
18
+ def show_help_info
19
+ require 'ruby-vpi/rdoc'
20
+ RDoc.usage_from_file __FILE__
21
+
22
+ # show a list of available tools
23
+ puts "Tools:"
24
+
25
+ Dir[File.join(TOOL_DIR, "*#{TOOL_EXT}")].each do |file|
26
+ tool = File.basename file, TOOL_EXT
27
+ printf " %-10s %s", tool, File.new(file).readline.sub(/^#\s*/, '')
28
+ end
29
+
30
+ puts
31
+
32
+ # show a list of available simulators
33
+ require 'ruby-vpi'
34
+ puts "Simulators:"
35
+
36
+ RubyVPI::SIMULATORS.each_pair do |id, sim|
37
+ printf " %-10s %s\n", id, sim.name
38
+ end
39
+ end
40
+
41
+
42
+ unless ARGV.empty?
43
+ tool = ARGV.shift
44
+ glob = File.join(TOOL_DIR, tool + '*' + TOOL_EXT)
45
+ file = Dir[glob].first
46
+
47
+ begin
48
+ load file
49
+ rescue LoadError
50
+ show_help_info
51
+ puts '', '#' * 76
52
+ raise "Invalid tool: #{tool.inspect}"
53
+ end
54
+ else
55
+ show_help_info
56
+ end
data/doc/Rakefile CHANGED
@@ -8,18 +8,31 @@ require 'rake/clean'
8
8
 
9
9
  $: << File.join(File.dirname(__FILE__), '..', 'lib')
10
10
  require 'ruby-vpi'
11
- include RubyVpi::Config
11
+ include RubyVPI
12
+
12
13
  HISTORY_URL = WEBSITE_URL + "/history.html"
13
14
  RSS_URL = WEBSITE_URL + '/rss.xml'
14
15
  RSS_INFO = "RSS feed for this project."
15
16
 
16
17
  require 'ruby-vpi/erb'
18
+ include ERB::Util
17
19
 
18
20
 
19
21
  $: << File.join(File.dirname(__FILE__), 'lib')
20
22
  require 'doc_proxy'
21
23
 
22
24
 
25
+ def resolve_includes aFilePath
26
+ input = File.read(aFilePath)
27
+
28
+ input.gsub! %r{<doc_proxy_include *(.*?)>} do
29
+ resolve_includes($1)
30
+ end
31
+
32
+ input
33
+ end
34
+
35
+
23
36
  FileList['*.doc'].each do |src|
24
37
  prefix = File.basename(src, File.extname(src))
25
38
  helper = prefix + '.rb'
@@ -28,7 +41,7 @@ FileList['*.doc'].each do |src|
28
41
 
29
42
  desc "Process file #{src.inspect}."
30
43
  file dst => [src, 'common.tpl', *deps] do |t|
31
- String.reset_anchors
44
+ puts src
32
45
 
33
46
  content = DocProxy.new.instance_eval do
34
47
  # default output configuration
@@ -41,10 +54,14 @@ FileList['*.doc'].each do |src|
41
54
  end
42
55
 
43
56
  # evaluate the documentation file
44
- template = ERB.new(File.read(src))
57
+ input = resolve_includes(src)
58
+ File.open('input', 'w') {|f| f << input} if $DEBUG
59
+
60
+ template = ERB.new(input)
45
61
  content = template.result(binding)
46
62
  toc, content = post_process(content)
47
63
 
64
+
48
65
  # fit result into common HTML format
49
66
  template = ERB.new(File.read(t.prerequisites[1]))
50
67
  template.result(binding)
@@ -52,7 +69,6 @@ FileList['*.doc'].each do |src|
52
69
 
53
70
  File.open(dst, 'w') do |f|
54
71
  f << content
55
- puts f.path
56
72
  end
57
73
  end
58
74