ruby-vpi 15.0.2 → 16.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.
- data/LICENSE +23 -340
- data/Rakefile +169 -192
- data/bin/generate_test.rb +26 -25
- data/bin/generate_test_tpl/runner.rake +4 -10
- data/bin/header_to_ruby.rb +3 -20
- data/doc/README +11 -0
- data/doc/Rakefile +8 -21
- data/doc/common.css +44 -10
- data/doc/common.tpl +5 -10
- data/doc/history.doc +8 -7
- data/doc/history.html +228 -560
- data/doc/history.rb +7 -11
- data/doc/{history.yml → history.yaml} +325 -128
- data/doc/images/{feed-icon.png → feed-icon-28x28.png} +0 -0
- data/doc/images/ruby/LICENSE +15 -0
- data/doc/images/ruby/logo-reflection.png +0 -0
- data/doc/images/ruby/logo-reflection.xcf +0 -0
- data/doc/images/ruby/logo.png +0 -0
- data/doc/images/{LICENSE → tango/LICENSE} +0 -0
- data/doc/images/{caution.png → tango/caution.png} +0 -0
- data/doc/images/{caution.svg → tango/caution.svg} +0 -0
- data/doc/images/{home.png → tango/home.png} +0 -0
- data/doc/images/{home.svg → tango/home.svg} +0 -0
- data/doc/images/{important.png → tango/important.png} +0 -0
- data/doc/images/{important.svg → tango/important.svg} +0 -0
- data/doc/images/{next.png → tango/next.png} +0 -0
- data/doc/images/{next.svg → tango/next.svg} +0 -0
- data/doc/images/{note.png → tango/note.png} +0 -0
- data/doc/images/{note.svg → tango/note.svg} +0 -0
- data/doc/images/{prev.png → tango/prev.png} +0 -0
- data/doc/images/{prev.svg → tango/prev.svg} +0 -0
- data/doc/images/{tip.png → tango/tip.png} +0 -0
- data/doc/images/{tip.svg → tango/tip.svg} +0 -0
- data/doc/images/{up.png → tango/up.png} +0 -0
- data/doc/images/{up.svg → tango/up.svg} +0 -0
- data/doc/images/{warning.png → tango/warning.png} +0 -0
- data/doc/images/{warning.svg → tango/warning.svg} +0 -0
- data/doc/intro.inc +105 -36
- data/doc/lib/doc_format.rb +151 -29
- data/doc/lib/doc_proxy.rb +28 -69
- data/doc/lib/erb_content.rb +10 -22
- data/doc/lib/erb_proxy.rb +13 -24
- data/doc/manual.doc +16 -60
- data/doc/manual.html +257 -340
- data/doc/memo.doc +2 -0
- data/doc/memo.html +11 -11
- data/doc/readme.doc +36 -2
- data/doc/readme.html +214 -51
- data/doc/rss.erb +3 -3
- data/doc/rss.xml +217 -269
- data/ext/Rakefile +7 -22
- data/ext/common.h +10 -21
- data/ext/extconf.rb +5 -0
- data/ext/main.c +2 -18
- data/ext/main.h +1 -16
- data/ext/relay.c +3 -17
- data/ext/relay.h +3 -17
- data/ext/verilog.h +6 -18
- data/ext/vlog.c +3 -21
- data/ext/vlog.h +3 -17
- data/lib/ruby-vpi/erb.rb +7 -20
- data/lib/ruby-vpi/float.rb +6 -20
- data/lib/ruby-vpi/integer.rb +27 -47
- data/lib/ruby-vpi/rake.rb +4 -19
- data/lib/ruby-vpi/rcov.rb +6 -21
- data/lib/ruby-vpi/rdoc.rb +3 -21
- data/lib/ruby-vpi/runner.rb +28 -29
- data/lib/ruby-vpi/runner_proxy.rb +5 -21
- data/lib/ruby-vpi/verilog_parser.rb +5 -20
- data/lib/ruby-vpi/vpi.rb +420 -376
- data/lib/ruby-vpi.rb +26 -32
- data/ref/c/annotated.html +1 -1
- data/ref/c/common_8h.html +1 -1
- data/ref/c/files.html +1 -1
- data/ref/c/functions.html +1 -1
- data/ref/c/functions_vars.html +1 -1
- data/ref/c/globals.html +1 -1
- data/ref/c/globals_0x63.html +1 -1
- data/ref/c/globals_0x65.html +1 -1
- data/ref/c/globals_0x66.html +1 -1
- data/ref/c/globals_0x6d.html +1 -1
- data/ref/c/globals_0x70.html +1 -1
- data/ref/c/globals_0x72.html +1 -1
- data/ref/c/globals_0x73.html +1 -1
- data/ref/c/globals_0x74.html +1 -1
- data/ref/c/globals_0x76.html +1 -1
- data/ref/c/globals_0x78.html +1 -1
- data/ref/c/globals_defs.html +1 -1
- data/ref/c/globals_defs_0x65.html +1 -1
- data/ref/c/globals_defs_0x70.html +1 -1
- data/ref/c/globals_defs_0x76.html +1 -1
- data/ref/c/globals_defs_0x78.html +1 -1
- data/ref/c/globals_enum.html +1 -1
- data/ref/c/globals_eval.html +1 -1
- data/ref/c/globals_func.html +1 -1
- data/ref/c/globals_type.html +1 -1
- data/ref/c/globals_vars.html +1 -1
- data/ref/c/index.html +1 -1
- data/ref/c/main_8c.html +1 -1
- data/ref/c/main_8h.html +1 -1
- data/ref/c/relay_8c.html +1 -1
- data/ref/c/relay_8h.html +1 -1
- data/ref/c/structt__cb__data.html +1 -1
- data/ref/c/structt__vpi__delay.html +1 -1
- data/ref/c/structt__vpi__error__info.html +1 -1
- data/ref/c/structt__vpi__strengthval.html +1 -1
- data/ref/c/structt__vpi__systf__data.html +1 -1
- data/ref/c/structt__vpi__time.html +1 -1
- data/ref/c/structt__vpi__value.html +1 -1
- data/ref/c/structt__vpi__vecval.html +1 -1
- data/ref/c/structt__vpi__vlog__info.html +1 -1
- data/ref/c/verilog_8h.html +1 -1
- data/ref/c/vlog_8c.html +1 -1
- data/ref/c/vlog_8h.html +1 -1
- data/ref/c/vpi__user_8h.html +1 -1
- data/ref/ruby/classes/ERB.html +5 -5
- data/ref/ruby/classes/ERB.src/{M000026.html → M000024.html} +15 -15
- data/ref/ruby/classes/FileUtils.html +10 -10
- data/ref/ruby/classes/FileUtils.src/{M000027.html → M000025.html} +4 -4
- data/ref/ruby/classes/FileUtils.src/{M000028.html → M000026.html} +4 -4
- data/ref/ruby/classes/Float.html +5 -5
- data/ref/ruby/classes/Float.src/{M000022.html → M000020.html} +5 -5
- data/ref/ruby/classes/Integer.html +20 -56
- data/ref/ruby/classes/Integer.src/M000008.html +11 -11
- data/ref/ruby/classes/Integer.src/M000009.html +4 -4
- data/ref/ruby/classes/Integer.src/M000010.html +4 -4
- data/ref/ruby/classes/Integer.src/M000011.html +4 -4
- data/ref/ruby/classes/Integer.src/M000012.html +4 -4
- data/ref/ruby/classes/Integer.src/M000013.html +4 -4
- data/ref/ruby/classes/Integer.src/M000016.html +12 -9
- data/ref/ruby/classes/Integer.src/M000017.html +18 -9
- data/ref/ruby/classes/Integer.src/M000018.html +12 -12
- data/ref/ruby/classes/Integer.src/M000019.html +17 -18
- data/ref/ruby/classes/RDoc.src/M000053.html +25 -25
- data/ref/ruby/classes/RubyVpi/Config.html +3 -3
- data/ref/ruby/classes/RubyVpi.html +11 -5
- data/ref/ruby/classes/RubyVpi.src/{M000029.html → M000027.html} +103 -101
- data/ref/ruby/classes/String.html +21 -15
- data/ref/ruby/classes/String.src/M000021.html +36 -0
- data/ref/ruby/classes/String.src/{M000024.html → M000022.html} +24 -24
- data/ref/ruby/classes/String.src/M000023.html +5 -23
- data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000007.html +5 -5
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000003.html +7 -7
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000004.html +4 -4
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000005.html +4 -4
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000006.html +4 -4
- data/ref/ruby/classes/VerilogParser/Module.src/M000002.html +20 -20
- data/ref/ruby/classes/VerilogParser.html +6 -0
- data/ref/ruby/classes/VerilogParser.src/M000001.html +20 -20
- data/ref/ruby/classes/Vpi/Handle.html +89 -88
- data/ref/ruby/classes/Vpi/Handle.src/M000036.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000037.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000038.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000039.html +5 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000040.html +8 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000041.html +8 -8
- data/ref/ruby/classes/Vpi/Handle.src/M000042.html +7 -6
- data/ref/ruby/classes/Vpi/Handle.src/M000043.html +31 -9
- data/ref/ruby/classes/Vpi/Handle.src/M000044.html +74 -31
- data/ref/ruby/classes/Vpi/Handle.src/M000045.html +17 -74
- data/ref/ruby/classes/Vpi/Handle.src/M000046.html +11 -17
- data/ref/ruby/classes/Vpi/Handle.src/M000048.html +31 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000049.html +53 -52
- data/ref/ruby/classes/Vpi/S_vpi_time.src/M000050.html +4 -4
- data/ref/ruby/classes/Vpi/S_vpi_time.src/M000051.html +5 -5
- data/ref/ruby/classes/Vpi/S_vpi_value.html +15 -15
- data/ref/ruby/classes/Vpi/S_vpi_value.src/{M000036.html → M000033.html} +5 -5
- data/ref/ruby/classes/Vpi/S_vpi_value.src/M000034.html +5 -5
- data/ref/ruby/classes/Vpi/S_vpi_value.src/M000035.html +5 -5
- data/ref/ruby/classes/Vpi.html +48 -19
- data/ref/ruby/classes/Vpi.src/M000028.html +28 -0
- data/ref/ruby/classes/Vpi.src/M000029.html +18 -0
- data/ref/ruby/classes/Vpi.src/M000030.html +25 -15
- data/ref/ruby/classes/Vpi.src/M000031.html +9 -5
- data/ref/ruby/classes/Vpi.src/M000032.html +9 -25
- data/ref/ruby/created.rid +1 -1
- data/ref/ruby/files/bin/generate_test_rb.html +2 -1
- data/ref/ruby/files/bin/header_to_ruby_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +7 -1
- data/ref/ruby/files/lib/ruby-vpi/float_rb.html +7 -1
- data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +7 -1
- data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +7 -1
- data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +7 -1
- data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi_rb.html +7 -1
- data/ref/ruby/fr_method_index.html +34 -34
- data/samp/counter/counter_rspec_runner.rake +4 -0
- data/samp/counter/counter_xunit_runner.rake +4 -0
- data/samp/pipelined_alu/Hw5UnitModel.rb +3 -19
- data/samp/pipelined_alu/README +38 -13
- data/samp/pipelined_alu/TestHw5UnitModel.rb +9 -20
- data/samp/pipelined_alu/hw5_unit.v +1 -16
- data/samp/pipelined_alu/hw5_unit_test_runner.rake +4 -0
- data/samp/pipelined_alu/hw5_unit_test_spec.rb +3 -20
- data/samp/pipelined_alu/int_gen.rb +6 -20
- metadata +47 -43
- data/doc/LICENSE +0 -397
- data/doc/images/feed-icon.LICENSE +0 -2
- data/doc/images/feed-icon.svg +0 -18
- data/ref/ruby/classes/Integer.src/M000020.html +0 -25
- data/ref/ruby/classes/Integer.src/M000021.html +0 -30
- data/ref/ruby/classes/String.src/M000025.html +0 -18
- data/ref/ruby/classes/Vpi/Handle.src/M000047.html +0 -24
- data/ref/ruby/classes/Vpi.src/M000033.html +0 -22
|
@@ -5,27 +5,26 @@
|
|
|
5
5
|
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
8
|
-
<title>
|
|
8
|
+
<title>split (Integer)</title>
|
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/integer.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
116: <span class="ruby-keyword kw">end</span></pre>
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/integer.rb, line 121</span>
|
|
14
|
+
121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split</span> <span class="ruby-identifier">aWidth</span> = <span class="ruby-value">8</span>
|
|
15
|
+
122: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"width must be positive and non-zero"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">aWidth</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
16
|
+
123:
|
|
17
|
+
124: <span class="ruby-identifier">int</span>, <span class="ruby-identifier">bits</span> = <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">length</span>
|
|
18
|
+
125: <span class="ruby-identifier">mask</span> = <span class="ruby-identifier">aWidth</span>.<span class="ruby-identifier">to_mask</span>
|
|
19
|
+
126: <span class="ruby-identifier">words</span> = []
|
|
20
|
+
127:
|
|
21
|
+
128: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bits</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
22
|
+
129: <span class="ruby-identifier">words</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">int</span> <span class="ruby-operator">&</span> <span class="ruby-identifier">mask</span>
|
|
23
|
+
130: <span class="ruby-identifier">int</span> <span class="ruby-operator">>>=</span> <span class="ruby-identifier">aWidth</span>
|
|
24
|
+
131: <span class="ruby-identifier">bits</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">aWidth</span>
|
|
25
|
+
132: <span class="ruby-keyword kw">end</span>
|
|
26
|
+
133:
|
|
27
|
+
134: <span class="ruby-identifier">words</span>
|
|
28
|
+
135: <span class="ruby-keyword kw">end</span></pre>
|
|
30
29
|
</body>
|
|
31
30
|
</html>
|
|
@@ -10,31 +10,31 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/rdoc.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/rdoc.rb, line 8</span>
|
|
14
|
+
8: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">RDoc</span>.<span class="ruby-identifier">usage_from_file</span> <span class="ruby-identifier">input_file</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
|
15
|
+
9: <span class="ruby-identifier">comment</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">input_file</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
|
16
|
+
10: <span class="ruby-identifier">find_comment</span>(<span class="ruby-identifier">file</span>)
|
|
17
|
+
11: <span class="ruby-keyword kw">end</span>
|
|
18
|
+
12:
|
|
19
|
+
13: <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">comment</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^\s*#/</span>, <span class="ruby-value str">''</span>)
|
|
20
|
+
14:
|
|
21
|
+
15: <span class="ruby-identifier">markup</span> = <span class="ruby-constant">SM</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleMarkup</span>.<span class="ruby-identifier">new</span>
|
|
22
|
+
16: <span class="ruby-identifier">flow_convertor</span> = <span class="ruby-constant">SM</span><span class="ruby-operator">::</span><span class="ruby-constant">ToFlow</span>.<span class="ruby-identifier">new</span>
|
|
23
|
+
17:
|
|
24
|
+
18: <span class="ruby-identifier">flow</span> = <span class="ruby-identifier">markup</span>.<span class="ruby-identifier">convert</span>(<span class="ruby-identifier">comment</span>, <span class="ruby-identifier">flow_convertor</span>)
|
|
25
|
+
19:
|
|
26
|
+
20: <span class="ruby-identifier">format</span> = <span class="ruby-value str">"plain"</span>
|
|
27
|
+
21:
|
|
28
|
+
22: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
|
|
29
|
+
23: <span class="ruby-identifier">flow</span> = <span class="ruby-identifier">extract_sections</span>(<span class="ruby-identifier">flow</span>, <span class="ruby-identifier">args</span>)
|
|
30
|
+
24: <span class="ruby-keyword kw">end</span>
|
|
31
|
+
25:
|
|
32
|
+
26: <span class="ruby-identifier">options</span> = <span class="ruby-constant">RI</span><span class="ruby-operator">::</span><span class="ruby-constant">Options</span>.<span class="ruby-identifier">instance</span>
|
|
33
|
+
27: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">"RI"</span>]
|
|
34
|
+
28: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">args</span>.<span class="ruby-identifier">split</span>)
|
|
17
35
|
29: <span class="ruby-keyword kw">end</span>
|
|
18
|
-
30:
|
|
19
|
-
31: <span class="ruby-identifier">
|
|
20
|
-
32:
|
|
21
|
-
33: <span class="ruby-identifier">markup</span> = <span class="ruby-constant">SM</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleMarkup</span>.<span class="ruby-identifier">new</span>
|
|
22
|
-
34: <span class="ruby-identifier">flow_convertor</span> = <span class="ruby-constant">SM</span><span class="ruby-operator">::</span><span class="ruby-constant">ToFlow</span>.<span class="ruby-identifier">new</span>
|
|
23
|
-
35:
|
|
24
|
-
36: <span class="ruby-identifier">flow</span> = <span class="ruby-identifier">markup</span>.<span class="ruby-identifier">convert</span>(<span class="ruby-identifier">comment</span>, <span class="ruby-identifier">flow_convertor</span>)
|
|
25
|
-
37:
|
|
26
|
-
38: <span class="ruby-identifier">format</span> = <span class="ruby-value str">"plain"</span>
|
|
27
|
-
39:
|
|
28
|
-
40: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
|
|
29
|
-
41: <span class="ruby-identifier">flow</span> = <span class="ruby-identifier">extract_sections</span>(<span class="ruby-identifier">flow</span>, <span class="ruby-identifier">args</span>)
|
|
30
|
-
42: <span class="ruby-keyword kw">end</span>
|
|
31
|
-
43:
|
|
32
|
-
44: <span class="ruby-identifier">options</span> = <span class="ruby-constant">RI</span><span class="ruby-operator">::</span><span class="ruby-constant">Options</span>.<span class="ruby-identifier">instance</span>
|
|
33
|
-
45: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">"RI"</span>]
|
|
34
|
-
46: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">args</span>.<span class="ruby-identifier">split</span>)
|
|
35
|
-
47: <span class="ruby-keyword kw">end</span>
|
|
36
|
-
48: <span class="ruby-identifier">formatter</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-value str">""</span>)
|
|
37
|
-
49: <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">display_flow</span>(<span class="ruby-identifier">flow</span>)
|
|
38
|
-
50: <span class="ruby-keyword kw">end</span></pre>
|
|
36
|
+
30: <span class="ruby-identifier">formatter</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-value str">""</span>)
|
|
37
|
+
31: <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">display_flow</span>(<span class="ruby-identifier">flow</span>)
|
|
38
|
+
32: <span class="ruby-keyword kw">end</span></pre>
|
|
39
39
|
</body>
|
|
40
40
|
</html>
|
|
@@ -124,17 +124,17 @@ Provides information about this project’s configuration.
|
|
|
124
124
|
<tr class="top-aligned-row context-row">
|
|
125
125
|
<td class="context-item-name">PROJECT_DETAIL</td>
|
|
126
126
|
<td>=</td>
|
|
127
|
-
<td class="context-item-value">"#{PROJECT_NAME} is a #{PROJECT_SUMMARY}. It lets you create complex Verilog test benches easily and wholly in Ruby."</td>
|
|
127
|
+
<td class="context-item-value">"#{PROJECT_NAME} is a #{PROJECT_SUMMARY} and a platform for unit testing, rapid prototyping, and systems integration of Verilog modules through Ruby. It lets you create complex Verilog test benches easily and wholly in Ruby."</td>
|
|
128
128
|
</tr>
|
|
129
129
|
<tr class="top-aligned-row context-row">
|
|
130
130
|
<td class="context-item-name">Simulator</td>
|
|
131
131
|
<td>=</td>
|
|
132
|
-
<td class="context-item-value">Struct.new(:
|
|
132
|
+
<td class="context-item-value">Struct.new(:name, :compiler_args, :linker_args)</td>
|
|
133
133
|
</tr>
|
|
134
134
|
<tr class="top-aligned-row context-row">
|
|
135
135
|
<td class="context-item-name">SIMULATORS</td>
|
|
136
136
|
<td>=</td>
|
|
137
|
-
<td class="context-item-value">
|
|
137
|
+
<td class="context-item-value">{ :cver => Simulator.new('GPL Cver', '-DPRAGMATIC_CVER', ''), :ivl => Simulator.new('Icarus Verilog', '-DICARUS_VERILOG', ''), :vcs => Simulator.new('Synopsys VCS', '-DSYNOPSYS_VCS', ''), :vsim => Simulator.new('Mentor Modelsim', '-DMENTOR_MODELSIM', ''), :ncsim => Simulator.new('Cadence NC-Sim', '-DCADENCE_NCSIM', ''), }</td>
|
|
138
138
|
<td width="3em"> </td>
|
|
139
139
|
<td class="context-item-desc">
|
|
140
140
|
List of supported Verilog simulators.
|
|
@@ -76,6 +76,12 @@
|
|
|
76
76
|
|
|
77
77
|
<div id="contextContent">
|
|
78
78
|
|
|
79
|
+
<div id="description">
|
|
80
|
+
<p>
|
|
81
|
+
General Ruby-VPI project information and testbench bootstrapping.
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
</div>
|
|
79
85
|
|
|
80
86
|
|
|
81
87
|
</div>
|
|
@@ -84,7 +90,7 @@
|
|
|
84
90
|
<h3 class="section-bar">Methods</h3>
|
|
85
91
|
|
|
86
92
|
<div class="name-list">
|
|
87
|
-
<a href="#
|
|
93
|
+
<a href="#M000027">init_bench</a>
|
|
88
94
|
</div>
|
|
89
95
|
</div>
|
|
90
96
|
|
|
@@ -137,12 +143,12 @@
|
|
|
137
143
|
<div id="methods">
|
|
138
144
|
<h3 class="section-bar">Public Class methods</h3>
|
|
139
145
|
|
|
140
|
-
<div id="method-
|
|
141
|
-
<a name="
|
|
146
|
+
<div id="method-M000027" class="method-detail">
|
|
147
|
+
<a name="M000027"></a>
|
|
142
148
|
|
|
143
149
|
<div class="method-heading">
|
|
144
|
-
<a href="RubyVpi.src/
|
|
145
|
-
onclick="popupCode('RubyVpi.src/
|
|
150
|
+
<a href="RubyVpi.src/M000027.html" target="Code" class="method-signature"
|
|
151
|
+
onclick="popupCode('RubyVpi.src/M000027.html');return false;">
|
|
146
152
|
<span class="method-name">init_bench</span><span class="method-args">(aDesignId, aSpecFormat, &aSimulationCycle)</span>
|
|
147
153
|
</a>
|
|
148
154
|
</div>
|
|
@@ -10,110 +10,112 @@
|
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
11
|
</head>
|
|
12
12
|
<body class="standalone-code">
|
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi.rb, line
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi.rb, line 22</span>
|
|
14
|
+
22: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">RubyVpi</span>.<span class="ruby-identifier">init_bench</span> <span class="ruby-identifier">aDesignId</span>, <span class="ruby-identifier">aSpecFormat</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">aSimulationCycle</span>
|
|
15
|
+
23: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"block must be given"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
|
16
|
+
24:
|
|
17
|
+
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">caller</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(.*?)_bench.rb:/</span>}
|
|
18
|
+
26: <span class="ruby-identifier">testName</span> = <span class="ruby-identifier">$1</span>
|
|
19
|
+
27: <span class="ruby-keyword kw">else</span>
|
|
20
|
+
28: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Unable to determine name of test.'</span>
|
|
21
|
+
29: <span class="ruby-keyword kw">end</span>
|
|
22
|
+
30:
|
|
23
|
+
31: <span class="ruby-identifier">useDebugger</span> = <span class="ruby-operator">!</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'DEBUG'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>).<span class="ruby-identifier">empty?</span>
|
|
24
|
+
32: <span class="ruby-identifier">useCoverage</span> = <span class="ruby-operator">!</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'COVERAGE'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>).<span class="ruby-identifier">empty?</span>
|
|
25
|
+
33: <span class="ruby-identifier">usePrototype</span> = <span class="ruby-operator">!</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PROTOTYPE'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>).<span class="ruby-identifier">empty?</span>
|
|
26
|
+
34:
|
|
27
|
+
35: <span class="ruby-comment cmt"># set up code coverage analysis</span>
|
|
28
|
+
36: <span class="ruby-comment cmt"># XXX: this is loaded *before* RCov to prevent coverage statistics about</span>
|
|
29
|
+
37: <span class="ruby-comment cmt"># it</span>
|
|
30
|
+
38: <span class="ruby-identifier">require</span> <span class="ruby-value str">'ruby-vpi/vpi'</span>
|
|
22
31
|
39:
|
|
23
|
-
40:
|
|
24
|
-
41:
|
|
25
|
-
42:
|
|
26
|
-
43:
|
|
27
|
-
44:
|
|
28
|
-
45:
|
|
29
|
-
46:
|
|
30
|
-
47:
|
|
31
|
-
48:
|
|
32
|
-
49:
|
|
33
|
-
50:
|
|
34
|
-
51:
|
|
35
|
-
52:
|
|
36
|
-
53:
|
|
37
|
-
54:
|
|
38
|
-
55:
|
|
39
|
-
56:
|
|
32
|
+
40: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">useCoverage</span>
|
|
33
|
+
41: <span class="ruby-identifier">require</span> <span class="ruby-value str">'ruby-vpi/rcov'</span>
|
|
34
|
+
42:
|
|
35
|
+
43: <span class="ruby-constant">RubyVpi</span>.<span class="ruby-identifier">with_coverage_analysis</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
|
|
36
|
+
44: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">dump_coverage_info</span> [
|
|
37
|
+
45: <span class="ruby-constant">Rcov</span><span class="ruby-operator">::</span><span class="ruby-constant">TextReport</span>.<span class="ruby-identifier">new</span>,
|
|
38
|
+
46: <span class="ruby-constant">Rcov</span><span class="ruby-operator">::</span><span class="ruby-constant">HTMLCoverage</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:destdir</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{testName}_coverage"</span>)
|
|
39
|
+
47: ]
|
|
40
|
+
48: <span class="ruby-keyword kw">end</span>
|
|
41
|
+
49:
|
|
42
|
+
50: <span class="ruby-constant">Vpi</span><span class="ruby-operator">::</span><span class="ruby-identifier">vpi_printf</span> <span class="ruby-node">"#{Config::PROJECT_NAME}: coverage analysis is enabled for test #{testName.inspect}\n"</span>
|
|
43
|
+
51: <span class="ruby-keyword kw">end</span>
|
|
44
|
+
52:
|
|
45
|
+
53: <span class="ruby-comment cmt"># set up the specification library</span>
|
|
46
|
+
54: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">aSpecFormat</span>
|
|
47
|
+
55: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:xUnit</span>
|
|
48
|
+
56: <span class="ruby-identifier">require</span> <span class="ruby-value str">'test/unit'</span>
|
|
40
49
|
57:
|
|
41
|
-
58: <span class="ruby-
|
|
42
|
-
59:
|
|
43
|
-
60:
|
|
44
|
-
61:
|
|
45
|
-
62:
|
|
46
|
-
63:
|
|
47
|
-
64: <span class="ruby-identifier">require</span> <span class="ruby-value str">'test/
|
|
48
|
-
65:
|
|
49
|
-
66:
|
|
50
|
-
67:
|
|
51
|
-
68:
|
|
52
|
-
69:
|
|
53
|
-
70:
|
|
54
|
-
71:
|
|
55
|
-
72:
|
|
56
|
-
73:
|
|
57
|
-
74:
|
|
58
|
-
75:
|
|
59
|
-
76:
|
|
60
|
-
77:
|
|
61
|
-
78:
|
|
62
|
-
79:
|
|
63
|
-
80:
|
|
64
|
-
81:
|
|
65
|
-
82:
|
|
66
|
-
83:
|
|
67
|
-
84:
|
|
68
|
-
85:
|
|
69
|
-
86:
|
|
70
|
-
87:
|
|
71
|
-
88:
|
|
72
|
-
89:
|
|
73
|
-
90:
|
|
74
|
-
91:
|
|
75
|
-
92: <span class="ruby-
|
|
76
|
-
93:
|
|
77
|
-
94:
|
|
78
|
-
95:
|
|
79
|
-
96:
|
|
80
|
-
97:
|
|
81
|
-
98:
|
|
82
|
-
99:
|
|
83
|
-
100:
|
|
84
|
-
101: <span class="ruby-
|
|
50
|
+
58: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:rSpec</span>
|
|
51
|
+
59: <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">concat</span> <span class="ruby-node">%w[-f s]</span>
|
|
52
|
+
60: <span class="ruby-identifier">require</span> <span class="ruby-value str">'spec'</span>
|
|
53
|
+
61:
|
|
54
|
+
62: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:tSpec</span>
|
|
55
|
+
63: <span class="ruby-constant">ARGV</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'-rs'</span>
|
|
56
|
+
64: <span class="ruby-identifier">require</span> <span class="ruby-value str">'test/spec'</span>
|
|
57
|
+
65: <span class="ruby-keyword kw">end</span>
|
|
58
|
+
66:
|
|
59
|
+
67: <span class="ruby-comment cmt"># set up the interactive debugger</span>
|
|
60
|
+
68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">useDebugger</span>
|
|
61
|
+
69: <span class="ruby-identifier">require</span> <span class="ruby-value str">'ruby-debug'</span>
|
|
62
|
+
70:
|
|
63
|
+
71: <span class="ruby-constant">Debugger</span>.<span class="ruby-identifier">start</span>
|
|
64
|
+
72: <span class="ruby-constant">Debugger</span>.<span class="ruby-identifier">post_mortem</span>
|
|
65
|
+
73:
|
|
66
|
+
74: <span class="ruby-constant">Vpi</span><span class="ruby-operator">::</span><span class="ruby-identifier">vpi_printf</span> <span class="ruby-node">"#{Config::PROJECT_NAME}: debugger is enabled for test #{testName.inspect}\n"</span>
|
|
67
|
+
75: <span class="ruby-keyword kw">end</span>
|
|
68
|
+
76:
|
|
69
|
+
77: <span class="ruby-comment cmt"># suppress undefined method errors when debugger is not enabled</span>
|
|
70
|
+
78: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:debugger</span>
|
|
71
|
+
79: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
|
|
72
|
+
80: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">:debugger</span> <span class="ruby-keyword kw">do</span>
|
|
73
|
+
81: <span class="ruby-comment cmt"># this is a dummy method!</span>
|
|
74
|
+
82: <span class="ruby-keyword kw">end</span>
|
|
75
|
+
83: <span class="ruby-keyword kw">end</span>
|
|
76
|
+
84: <span class="ruby-keyword kw">end</span>
|
|
77
|
+
85:
|
|
78
|
+
86: <span class="ruby-comment cmt"># set up the VPI utility layer</span>
|
|
79
|
+
87: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
|
|
80
|
+
88: <span class="ruby-identifier">include</span> <span class="ruby-constant">Vpi</span>
|
|
81
|
+
89: <span class="ruby-keyword kw">end</span>
|
|
82
|
+
90:
|
|
83
|
+
91: <span class="ruby-constant">Vpi</span>.<span class="ruby-identifier">module_eval</span> <span class="ruby-keyword kw">do</span>
|
|
84
|
+
92: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">:simulate</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">aSimulationCycle</span>
|
|
85
|
+
93: <span class="ruby-keyword kw">end</span>
|
|
86
|
+
94:
|
|
87
|
+
95: <span class="ruby-comment cmt"># load the design under test</span>
|
|
88
|
+
96: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">design</span> = <span class="ruby-identifier">vpi_handle_by_name</span>(<span class="ruby-node">"#{testName}_bench"</span>, <span class="ruby-keyword kw">nil</span>)
|
|
89
|
+
97: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Verilog bench for test #{testName.inspect} is inaccessible."</span>
|
|
90
|
+
98: <span class="ruby-keyword kw">end</span>
|
|
91
|
+
99:
|
|
92
|
+
100: <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-identifier">aDesignId</span>, <span class="ruby-identifier">design</span>)
|
|
93
|
+
101: <span class="ruby-identifier">require</span> <span class="ruby-node">"#{testName}_design.rb"</span>
|
|
85
94
|
102:
|
|
86
|
-
103: <span class="ruby-comment cmt"># load the design
|
|
87
|
-
104: <span class="ruby-keyword kw">
|
|
88
|
-
105: <span class="ruby-identifier">
|
|
89
|
-
106:
|
|
90
|
-
107:
|
|
91
|
-
108:
|
|
92
|
-
109:
|
|
93
|
-
110:
|
|
94
|
-
111:
|
|
95
|
-
112:
|
|
96
|
-
113:
|
|
97
|
-
114:
|
|
98
|
-
115: <span class="ruby-
|
|
99
|
-
116:
|
|
100
|
-
117:
|
|
101
|
-
118:
|
|
102
|
-
119:
|
|
103
|
-
120:
|
|
104
|
-
121:
|
|
105
|
-
122:
|
|
106
|
-
123:
|
|
95
|
+
103: <span class="ruby-comment cmt"># load the design's prototype</span>
|
|
96
|
+
104: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">usePrototype</span>
|
|
97
|
+
105: <span class="ruby-identifier">require</span> <span class="ruby-node">"#{testName}_proto.rb"</span>
|
|
98
|
+
106:
|
|
99
|
+
107: <span class="ruby-constant">Vpi</span>.<span class="ruby-identifier">module_eval</span> <span class="ruby-keyword kw">do</span>
|
|
100
|
+
108: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">:advance_time</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
|
101
|
+
109: <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">times</span> { <span class="ruby-identifier">design</span>.<span class="ruby-identifier">simulate!</span> }
|
|
102
|
+
110: <span class="ruby-keyword kw">end</span>
|
|
103
|
+
111:
|
|
104
|
+
112: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">:vpi_register_cb</span> <span class="ruby-keyword kw">do</span>
|
|
105
|
+
113: <span class="ruby-identifier">warn</span> <span class="ruby-value str">"vpi_register_cb: callbacks are ignored when prototype is enabled"</span>
|
|
106
|
+
114: <span class="ruby-keyword kw">end</span>
|
|
107
|
+
115: <span class="ruby-keyword kw">end</span>
|
|
108
|
+
116:
|
|
109
|
+
117: <span class="ruby-constant">Vpi</span><span class="ruby-operator">::</span><span class="ruby-identifier">vpi_printf</span> <span class="ruby-node">"#{Config::PROJECT_NAME}: prototype is enabled for test #{testName.inspect}\n"</span>
|
|
110
|
+
118:
|
|
111
|
+
119: <span class="ruby-keyword kw">else</span>
|
|
112
|
+
120: <span class="ruby-comment cmt"># XXX: this completes the handshake, by calling relay_verilog, with</span>
|
|
113
|
+
121: <span class="ruby-comment cmt"># pthread_mutex_lock() in relay_main() in the C extension</span>
|
|
114
|
+
122: <span class="ruby-identifier">advance_time</span>
|
|
115
|
+
123: <span class="ruby-keyword kw">end</span>
|
|
107
116
|
124:
|
|
108
|
-
125:
|
|
109
|
-
126:
|
|
110
|
-
127:
|
|
111
|
-
128: <span class="ruby-comment cmt"># XXX: this completes the handshake, by calling relay_verilog, with pthread_mutex_lock() in relay_main() in the C extension</span>
|
|
112
|
-
129: <span class="ruby-identifier">advance_time</span>
|
|
113
|
-
130: <span class="ruby-keyword kw">end</span>
|
|
114
|
-
131:
|
|
115
|
-
132: <span class="ruby-comment cmt"># load the design's specification</span>
|
|
116
|
-
133: <span class="ruby-identifier">require</span> <span class="ruby-node">"#{testName}_spec.rb"</span>
|
|
117
|
-
134: <span class="ruby-keyword kw">end</span></pre>
|
|
117
|
+
125: <span class="ruby-comment cmt"># load the design's specification</span>
|
|
118
|
+
126: <span class="ruby-identifier">require</span> <span class="ruby-node">"#{testName}_spec.rb"</span>
|
|
119
|
+
127: <span class="ruby-keyword kw">end</span></pre>
|
|
118
120
|
</body>
|
|
119
121
|
</html>
|
|
@@ -82,6 +82,12 @@
|
|
|
82
82
|
|
|
83
83
|
<div id="contextContent">
|
|
84
84
|
|
|
85
|
+
<div id="description">
|
|
86
|
+
<p>
|
|
87
|
+
Library for hardware-related floating point operations.
|
|
88
|
+
</p>
|
|
89
|
+
|
|
90
|
+
</div>
|
|
85
91
|
|
|
86
92
|
|
|
87
93
|
</div>
|
|
@@ -90,9 +96,9 @@
|
|
|
90
96
|
<h3 class="section-bar">Methods</h3>
|
|
91
97
|
|
|
92
98
|
<div class="name-list">
|
|
93
|
-
<a href="#
|
|
94
|
-
<a href="#
|
|
95
|
-
<a href="#
|
|
99
|
+
<a href="#M000021">to_f</a>
|
|
100
|
+
<a href="#M000023">to_ruby_const_name</a>
|
|
101
|
+
<a href="#M000022">verilog_to_ruby</a>
|
|
96
102
|
</div>
|
|
97
103
|
</div>
|
|
98
104
|
|
|
@@ -114,12 +120,12 @@
|
|
|
114
120
|
<div id="methods">
|
|
115
121
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
116
122
|
|
|
117
|
-
<div id="method-
|
|
118
|
-
<a name="
|
|
123
|
+
<div id="method-M000021" class="method-detail">
|
|
124
|
+
<a name="M000021"></a>
|
|
119
125
|
|
|
120
126
|
<div class="method-heading">
|
|
121
|
-
<a href="String.src/
|
|
122
|
-
onclick="popupCode('String.src/
|
|
127
|
+
<a href="String.src/M000021.html" target="Code" class="method-signature"
|
|
128
|
+
onclick="popupCode('String.src/M000021.html');return false;">
|
|
123
129
|
<span class="method-name">to_f</span><span class="method-args">(aRadix = 10)</span>
|
|
124
130
|
</a>
|
|
125
131
|
</div>
|
|
@@ -132,12 +138,12 @@ The default radix is 10.
|
|
|
132
138
|
</div>
|
|
133
139
|
</div>
|
|
134
140
|
|
|
135
|
-
<div id="method-
|
|
136
|
-
<a name="
|
|
141
|
+
<div id="method-M000023" class="method-detail">
|
|
142
|
+
<a name="M000023"></a>
|
|
137
143
|
|
|
138
144
|
<div class="method-heading">
|
|
139
|
-
<a href="String.src/
|
|
140
|
-
onclick="popupCode('String.src/
|
|
145
|
+
<a href="String.src/M000023.html" target="Code" class="method-signature"
|
|
146
|
+
onclick="popupCode('String.src/M000023.html');return false;">
|
|
141
147
|
<span class="method-name">to_ruby_const_name</span><span class="method-args">()</span>
|
|
142
148
|
</a>
|
|
143
149
|
</div>
|
|
@@ -149,12 +155,12 @@ Converts this string into a valid Ruby constant name.
|
|
|
149
155
|
</div>
|
|
150
156
|
</div>
|
|
151
157
|
|
|
152
|
-
<div id="method-
|
|
153
|
-
<a name="
|
|
158
|
+
<div id="method-M000022" class="method-detail">
|
|
159
|
+
<a name="M000022"></a>
|
|
154
160
|
|
|
155
161
|
<div class="method-heading">
|
|
156
|
-
<a href="String.src/
|
|
157
|
-
onclick="popupCode('String.src/
|
|
162
|
+
<a href="String.src/M000022.html" target="Code" class="method-signature"
|
|
163
|
+
onclick="popupCode('String.src/M000022.html');return false;">
|
|
158
164
|
<span class="method-name">verilog_to_ruby</span><span class="method-args">()</span>
|
|
159
165
|
</a>
|
|
160
166
|
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>to_f (String)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/float.rb, line 9</span>
|
|
14
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_f</span> <span class="ruby-identifier">aRadix</span> = <span class="ruby-value">10</span>
|
|
15
|
+
10: <span class="ruby-identifier">whole</span>, <span class="ruby-identifier">frac</span> = <span class="ruby-identifier">split</span>(<span class="ruby-value str">'.'</span>, <span class="ruby-value">2</span>)
|
|
16
|
+
11: <span class="ruby-identifier">whole</span> = <span class="ruby-identifier">whole</span>.<span class="ruby-identifier">to_i</span>(<span class="ruby-identifier">aRadix</span>).<span class="ruby-identifier">to_f</span>
|
|
17
|
+
12:
|
|
18
|
+
13: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">frac</span>
|
|
19
|
+
14: <span class="ruby-identifier">f</span> = <span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
|
20
|
+
15:
|
|
21
|
+
16: <span class="ruby-identifier">frac</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
|
22
|
+
17: <span class="ruby-identifier">power</span> = <span class="ruby-identifier">i</span>.<span class="ruby-identifier">next</span>
|
|
23
|
+
18: <span class="ruby-identifier">weight</span> = <span class="ruby-identifier">aRadix</span> <span class="ruby-operator">**</span> <span class="ruby-operator">-</span><span class="ruby-identifier">power</span>
|
|
24
|
+
19: <span class="ruby-identifier">digit</span> = <span class="ruby-identifier">frac</span>[<span class="ruby-identifier">i</span>, <span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>(<span class="ruby-identifier">aRadix</span>)
|
|
25
|
+
20:
|
|
26
|
+
21: <span class="ruby-identifier">f</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">digit</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">weight</span>
|
|
27
|
+
22: <span class="ruby-keyword kw">end</span>
|
|
28
|
+
23:
|
|
29
|
+
24: <span class="ruby-identifier">f</span> = <span class="ruby-operator">-</span><span class="ruby-identifier">f</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^-/</span>
|
|
30
|
+
25: <span class="ruby-identifier">whole</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">f</span>
|
|
31
|
+
26: <span class="ruby-keyword kw">end</span>
|
|
32
|
+
27:
|
|
33
|
+
28: <span class="ruby-identifier">whole</span>
|
|
34
|
+
29: <span class="ruby-keyword kw">end</span></pre>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|