ruby-vpi 11.1.1 → 12.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/bin/generate_test.rb +12 -11
  2. data/bin/generate_test_tpl/bench.rb +0 -4
  3. data/bin/generate_test_tpl/bench.v +3 -6
  4. data/bin/generate_test_tpl/runner.rake +20 -4
  5. data/bin/generate_test_tpl/spec.rb +5 -7
  6. data/doc/common.css +110 -95
  7. data/doc/common.tpl +16 -17
  8. data/doc/history.html +350 -330
  9. data/doc/history.yml +49 -0
  10. data/doc/intro.inc +18 -4
  11. data/doc/lib/doc_proxy.rb +22 -32
  12. data/doc/manual.erb +90 -83
  13. data/doc/manual.html +298 -266
  14. data/doc/memo.html +31 -10
  15. data/doc/readme.html +26 -6
  16. data/ext/relay.c +24 -28
  17. data/ext/vlog.c +4 -15
  18. data/lib/ruby-vpi/rspec.rb +1 -1
  19. data/lib/ruby-vpi/runner.rb +12 -10
  20. data/lib/ruby-vpi/runner_proxy.rb +17 -6
  21. data/lib/ruby-vpi/verilog_parser.rb +11 -7
  22. data/lib/ruby-vpi/vpi.rb +11 -1
  23. data/lib/ruby-vpi.rb +4 -0
  24. data/ref/c/annotated.html +2 -2
  25. data/ref/c/common_8h.html +1 -1
  26. data/ref/c/files.html +1 -1
  27. data/ref/c/functions.html +1 -1
  28. data/ref/c/functions_vars.html +1 -1
  29. data/ref/c/globals.html +1 -1
  30. data/ref/c/globals_0x63.html +1 -1
  31. data/ref/c/globals_0x65.html +1 -1
  32. data/ref/c/globals_0x66.html +1 -1
  33. data/ref/c/globals_0x70.html +1 -1
  34. data/ref/c/globals_0x72.html +1 -1
  35. data/ref/c/globals_0x73.html +1 -1
  36. data/ref/c/globals_0x74.html +1 -1
  37. data/ref/c/globals_0x76.html +2 -2
  38. data/ref/c/globals_0x78.html +1 -1
  39. data/ref/c/globals_defs.html +1 -1
  40. data/ref/c/globals_defs_0x65.html +1 -1
  41. data/ref/c/globals_defs_0x70.html +1 -1
  42. data/ref/c/globals_defs_0x76.html +2 -2
  43. data/ref/c/globals_defs_0x78.html +1 -1
  44. data/ref/c/globals_enum.html +1 -1
  45. data/ref/c/globals_eval.html +1 -1
  46. data/ref/c/globals_func.html +2 -2
  47. data/ref/c/globals_type.html +1 -1
  48. data/ref/c/globals_vars.html +1 -1
  49. data/ref/c/index.html +1 -1
  50. data/ref/c/relay_8c.html +2 -1
  51. data/ref/c/relay_8h.html +1 -1
  52. data/ref/c/structrelay____RubyOptions____def.html +8 -2
  53. data/ref/c/structt__cb__data.html +1 -1
  54. data/ref/c/structt__vpi__delay.html +1 -1
  55. data/ref/c/structt__vpi__error__info.html +1 -1
  56. data/ref/c/structt__vpi__strengthval.html +1 -1
  57. data/ref/c/structt__vpi__systf__data.html +1 -1
  58. data/ref/c/structt__vpi__time.html +1 -1
  59. data/ref/c/structt__vpi__value.html +1 -1
  60. data/ref/c/structt__vpi__vecval.html +1 -1
  61. data/ref/c/structt__vpi__vlog__info.html +1 -1
  62. data/ref/c/swig_8c.html +1 -1
  63. data/ref/c/swig_8h.html +1 -1
  64. data/ref/c/verilog_8h.html +1 -1
  65. data/ref/c/vlog_8c.html +15 -15
  66. data/ref/c/vlog_8h.html +1 -1
  67. data/ref/c/vpi__user_8h.html +1 -1
  68. data/ref/ruby/classes/OutputInfo.html +1 -1
  69. data/ref/ruby/classes/OutputInfo.src/M000030.html +30 -30
  70. data/ref/ruby/classes/RDoc.html +5 -5
  71. data/ref/ruby/classes/RDoc.src/{M000097.html → M000099.html} +0 -0
  72. data/ref/ruby/classes/RubyVpi.src/M000085.html +43 -39
  73. data/ref/ruby/classes/String.src/M000033.html +26 -26
  74. data/ref/ruby/classes/String.src/M000034.html +4 -4
  75. data/ref/ruby/classes/Template.src/M000032.html +4 -4
  76. data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000011.html +5 -5
  77. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000007.html +7 -7
  78. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000008.html +4 -4
  79. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000009.html +4 -4
  80. data/ref/ruby/classes/VerilogParser/Module/Port.src/M000010.html +4 -4
  81. data/ref/ruby/classes/VerilogParser/Module.src/M000006.html +15 -11
  82. data/ref/ruby/classes/Vpi/Handle/Property.html +5 -5
  83. data/ref/ruby/classes/Vpi/Handle/Property.src/{M000096.html → M000098.html} +61 -61
  84. data/ref/ruby/classes/Vpi/Handle.html +78 -43
  85. data/ref/ruby/classes/Vpi/Handle.src/M000088.html +3 -3
  86. data/ref/ruby/classes/Vpi/Handle.src/M000089.html +4 -8
  87. data/ref/ruby/classes/Vpi/Handle.src/M000090.html +5 -31
  88. data/ref/ruby/classes/Vpi/Handle.src/M000091.html +9 -74
  89. data/ref/ruby/classes/Vpi/Handle.src/M000092.html +31 -17
  90. data/ref/ruby/classes/Vpi/Handle.src/M000093.html +74 -11
  91. data/ref/ruby/classes/Vpi/Handle.src/M000094.html +30 -0
  92. data/ref/ruby/classes/Vpi/Handle.src/M000095.html +11 -55
  93. data/ref/ruby/classes/Vpi/Handle.src/M000097.html +68 -0
  94. data/ref/ruby/created.rid +1 -1
  95. data/ref/ruby/files/bin/generate_test_rb.html +8 -11
  96. data/ref/ruby/files/bin/generate_test_rb.src/M000001.html +4 -4
  97. data/ref/ruby/files/bin/generate_test_rb.src/M000002.html +22 -24
  98. data/ref/ruby/files/bin/header_to_ruby_rb.html +1 -1
  99. data/ref/ruby/files/lib/ruby-vpi/float_rb.html +1 -1
  100. data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +1 -1
  101. data/ref/ruby/files/lib/ruby-vpi/rspec_rb.html +1 -1
  102. data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +1 -1
  103. data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +2 -2
  104. data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000003.html +10 -10
  105. data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000004.html +12 -12
  106. data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +1 -1
  107. data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +1 -1
  108. data/ref/ruby/files/lib/ruby-vpi_rb.html +2 -1
  109. data/ref/ruby/fr_method_index.html +20 -18
  110. data/samp/counter/counter_rspec_bench.v +3 -6
  111. data/samp/counter/counter_rspec_design.rb +2 -1
  112. data/samp/counter/counter_rspec_runner.rake +20 -4
  113. data/samp/counter/counter_rspec_spec.rb +4 -4
  114. data/samp/counter/counter_xunit_bench.v +3 -6
  115. data/samp/counter/counter_xunit_design.rb +2 -1
  116. data/samp/counter/counter_xunit_runner.rake +20 -4
  117. data/samp/pipelined_alu/hw5_unit_test_bench.v +3 -6
  118. data/samp/pipelined_alu/hw5_unit_test_runner.rake +20 -4
  119. metadata +21 -20
  120. data/doc/manual.rb +0 -5
data/bin/generate_test.rb CHANGED
@@ -5,13 +5,12 @@
5
5
  #
6
6
  # = Progress indicators
7
7
  # module:: A Verilog module has been identified.
8
- # backup:: A backup copy of a file is being made.
9
8
  # create:: A file is being created because it does not exist.
10
9
  # skip:: A file is being skipped because it is already up to date.
11
- # update:: A file will be updated because it is out of date. A backup copy will be made before the file is updated. Use a text merging tool (see MERGER) or manually transfer any necessary information from the backup copy to the updated file.
10
+ # update:: A file will be updated because it is out of date. A text merging tool (see MERGER) will be launched to transfer content from the old file (*.old) and the new file (*.new) to the out of date file. If a text merging tool is not specified, then you will have to do the merging by hand.
12
11
  #
13
12
  # = Environment variables
14
- # MERGER:: A command that invokes a text merging tool with two arguments: (1) old file, (2) new file. The tool's output should be written to the new file.
13
+ # MERGER:: A command that invokes a text merging tool with three arguments: (1) old file, (2) new file, (3) output file. The tool's output should be written to the output file.
15
14
 
16
15
 
17
16
  =begin
@@ -53,16 +52,14 @@ def write_file aPath, aContent
53
52
  if oldDigest == newDigest
54
53
  notify :skip, aPath
55
54
  else
56
- old, new = "#{aPath}.old", aPath
57
-
58
- notify :backup, old
59
- FileUtils.cp aPath, old, :preserve => true
60
-
61
55
  notify :update, aPath
56
+ cur, old, new = aPath, "#{aPath}.old", "#{aPath}.new"
57
+
58
+ FileUtils.cp cur, old, :preserve => true
62
59
  File.open(new, 'w') {|f| f << aContent}
63
60
 
64
61
  if m = ENV['MERGER']
65
- system "#{m} #{old.inspect} #{new.inspect}"
62
+ system "#{m} #{old.inspect} #{new.inspect} #{cur.inspect}"
66
63
  end
67
64
  end
68
65
  else
@@ -91,7 +88,7 @@ class OutputInfo
91
88
  VERILOG_EXT = '.v'
92
89
  RUNNER_EXT = '.rake'
93
90
 
94
- SPEC_FORMATS = [:rSpec, :xUnit, :generic]
91
+ SPEC_FORMATS = [:rSpec, :tSpec, :xUnit, :generic]
95
92
 
96
93
  attr_reader :verilogBenchName, :verilogBenchPath, :rubyBenchName, :rubyBenchPath, :designName, :designClassName, :designPath, :specName, :specClassName, :specFormat, :specPath, :rubyVpiPath, :runnerName, :runnerPath, :protoName, :protoPath
97
94
 
@@ -163,7 +160,7 @@ if File.basename($0) == File.basename(__FILE__)
163
160
  exit
164
161
  end
165
162
 
166
- opts.on '--xunit', 'use xUnit specification format' do |val|
163
+ opts.on '--xunit', '--test-unit', 'use xUnit (Test::Unit) specification format' do |val|
167
164
  optSpecFmt = :xUnit if val
168
165
  end
169
166
 
@@ -171,6 +168,10 @@ if File.basename($0) == File.basename(__FILE__)
171
168
  optSpecFmt = :rSpec if val
172
169
  end
173
170
 
171
+ opts.on '--tspec', '--test-spec', 'use test/spec specification format' do |val|
172
+ optSpecFmt = :tSpec if val
173
+ end
174
+
174
175
  opts.on '-n', '--name NAME', 'insert NAME into the names of generated files' do |val|
175
176
  optTestName = val
176
177
  end
@@ -2,7 +2,3 @@
2
2
 
3
3
  require 'ruby-vpi'
4
4
  RubyVpi.init_bench :<%= aOutputInfo.designClassName %>, :<%= aOutputInfo.specFormat %>
5
- <% if aOutputInfo.specFormat == :generic %>
6
-
7
- <%= aOutputInfo.specClassName + '.new' %>
8
- <% end %>
@@ -30,16 +30,13 @@ module <%= aOutputInfo.verilogBenchName %>;
30
30
 
31
31
  // connect to the Ruby side of this bench
32
32
  initial begin
33
- <%= clockSignal %> = 0;
34
- $ruby_init("ruby", "-w", "-rubygems", <%= aOutputInfo.rubyBenchPath.inspect %>);
33
+ $ruby_init("ruby", "-rubygems", <%= aOutputInfo.rubyBenchPath.inspect %>);
35
34
  end
36
35
 
37
36
  always begin
38
- #5 <%= clockSignal %> = ~<%= clockSignal %>;
39
- end
40
-
41
- always @(posedge <%= clockSignal %>) begin
37
+ #1 <%= clockSignal %> = 0;
42
38
  #1 $ruby_relay;
39
+ #1 <%= clockSignal %> = 1;
43
40
  end
44
41
 
45
42
  endmodule
@@ -1,21 +1,27 @@
1
1
  # This file runs the test.
2
2
 
3
- # These are source files that are to be compiled.
3
+ # These are Verilog source files that need to be loaded
4
+ # by the simulator before they can be simulated.
4
5
  SIMULATOR_SOURCES = [
5
6
  '<%= aModuleInfo.name %>.v',
6
7
  '<%= aOutputInfo.verilogBenchPath %>',
7
8
  ]
8
9
 
9
10
  # These are paths to directories which contain the
10
- # sources listed above, their dependencies, or both.
11
+ # sources listed above, the files they `include, or both.
11
12
  SIMULATOR_INCLUDES = []
12
13
 
13
14
  # This specifies the "top module" that is to be simulated.
14
15
  SIMULATOR_TARGET = '<%= aOutputInfo.verilogBenchName %>'
15
16
 
16
17
  # These are command-line arguments for the simulator.
17
- # They can be specified as a string or an array of strings.
18
- SIMULATOR_ARGS = {
18
+ # They can be specified as a string or an array of strings:
19
+ #
20
+ # :cver => "this is one single argument",
21
+ # :cver => ['these', 'are', 'separate', 'arguments'],
22
+ # :cver => %w[these are also separate arguments],
23
+ #
24
+ SIMULATOR_ARGUMENTS = {
19
25
  # GPL Cver
20
26
  :cver => '',
21
27
 
@@ -29,4 +35,14 @@ SIMULATOR_ARGS = {
29
35
  :vsim => '',
30
36
  }
31
37
 
38
+ # This task is invoked _before_ the simulator runs.
39
+ # It can be used to make preprations, such as converting
40
+ # Verilog header files into Ruby, for the simulation.
41
+ task :setup do
42
+ # To learn how to write Rake tasks, please see:
43
+ # http://docs.rubyrake.org/read/chapter/4#page16
44
+ end
45
+
46
+ # This command loads the Ruby-VPI runner template, which
47
+ # runs the simulator according to the information above.
32
48
  require 'ruby-vpi/runner'
@@ -11,13 +11,14 @@ class <%= aOutputInfo.specClassName %> < Test::Unit::TestCase
11
11
  <% aModuleInfo.ports.each do |port| %>
12
12
 
13
13
  def test_<%= port.name %>
14
+ # assert <%= aOutputInfo.designClassName %>.<%= port.name %> ..., "<%= port.name %> should ..."
14
15
  end
15
16
  <% end %>
16
17
  end
17
18
  <%
18
- when :rSpec
19
+ when :rSpec, :tSpec
19
20
  %>
20
- context "A new <%= aOutputInfo.designClassName %>" do
21
+ context "A resetted <%= aOutputInfo.designClassName %>" do
21
22
  setup do
22
23
  <%= aOutputInfo.designClassName %>.reset!
23
24
  end
@@ -29,11 +30,8 @@ end
29
30
  <%
30
31
  else
31
32
  %>
32
- class <%= aOutputInfo.specClassName %>
33
- def initialize
34
- <%= aOutputInfo.designClassName %>.reset!
35
- end
36
- end
33
+ <%= aOutputInfo.designClassName %>.reset!
34
+ # raise "should ..." unless <%= aOutputInfo.designClassName %> ...
37
35
  <%
38
36
  end
39
37
  %>
data/doc/common.css CHANGED
@@ -2,141 +2,156 @@ body {
2
2
  font-family: sans-serif;
3
3
  line-height: 2em;
4
4
 
5
- margin-left: 30%;
6
- margin-right: 10%;
5
+ margin-left: 275px;
6
+ margin-right: 50px;
7
7
  margin-bottom: 5em;
8
+ max-width: 600px;
8
9
  }
9
10
 
11
+
10
12
  /* headings */
11
- th, h1, h2, h3, h4, h5, h6, .title {
12
- font-family: serif;
13
- }
14
13
 
15
- h1, h2, h3, h4, h5, h6 {
16
- margin-top: 5em;
17
- padding: 0.5em;
18
- }
14
+ th, h1, h2, h3, h4, h5, h6, .title {
15
+ font-family: serif;
16
+ }
19
17
 
20
- h1, h2, h3 {
21
- text-align: center;
22
- }
18
+ h1, h2, h3, h4, h5, h6 {
19
+ margin-top: 5em;
20
+ padding: 0.5em;
21
+ }
23
22
 
24
- h1 {
25
- padding: 1em;
26
- background-color: mistyrose;
27
- }
23
+ h1, h2, h3 {
24
+ text-align: center;
25
+ }
28
26
 
29
- h2 {
30
- background-color: bisque;
31
- }
27
+ h1 {
28
+ padding: 1em;
29
+ background-color: mistyrose;
30
+ }
31
+
32
+ h2 {
33
+ background-color: bisque;
34
+ }
35
+
36
+ h3 {
37
+ background-color: oldlace;
38
+ }
32
39
 
33
- h3 {
34
- background-color: oldlace;
35
- }
36
40
 
37
41
  /* table of contents */
38
42
 
39
- #navigation {
40
- position: fixed;
41
- left: 0px;
42
- top: 0px;
43
- bottom: 0px;
43
+ #navigation {
44
+ position: fixed;
45
+ left: 0px;
46
+ top: 0px;
47
+ bottom: 0px;
44
48
 
45
- width: 20%;
46
- padding: 1em;
47
- overflow: auto;
49
+ max-width: 200px;
50
+ padding: 1em;
51
+ overflow: auto;
48
52
 
49
- background-color: white;
50
- }
53
+ background-color: white;
54
+ }
51
55
 
52
- #navigation li {
53
- margin-left: -1em;
54
- }
56
+ #navigation h1, #navigation h2, #navigation h3, #navigation h4, #navigation h5, #navigation h6 {
57
+ font-size: smaller;
58
+ }
59
+
60
+ #navigation li {
61
+ margin-left: -1.25em;
62
+ }
55
63
 
56
- #navigation h1 {
57
- padding: 0.5em;
58
- margin-top: 0px;
59
- }
60
64
 
61
65
  /* admonitions */
62
- .admonition {
63
- border: thin solid steelblue;
64
- background-color: aliceblue;
65
- padding: 1em;
66
- }
67
66
 
68
- .admonition img {
69
- margin-right: 2em;
70
- }
67
+ .admonition {
68
+ border: thin solid steelblue;
69
+ background-color: aliceblue;
70
+ padding: 1em;
71
+ padding-top: 0px;
72
+ }
73
+
74
+ .admonition img {
75
+ margin-right: 2em;
76
+ }
77
+
71
78
 
72
79
  /* source code */
73
- tt {
74
- font-weight: bold;
75
- background-color: lemonchiffon;
76
- }
77
80
 
78
- pre, blockquote .code {
79
- padding: 1em;
80
- line-height: normal;
81
- overflow: auto;
82
- display: block;
83
- }
81
+ tt {
82
+ font-weight: bold;
83
+ background-color: lemonchiffon;
84
+ }
84
85
 
85
- pre {
86
- border: thin solid darkgray;
87
- background-color: whitesmoke;
88
- }
86
+ pre, blockquote .code {
87
+ padding: 1em;
88
+ line-height: normal;
89
+ overflow: auto;
90
+ display: block;
91
+ }
89
92
 
90
- .code {
91
- border: thin solid darkkhaki;
92
- background-color: ivory;
93
- }
93
+ pre {
94
+ border: thin solid darkgray;
95
+ background-color: whitesmoke;
96
+ }
97
+
98
+ .code {
99
+ border: thin solid darkkhaki;
100
+ background-color: ivory;
101
+ }
94
102
 
95
103
 
96
104
  /* tables */
97
- th, td {
98
- padding: 1em;
99
- border: thin solid silver;
100
- }
101
105
 
102
- th {
103
- background-color: whitesmoke;
104
- }
106
+ th, td {
107
+ padding: 1em;
108
+ border: thin solid silver;
109
+ }
110
+
111
+ th {
112
+ background-color: whitesmoke;
113
+ }
114
+
105
115
 
106
116
  /* formal blocks; see http://www.sagehill.net/docbookxsl/FormalTitles.html */
107
- .formal {
108
- margin: 1em;
109
- }
110
117
 
111
- .title {
112
- display: block;
113
- font-size: large;
114
- }
118
+ .formal {
119
+ margin: 1em;
120
+ }
115
121
 
116
- .formal .title {
117
- text-align: center
118
- }
122
+ .title {
123
+ display: block;
124
+ font-size: large;
125
+ }
119
126
 
120
- /* center-align any tables and images */
121
- .formal table, .formal img, #navigation img {
122
- margin-left: auto;
123
- margin-right: auto;
124
- }
127
+ .formal .title {
128
+ text-align: center
129
+ }
125
130
 
126
- .formal img, #navigation img {
127
- display: block;
128
- }
129
131
 
130
- /* misc. */
131
- .cover-page {
132
- text-align: center;
132
+ /* center-align any tables and images */
133
+
134
+ .formal table, .formal img, #navigation img {
135
+ margin-left: auto;
136
+ margin-right: auto;
133
137
  }
134
138
 
135
- a img {
136
- border: none;
139
+ .formal img, #navigation img {
140
+ display: block;
137
141
  }
138
142
 
139
143
 
144
+ /* misc. */
145
+
146
+ .cover-page {
147
+ text-align: center;
148
+ }
149
+
150
+ a img {
151
+ border: none;
152
+ }
153
+
154
+
140
155
  /* extra spacing before big block elements */
141
156
 
142
157
  .admonition, .figure {
data/doc/common.tpl CHANGED
@@ -16,7 +16,7 @@
16
16
  <title><%= page_title %></title>
17
17
  </head>
18
18
  <body>
19
- <% if table_of_contents %>
19
+ <% if table_of_contents %>
20
20
  <div id="navigation">
21
21
  <%= %{"!images/home.png(project home)!":readme.html}.redcloth %>
22
22
 
@@ -26,24 +26,23 @@
26
26
  %{#{'*' * h.depth} "#{h.title}":##{h.anchor}}
27
27
  end.join("\n").redcloth
28
28
  %>
29
- <%
30
- @blocks.keys.sort_by {|k| k.to_s}.each do |type|
31
- list = @blocks[type]
32
29
 
33
- unless list.empty?
34
- %>
35
- <h2><%= type.to_s.capitalize %>s</h2>
36
- <%=
37
- list.inject('') do |memo, block|
38
- memo << "# #{(block.title || block.anchor).inspect}:##{block.anchor}\n"
39
- end.redcloth
40
- %>
41
- <%
42
- end
43
- end
44
- %>
30
+ <% DocProxy::CATEGORIES.each_pair do |cat, types| %>
31
+ <h1><%= cat.to_s.capitalize %>s</h1>
32
+
33
+ <% types.each do |type| list = @blocks[type] %>
34
+ <% unless list.empty? %>
35
+ <h2><%= type.to_s.capitalize %>s</h2>
36
+ <%=
37
+ list.inject('') do |memo, block|
38
+ memo << "# #{(block.title || block.anchor).inspect}:##{block.anchor}\n"
39
+ end.redcloth
40
+ %>
41
+ <% end %>
42
+ <% end %>
43
+ <% end %>
45
44
  </div>
46
- <% end %>
45
+ <% end %>
47
46
  <%= content.to_html %>
48
47
  </body>
49
48
  </html>