ruby-vpi 9.0.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +120 -56
- data/MEMO +8 -0
- data/README +1 -1
- data/Rakefile +2 -2
- data/bin/generate_test.rb +11 -12
- data/bin/generate_test_tpl/bench.rb +2 -2
- data/bin/generate_test_tpl/bench.v +1 -4
- data/bin/generate_test_tpl/design.rb +6 -20
- data/bin/generate_test_tpl/proto.rb +5 -3
- data/bin/generate_test_tpl/runner.rake +2 -1
- data/bin/generate_test_tpl/spec.rb +5 -12
- data/doc/background.organization.html +1 -1
- data/doc/background.running-tests.html +1 -1
- data/doc/index.html +2 -2
- data/doc/manual.txt +276 -223
- data/doc/problem.ivl.html +3 -3
- data/doc/problems.html +1 -1
- data/doc/problems.ruby.html +1 -1
- data/doc/problems.vsim.html +1 -1
- data/doc/setup.html +3 -0
- data/doc/setup.installation.html +9 -0
- data/doc/setup.maintenance.html +3 -0
- data/doc/setup.reqs.html +3 -0
- data/doc/src/manual.xml +232 -195
- data/doc/styles/manual.css +8 -0
- data/doc/usage.examples.html +1 -1
- data/doc/usage.html +1 -1
- data/doc/usage.tools.html +7 -1
- data/doc/usage.tutorial.html +50 -56
- data/history.html +195 -77
- data/history.part.html +195 -77
- data/lib/ruby-vpi/vpi.rb +13 -1
- data/lib/ruby-vpi.rb +18 -7
- data/memo.html +19 -0
- data/memo.part.html +19 -0
- data/readme.html +1 -1
- data/readme.part.html +1 -1
- data/samp/counter/counter_rspec_bench.rb +2 -2
- data/samp/counter/counter_rspec_bench.v +1 -4
- data/samp/counter/counter_rspec_design.rb +4 -18
- data/samp/counter/counter_rspec_proto.rb +7 -5
- data/samp/counter/counter_rspec_runner.rake +2 -1
- data/samp/counter/counter_rspec_spec.rb +8 -12
- data/samp/counter/counter_xunit_bench.rb +2 -2
- data/samp/counter/counter_xunit_bench.v +1 -4
- data/samp/counter/counter_xunit_design.rb +4 -18
- data/samp/counter/counter_xunit_proto.rb +7 -5
- data/samp/counter/counter_xunit_runner.rake +2 -1
- data/samp/counter/counter_xunit_spec.rb +8 -14
- data/samp/pipelined_alu/hw5_unit_test_bench.rb +3 -3
- data/samp/pipelined_alu/hw5_unit_test_bench.v +1 -4
- data/samp/pipelined_alu/hw5_unit_test_design.rb +49 -65
- data/samp/pipelined_alu/hw5_unit_test_proto.rb +9 -5
- data/samp/pipelined_alu/hw5_unit_test_runner.rake +2 -1
- data/samp/pipelined_alu/hw5_unit_test_spec.rb +18 -21
- metadata +8 -242
- data/doc/usage.installation.html +0 -9
- data/doc/usage.recommendations.html +0 -3
- data/doc/usage.requirements.html +0 -3
- data/ref/c/annotated.html +0 -35
- data/ref/c/common_8h.html +0 -146
- data/ref/c/doxygen.css +0 -358
- data/ref/c/doxygen.png +0 -0
- data/ref/c/files.html +0 -34
- data/ref/c/functions.html +0 -134
- data/ref/c/functions_vars.html +0 -134
- data/ref/c/globals.html +0 -55
- data/ref/c/globals_0x63.html +0 -86
- data/ref/c/globals_0x65.html +0 -55
- data/ref/c/globals_0x66.html +0 -55
- data/ref/c/globals_0x70.html +0 -71
- data/ref/c/globals_0x72.html +0 -62
- data/ref/c/globals_0x73.html +0 -65
- data/ref/c/globals_0x74.html +0 -55
- data/ref/c/globals_0x76.html +0 -472
- data/ref/c/globals_0x78.html +0 -55
- data/ref/c/globals_defs.html +0 -81
- data/ref/c/globals_defs_0x65.html +0 -50
- data/ref/c/globals_defs_0x70.html +0 -51
- data/ref/c/globals_defs_0x76.html +0 -463
- data/ref/c/globals_defs_0x78.html +0 -50
- data/ref/c/globals_enum.html +0 -39
- data/ref/c/globals_eval.html +0 -40
- data/ref/c/globals_func.html +0 -49
- data/ref/c/globals_type.html +0 -63
- data/ref/c/globals_vars.html +0 -42
- data/ref/c/index.html +0 -20
- data/ref/c/relay_8c.html +0 -214
- data/ref/c/relay_8h.html +0 -129
- data/ref/c/structrelay____RubyOptions____def.html +0 -67
- data/ref/c/structt__cb__data.html +0 -151
- data/ref/c/structt__vpi__delay.html +0 -134
- data/ref/c/structt__vpi__error__info.html +0 -151
- data/ref/c/structt__vpi__strengthval.html +0 -83
- data/ref/c/structt__vpi__systf__data.html +0 -151
- data/ref/c/structt__vpi__time.html +0 -100
- data/ref/c/structt__vpi__value.html +0 -204
- data/ref/c/structt__vpi__vecval.html +0 -66
- data/ref/c/structt__vpi__vlog__info.html +0 -100
- data/ref/c/swig_8c.html +0 -80
- data/ref/c/swig_8h.html +0 -83
- data/ref/c/tab_b.gif +0 -0
- data/ref/c/tab_l.gif +0 -0
- data/ref/c/tab_r.gif +0 -0
- data/ref/c/tabs.css +0 -102
- data/ref/c/verilog_8h.html +0 -117
- data/ref/c/vlog_8c.html +0 -168
- data/ref/c/vlog_8h.html +0 -128
- data/ref/c/vpi__user_8h.html +0 -8739
- data/ref/ruby/classes/ERB.html +0 -158
- data/ref/ruby/classes/ERB.src/M000034.html +0 -29
- data/ref/ruby/classes/FileUtils.html +0 -165
- data/ref/ruby/classes/FileUtils.src/M000089.html +0 -18
- data/ref/ruby/classes/FileUtils.src/M000090.html +0 -18
- data/ref/ruby/classes/Integer.html +0 -398
- data/ref/ruby/classes/Integer.src/M000012.html +0 -25
- data/ref/ruby/classes/Integer.src/M000013.html +0 -18
- data/ref/ruby/classes/Integer.src/M000014.html +0 -18
- data/ref/ruby/classes/Integer.src/M000015.html +0 -18
- data/ref/ruby/classes/Integer.src/M000016.html +0 -18
- data/ref/ruby/classes/Integer.src/M000017.html +0 -18
- data/ref/ruby/classes/Integer.src/M000020.html +0 -22
- data/ref/ruby/classes/Integer.src/M000021.html +0 -22
- data/ref/ruby/classes/Integer.src/M000022.html +0 -25
- data/ref/ruby/classes/Integer.src/M000023.html +0 -31
- data/ref/ruby/classes/Integer.src/M000024.html +0 -25
- data/ref/ruby/classes/Integer.src/M000025.html +0 -30
- data/ref/ruby/classes/OutputInfo.html +0 -299
- data/ref/ruby/classes/OutputInfo.src/M000030.html +0 -51
- data/ref/ruby/classes/RDoc.html +0 -135
- data/ref/ruby/classes/RDoc.src/M000093.html +0 -40
- data/ref/ruby/classes/RubyVpi/Config.html +0 -148
- data/ref/ruby/classes/RubyVpi.html +0 -186
- data/ref/ruby/classes/RubyVpi.src/M000091.html +0 -50
- data/ref/ruby/classes/RubyVpi.src/M000092.html +0 -20
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.html +0 -407
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000081.html +0 -18
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000082.html +0 -18
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000083.html +0 -22
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000084.html +0 -44
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000085.html +0 -82
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000086.html +0 -127
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000087.html +0 -26
- data/ref/ruby/classes/SWIG/TYPE_p_unsigned_int.src/M000088.html +0 -18
- data/ref/ruby/classes/SWIG.html +0 -111
- data/ref/ruby/classes/String.html +0 -158
- data/ref/ruby/classes/String.src/M000032.html +0 -41
- data/ref/ruby/classes/String.src/M000033.html +0 -18
- data/ref/ruby/classes/Table.html +0 -191
- data/ref/ruby/classes/Table.src/M000026.html +0 -38
- data/ref/ruby/classes/Table.src/M000027.html +0 -18
- data/ref/ruby/classes/Table.src/M000028.html +0 -18
- data/ref/ruby/classes/Table.src/M000029.html +0 -18
- data/ref/ruby/classes/Template.html +0 -158
- data/ref/ruby/classes/Template.src/M000031.html +0 -18
- data/ref/ruby/classes/VerilogParser/Module/Parameter.html +0 -160
- data/ref/ruby/classes/VerilogParser/Module/Parameter.src/M000011.html +0 -21
- data/ref/ruby/classes/VerilogParser/Module/Port.html +0 -207
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000007.html +0 -21
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000008.html +0 -18
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000009.html +0 -18
- data/ref/ruby/classes/VerilogParser/Module/Port.src/M000010.html +0 -18
- data/ref/ruby/classes/VerilogParser/Module.html +0 -172
- data/ref/ruby/classes/VerilogParser/Module.src/M000006.html +0 -29
- data/ref/ruby/classes/VerilogParser.html +0 -187
- data/ref/ruby/classes/VerilogParser.src/M000005.html +0 -34
- data/ref/ruby/classes/XX/Document.html +0 -295
- data/ref/ruby/classes/XX/Document.src/M000072.html +0 -22
- data/ref/ruby/classes/XX/Document.src/M000073.html +0 -20
- data/ref/ruby/classes/XX/Document.src/M000074.html +0 -20
- data/ref/ruby/classes/XX/Document.src/M000075.html +0 -20
- data/ref/ruby/classes/XX/Document.src/M000076.html +0 -22
- data/ref/ruby/classes/XX/Document.src/M000077.html +0 -21
- data/ref/ruby/classes/XX/Document.src/M000078.html +0 -21
- data/ref/ruby/classes/XX/Document.src/M000079.html +0 -34
- data/ref/ruby/classes/XX/Document.src/M000080.html +0 -98
- data/ref/ruby/classes/XX/HTML4/Strict.html +0 -138
- data/ref/ruby/classes/XX/HTML4/Strict.src/M000038.html +0 -20
- data/ref/ruby/classes/XX/HTML4/Transitional.html +0 -138
- data/ref/ruby/classes/XX/HTML4/Transitional.src/M000037.html +0 -20
- data/ref/ruby/classes/XX/HTML4.html +0 -145
- data/ref/ruby/classes/XX/HTML4.src/M000036.html +0 -20
- data/ref/ruby/classes/XX/Markup/ClassMethods.html +0 -236
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000044.html +0 -22
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000045.html +0 -20
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000046.html +0 -25
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000047.html +0 -20
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000048.html +0 -27
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000049.html +0 -20
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000050.html +0 -27
- data/ref/ruby/classes/XX/Markup/ClassMethods.src/M000051.html +0 -22
- data/ref/ruby/classes/XX/Markup/Error.html +0 -111
- data/ref/ruby/classes/XX/Markup/InstanceMethods.html +0 -474
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000052.html +0 -56
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000053.html +0 -33
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000054.html +0 -31
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000055.html +0 -48
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000056.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000057.html +0 -31
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000058.html +0 -32
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000059.html +0 -32
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000060.html +0 -28
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000061.html +0 -23
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000062.html +0 -26
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000063.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000064.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000065.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000066.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000067.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000068.html +0 -21
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000069.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000070.html +0 -20
- data/ref/ruby/classes/XX/Markup/InstanceMethods.src/M000071.html +0 -20
- data/ref/ruby/classes/XX/Markup.html +0 -160
- data/ref/ruby/classes/XX/Markup.src/M000043.html +0 -28
- data/ref/ruby/classes/XX/XHTML/Strict.html +0 -138
- data/ref/ruby/classes/XX/XHTML/Strict.src/M000041.html +0 -20
- data/ref/ruby/classes/XX/XHTML/Transitional.html +0 -138
- data/ref/ruby/classes/XX/XHTML/Transitional.src/M000040.html +0 -20
- data/ref/ruby/classes/XX/XHTML.html +0 -145
- data/ref/ruby/classes/XX/XHTML.src/M000039.html +0 -36
- data/ref/ruby/classes/XX/XML.html +0 -138
- data/ref/ruby/classes/XX/XML.src/M000035.html +0 -20
- data/ref/ruby/classes/XX/XMLish.html +0 -138
- data/ref/ruby/classes/XX/XMLish.src/M000042.html +0 -18
- data/ref/ruby/classes/XX.html +0 -138
- data/ref/ruby/created.rid +0 -1
- data/ref/ruby/files/bin/generate_test_rb.html +0 -245
- data/ref/ruby/files/bin/generate_test_rb.src/M000001.html +0 -18
- data/ref/ruby/files/bin/generate_test_rb.src/M000002.html +0 -39
- data/ref/ruby/files/bin/header_to_ruby_rb.html +0 -125
- data/ref/ruby/files/lib/ruby-vpi/erb_rb.html +0 -108
- data/ref/ruby/files/lib/ruby-vpi/integer_rb.html +0 -101
- data/ref/ruby/files/lib/ruby-vpi/rake_rb.html +0 -108
- data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +0 -111
- data/ref/ruby/files/lib/ruby-vpi/rdoc_rb.html +0 -108
- data/ref/ruby/files/lib/ruby-vpi/rspec_rb.html +0 -115
- data/ref/ruby/files/lib/ruby-vpi/runner_proxy_rb.html +0 -108
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +0 -208
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000003.html +0 -24
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.src/M000004.html +0 -26
- data/ref/ruby/files/lib/ruby-vpi/verilog_parser_rb.html +0 -107
- data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +0 -108
- data/ref/ruby/files/lib/ruby-vpi/xx_rb.html +0 -148
- data/ref/ruby/files/lib/ruby-vpi_rb.html +0 -109
- data/ref/ruby/fr_class_index.html +0 -56
- data/ref/ruby/fr_file_index.html +0 -40
- data/ref/ruby/fr_method_index.html +0 -119
- data/ref/ruby/index.html +0 -24
- data/ref/ruby/rdoc-style.css +0 -208
data/doc/manual.txt
CHANGED
@@ -16,8 +16,9 @@ in the section entitled "GNU Free Documentation License".
|
|
16
16
|
|
17
17
|
Abstract
|
18
18
|
|
19
|
-
This manual explains how to use Ruby-VPI.
|
20
|
-
|
19
|
+
This manual explains how to use Ruby-VPI. A plain-text version of this manual
|
20
|
+
is also available. Finally, you can find the newest version of this manual at
|
21
|
+
the Ruby-VPI website.
|
21
22
|
|
22
23
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
23
24
|
|
@@ -45,20 +46,25 @@ Table of Contents
|
|
45
46
|
Initialization
|
46
47
|
Execution
|
47
48
|
|
48
|
-
3.
|
49
|
+
3. Setup
|
49
50
|
|
50
51
|
Requirements
|
51
|
-
|
52
|
-
|
52
|
+
|
53
|
+
Recommendations
|
54
|
+
|
55
|
+
Installation
|
53
56
|
|
54
57
|
Installing on Windows
|
55
58
|
|
59
|
+
Maintenance
|
60
|
+
|
61
|
+
4. Usage
|
62
|
+
|
56
63
|
Tools
|
57
64
|
|
58
65
|
Automated test generation
|
59
66
|
Verilog to Ruby conversion
|
60
67
|
|
61
|
-
Examples
|
62
68
|
Tutorial
|
63
69
|
|
64
70
|
Start with a design
|
@@ -69,7 +75,9 @@ Table of Contents
|
|
69
75
|
Implement the design
|
70
76
|
Verify the design
|
71
77
|
|
72
|
-
|
78
|
+
Examples
|
79
|
+
|
80
|
+
5. Known problems
|
73
81
|
|
74
82
|
Ruby
|
75
83
|
|
@@ -107,17 +115,17 @@ List of Figures
|
|
107
115
|
2.2. Detailed organization of a test
|
108
116
|
2.3. Initialization of a test
|
109
117
|
2.4. Execution of a test
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
4.1. Declaration of a simple up-counter with synchronous reset
|
119
|
+
4.2. Generating a test with specification in rSpec format
|
120
|
+
4.3. Generating a test with specification in xUnit format
|
121
|
+
4.4. Specification implemented in rSpec format
|
122
|
+
4.5. Specification implemented in xUnit format
|
123
|
+
4.6. Ruby prototype of our Verilog design
|
124
|
+
4.7. Running a test with specification in rSpec format
|
125
|
+
4.8. Running a test with specification in xUnit format
|
126
|
+
4.9. Implementation of a simple up-counter with synchronous reset
|
127
|
+
4.10. Running a test with specification in rSpec format
|
128
|
+
4.11. Running a test with specification in xUnit format
|
121
129
|
|
122
130
|
List of Tables
|
123
131
|
|
@@ -127,9 +135,9 @@ List of Tables
|
|
127
135
|
List of Examples
|
128
136
|
|
129
137
|
2.1. Accessing a handle's VPI properties
|
130
|
-
|
131
|
-
|
132
|
-
|
138
|
+
5.1. Part of a bench which instantiates a Verilog design
|
139
|
+
5.2. Bad design with unconnected registers
|
140
|
+
5.3. Fixed design with wired registers
|
133
141
|
|
134
142
|
Chapter 1. Introduction
|
135
143
|
|
@@ -356,7 +364,17 @@ VPI utility layer
|
|
356
364
|
|
357
365
|
From a user's perspective, the VPI utility layer greatly enhances the ability
|
358
366
|
to interact with handles. One simply invokes a handle's methods, which are
|
359
|
-
carefully named in the following manner, to access its
|
367
|
+
carefully named in the following manner, to access either (1) its children or
|
368
|
+
(2) its VPI properties.
|
369
|
+
|
370
|
+
The children of a handle are simply the handles that are immediately contained
|
371
|
+
within it in. For example, suppose that you had a Verilog module that contains
|
372
|
+
some registers. The children, of a handle to the module, would be handles to
|
373
|
+
the registers.
|
374
|
+
|
375
|
+
In the event that a child handle has the same name as a VPI property, the child
|
376
|
+
is given priority. However, you can always access VPI properties explicitly via
|
377
|
+
the get_value and put_value methods.
|
360
378
|
|
361
379
|
Table 2.1. Naming format for accessing a handle's VPI properties
|
362
380
|
|
@@ -560,31 +578,19 @@ Procedure 2.2. Execution of a test
|
|
560
578
|
3. When the Ruby interpreter invokes the Vpi::relay_verilog method, it is
|
561
579
|
paused and the Verilog simulator is given control.
|
562
580
|
|
563
|
-
Chapter 3.
|
581
|
+
Chapter 3. Setup
|
564
582
|
|
565
583
|
Table of Contents
|
566
584
|
|
567
585
|
Requirements
|
568
|
-
Recommendations
|
569
|
-
Installation and maintenance
|
570
586
|
|
571
|
-
|
572
|
-
|
573
|
-
Tools
|
587
|
+
Recommendations
|
574
588
|
|
575
|
-
|
576
|
-
Verilog to Ruby conversion
|
589
|
+
Installation
|
577
590
|
|
578
|
-
|
579
|
-
Tutorial
|
591
|
+
Installing on Windows
|
580
592
|
|
581
|
-
|
582
|
-
Generate a test
|
583
|
-
Specify your expectations
|
584
|
-
Implement the prototype
|
585
|
-
Verify the prototype
|
586
|
-
Implement the design
|
587
|
-
Verify the design
|
593
|
+
Maintenance
|
588
594
|
|
589
595
|
Requirements
|
590
596
|
|
@@ -644,13 +650,9 @@ Text merging tool
|
|
644
650
|
|
645
651
|
An interactive text merging tool can greatly simplify the process of
|
646
652
|
transferring wanted changes from one file to another. In particular, such
|
647
|
-
tools are especially beneficial when using the automated test generator.
|
648
|
-
|
649
|
-
|
650
|
-
imediff2
|
651
|
-
|
652
|
-
A textual, fullscreen two-way merging tool, which works in a terminal.
|
653
|
-
Useful when working remotely via SSH.
|
653
|
+
tools are especially beneficial when using the automated test generator. A
|
654
|
+
handful of the currently available open-source text merging tools are
|
655
|
+
listed below.
|
654
656
|
|
655
657
|
kdiff3
|
656
658
|
|
@@ -669,7 +671,12 @@ Text merging tool
|
|
669
671
|
|
670
672
|
A graphical, three-way merging tool.
|
671
673
|
|
672
|
-
|
674
|
+
imediff2
|
675
|
+
|
676
|
+
A textual, fullscreen two-way merging tool. This tool is useful when
|
677
|
+
you are working remotely via SSH.
|
678
|
+
|
679
|
+
Installation
|
673
680
|
|
674
681
|
Once you have satisfied the necessary requirements, you can install Ruby-VPI by
|
675
682
|
running the command gem install ruby-vpi. RubyGems will install Ruby-VPI into
|
@@ -683,11 +690,6 @@ $ gem env gemdir
|
|
683
690
|
$ ls -d /usr/lib/ruby/gems/1.8/gems/ruby-vpi-*
|
684
691
|
/usr/lib/ruby/gems/1.8/gems/ruby-vpi-7.0.0/
|
685
692
|
|
686
|
-
You can uninstall Ruby-VPI by running the command gem uninstall ruby-vpi.
|
687
|
-
Furthermore, you can upgrade to the latest release of Ruby-VPI by running the
|
688
|
-
command gem update ruby-vpi. Finally, you can learn more about using and
|
689
|
-
manipulating RubyGems in the RubyGems user manual.
|
690
|
-
|
691
693
|
Installing on Windows
|
692
694
|
|
693
695
|
1. Install Cygwin, the Linux-like environment for Windows.
|
@@ -700,20 +702,61 @@ Installing on Windows
|
|
700
702
|
x in *.{o,so,dll}; do nm $x | grep -q '[Tt] _vpi' > /dev/null && echo $x;
|
701
703
|
done in Cygwin.
|
702
704
|
|
703
|
-
|
704
|
-
|
705
|
+
[Tip] Tip
|
706
|
+
If you are using Mentor Modelsim, the desired object file can be
|
707
|
+
found at a path similar to C:\Modeltech\win32\libvsim.dll.
|
705
708
|
|
706
|
-
|
707
|
-
|
709
|
+
[Tip] Tip
|
710
|
+
If you are using GPL Cver, the desired object file can be found at a
|
711
|
+
path similar to C:\gplcver\objs\v_vpi.o.
|
708
712
|
|
709
713
|
4. Assign the path of the object file (determined in the previous step) to the
|
710
714
|
LDFLAGS environment variable. For example, if the object file's path is /
|
711
|
-
|
712
|
-
|
715
|
+
foo/bar/vpi.so, then you would run the command export LDFLAGS=/foo/bar/
|
716
|
+
vpi.so in Cygwin.
|
713
717
|
|
714
718
|
5. You may now install Ruby-VPI by running the command gem install ruby-vpi in
|
715
719
|
Cygwin.
|
716
720
|
|
721
|
+
Maintenance
|
722
|
+
|
723
|
+
You can uninstall Ruby-VPI by running the command gem uninstall ruby-vpi.
|
724
|
+
Furthermore, you can upgrade to the latest release of Ruby-VPI by running the
|
725
|
+
command gem update ruby-vpi. Finally, you can learn more about using and
|
726
|
+
manipulating RubyGems in the RubyGems user manual.
|
727
|
+
|
728
|
+
|
729
|
+
━━━━━━━━━━━━━━
|
730
|
+
|
731
|
+
^[1] Because Ruby-VPI makes use of the VPI C-language interface, it links to
|
732
|
+
symbols whose names begin with _vpi. It is possible for these symbols to be
|
733
|
+
undefined when Ruby-VPI is compiled under GNU/Linux and similar operating
|
734
|
+
systems. In contrast, one cannot compile a shared object file with references
|
735
|
+
to undefined symbols under Windows. Thus, we must find a Verilog simulator's
|
736
|
+
shared object file, which contains definitions of all VPI symbols, and give
|
737
|
+
this file to the linker when compiling Ruby-VPI.
|
738
|
+
|
739
|
+
Chapter 4. Usage
|
740
|
+
|
741
|
+
Table of Contents
|
742
|
+
|
743
|
+
Tools
|
744
|
+
|
745
|
+
Automated test generation
|
746
|
+
Verilog to Ruby conversion
|
747
|
+
|
748
|
+
Tutorial
|
749
|
+
|
750
|
+
Start with a design
|
751
|
+
Generate a test
|
752
|
+
Specify your expectations
|
753
|
+
Implement the prototype
|
754
|
+
Verify the prototype
|
755
|
+
Implement the design
|
756
|
+
Verify the design
|
757
|
+
|
758
|
+
Examples
|
759
|
+
|
717
760
|
Tools
|
718
761
|
|
719
762
|
The bin directory contains various utilities which ease the process of writing
|
@@ -722,28 +765,61 @@ option.
|
|
722
765
|
|
723
766
|
Automated test generation
|
724
767
|
|
725
|
-
The generate_test.rb
|
726
|
-
|
727
|
-
|
768
|
+
The automated test generator (generate_test.rb) generates tests from Verilog
|
769
|
+
2001 module declarations, as demonstrated in the section called “Generate a
|
770
|
+
test”. A generated test is composed of the following parts:
|
728
771
|
|
729
|
-
|
772
|
+
Runner
|
730
773
|
|
731
|
-
|
732
|
-
Ruby. You can try it by running the command header_to_ruby.rb --help.
|
774
|
+
Written in Rake, this file builds and runs the test.
|
733
775
|
|
734
|
-
|
776
|
+
Bench
|
735
777
|
|
736
|
-
|
737
|
-
can be used. Each example has an associated Rakefile which simplifies the
|
738
|
-
process of running it. Therefore, simply navigate into an example directory and
|
739
|
-
run the command rake to get started.
|
778
|
+
Written in Verilog and Ruby, these files define the testing environment.
|
740
779
|
|
741
|
-
|
742
|
-
|
780
|
+
Design
|
781
|
+
|
782
|
+
Written in Ruby, this file provides an interface to the design being
|
783
|
+
verified.
|
784
|
+
|
785
|
+
Prototype
|
786
|
+
|
787
|
+
Written in Ruby, this file defines a prototype of the design being
|
788
|
+
verified.
|
789
|
+
|
790
|
+
Specification
|
791
|
+
|
792
|
+
Written in Ruby, this file verifies the design.
|
793
|
+
|
794
|
+
The reason for dividing a single test into these parts is mainly to decouple
|
795
|
+
the design from the specification. This allows you to focus on writing the
|
796
|
+
specification while the remainder is automatically generated by the tool. For
|
797
|
+
example, when the interface of a Verilog module changes, you would simply
|
798
|
+
re-run this tool and incorporate those changes (using a text merging tool) into
|
799
|
+
the test without diverting your focus from the specification.
|
800
|
+
|
801
|
+
[Tip] Using kdiff3 with the automated test generator
|
802
|
+
Create a file named merge2 with the content below, make it executable,
|
803
|
+
and put it somewhere accessible by your PATH environment variable. Next,
|
804
|
+
update the MERGER environment variable by executing export MERGER=merge2.
|
805
|
+
|
806
|
+
#!/bin/sh
|
807
|
+
# args: old file, new file
|
808
|
+
kdiff3 --auto --merge --output "$2" "$@" 2>/dev/null
|
809
|
+
|
810
|
+
From now on, kdiff3 will be invoked to help you transfer your changes
|
811
|
+
between generated files. When you are finished transferring changes,
|
812
|
+
simply issue the "save the file" command and terminate kdiff3. Or, if you
|
813
|
+
do not want to transfer any changes, simply terminate kdiff3.
|
814
|
+
|
815
|
+
Verilog to Ruby conversion
|
816
|
+
|
817
|
+
The header_to_ruby.rb tool can be used to convert Verilog header files into
|
818
|
+
Ruby. You can try it by running the command header_to_ruby.rb --help.
|
743
819
|
|
744
820
|
Tutorial
|
745
821
|
|
746
|
-
Procedure
|
822
|
+
Procedure 4.1. Typical way of using Ruby-VPI
|
747
823
|
|
748
824
|
1. Declare the design, which is a Verilog module, using Verilog 2001 syntax.
|
749
825
|
|
@@ -762,7 +838,7 @@ Procedure 3.2. Typical way of using Ruby-VPI
|
|
762
838
|
|
763
839
|
Start with a design
|
764
840
|
|
765
|
-
First, we need a Design to verify. In this tutorial, Figure
|
841
|
+
First, we need a Design to verify. In this tutorial, Figure 4.1, “Declaration
|
766
842
|
of a simple up-counter with synchronous reset” will serve as our design. Its
|
767
843
|
interface is composed of the following parts:
|
768
844
|
|
@@ -783,11 +859,7 @@ count
|
|
783
859
|
|
784
860
|
This register contains the counter's value.
|
785
861
|
|
786
|
-
|
787
|
-
Save the source code shown in Figure 3.1, “Declaration of a simple
|
788
|
-
up-counter with synchronous reset” into a file named counter.v.
|
789
|
-
|
790
|
-
Figure 3.1. Declaration of a simple up-counter with synchronous reset
|
862
|
+
Figure 4.1. Declaration of a simple up-counter with synchronous reset
|
791
863
|
|
792
864
|
module counter #(parameter Size = 5) (
|
793
865
|
input clock,
|
@@ -796,54 +868,25 @@ module counter #(parameter Size = 5) (
|
|
796
868
|
);
|
797
869
|
endmodule
|
798
870
|
|
871
|
+
[Important] Before we continue…
|
872
|
+
Save the source code shown in Figure 4.1, “Declaration of a simple
|
873
|
+
up-counter with synchronous reset” into a file named counter.v.
|
874
|
+
|
799
875
|
Generate a test
|
800
876
|
|
801
877
|
Now that we have a Design to verify, let us generate a Test for it using the
|
802
|
-
automated test generator
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
[Note] Note
|
808
|
-
In this tutorial, you will see how specifications are implemented in
|
809
|
-
both rSpec and xUnit formats.
|
878
|
+
automated test generator. This tool allows us to implement our Specification in
|
879
|
+
either rSpec, xUnit, or our very own format. Each format represents a different
|
880
|
+
software development methodology: rSpec represents BDD, xUnit represents TDD,
|
881
|
+
and our own format can represent another methodology. Both rSpec and xUnit are
|
882
|
+
presented in this tutorial.
|
810
883
|
|
811
884
|
Once we have decided how we want to implement our specification, we can proceed
|
812
|
-
to generate a test for our design. Figure
|
813
|
-
specification in rSpec format” and Figure
|
814
|
-
specification in xUnit format” illustrate this process.
|
815
|
-
generation tool produces a test composed of the following parts:
|
816
|
-
|
817
|
-
Runner
|
818
|
-
|
819
|
-
Written in Rake, this file builds and runs the test.
|
820
|
-
|
821
|
-
Bench
|
822
|
-
|
823
|
-
Written in Verilog and Ruby, these files define the testing environment.
|
824
|
-
|
825
|
-
Design
|
826
|
-
|
827
|
-
Written in Ruby, this file provides an interface to the design being
|
828
|
-
verified.
|
829
|
-
|
830
|
-
Prototype
|
831
|
-
|
832
|
-
Written in Ruby, this file defines a prototype of the design being
|
833
|
-
verified.
|
834
|
-
|
835
|
-
Specification
|
836
|
-
|
837
|
-
Written in Ruby, this file verifies the design.
|
838
|
-
|
839
|
-
The reason for dividing a single test into these parts is mainly to decouple
|
840
|
-
the design from the specification. This allows you to focus on writing the
|
841
|
-
specification while the remainder is automatically generated by the tool. For
|
842
|
-
example, when the interface of a Verilog module changes, you would simply
|
843
|
-
re-run this tool and incorporate those changes into the test without diverting
|
844
|
-
your focus from the specification.
|
885
|
+
to generate a test for our design. Figure 4.2, “Generating a test with
|
886
|
+
specification in rSpec format” and Figure 4.3, “Generating a test with
|
887
|
+
specification in xUnit format” illustrate this process.
|
845
888
|
|
846
|
-
Figure
|
889
|
+
Figure 4.2. Generating a test with specification in rSpec format
|
847
890
|
|
848
891
|
$ generate_test.rb counter.v --rspec --name rspec
|
849
892
|
|
@@ -859,7 +902,7 @@ $ generate_test.rb counter.v --rspec --name rspec
|
|
859
902
|
create counter_rspec_spec.rb
|
860
903
|
|
861
904
|
|
862
|
-
Figure
|
905
|
+
Figure 4.3. Generating a test with specification in xUnit format
|
863
906
|
|
864
907
|
$ generate_test.rb counter.v --xunit --name xunit
|
865
908
|
|
@@ -892,51 +935,31 @@ The following is a reasonable set of expectations for our simple counter:
|
|
892
935
|
● A counter with the maximum value should overflow upon increment.
|
893
936
|
|
894
937
|
Now that we have identified a set of expectations for our design, we are ready
|
895
|
-
to implement them in our specification. Figure
|
896
|
-
in rSpec format” and Figure
|
938
|
+
to implement them in our specification. Figure 4.4, “Specification implemented
|
939
|
+
in rSpec format” and Figure 4.5, “Specification implemented in xUnit format”
|
897
940
|
illustrate this process. Note the striking similarities between our
|
898
941
|
expectations and their implementation.
|
899
942
|
|
900
|
-
|
901
|
-
● Append the following code to the files named
|
902
|
-
counter_rspec_design.rb and counter_xunit_design.rb.
|
943
|
+
Figure 4.4. Specification implemented in rSpec format
|
903
944
|
|
904
|
-
|
905
|
-
|
906
|
-
@reset.intVal = 1
|
907
|
-
relay_verilog # advance the clock
|
908
|
-
@reset.intVal = 0
|
909
|
-
end
|
910
|
-
end
|
911
|
-
|
912
|
-
● Replace the contents of the file named counter_rspec_spec.rb
|
913
|
-
with the source code shown in Figure 3.4, “Specification
|
914
|
-
implemented in rSpec format”.
|
915
|
-
|
916
|
-
● Replace the contents of the file named counter_xunit_spec.rb
|
917
|
-
with the source code shown in Figure 3.5, “Specification
|
918
|
-
implemented in xUnit format”.
|
945
|
+
# lowest upper bound of counter's value
|
946
|
+
LIMIT = 2 ** Counter.Size.intVal
|
919
947
|
|
920
|
-
|
921
|
-
|
922
|
-
LIMIT = 2 ** Counter::Size # lowest upper bound of counter's value
|
923
|
-
MAX = LIMIT - 1 # maximum allowed value for a counter
|
924
|
-
|
925
|
-
include Vpi
|
948
|
+
# maximum allowed value for a counter
|
949
|
+
MAX = LIMIT - 1
|
926
950
|
|
927
951
|
context "A resetted counter's value" do
|
928
952
|
setup do
|
929
|
-
|
930
|
-
@design.reset!
|
953
|
+
Counter.reset!
|
931
954
|
end
|
932
955
|
|
933
956
|
specify "should be zero" do
|
934
|
-
|
957
|
+
Counter.count.intVal.should_equal 0
|
935
958
|
end
|
936
959
|
|
937
960
|
specify "should increment by one count upon each rising clock edge" do
|
938
961
|
LIMIT.times do |i|
|
939
|
-
|
962
|
+
Counter.count.intVal.should_equal i
|
940
963
|
relay_verilog # advance the clock
|
941
964
|
end
|
942
965
|
end
|
@@ -944,107 +967,129 @@ end
|
|
944
967
|
|
945
968
|
context "A counter with the maximum value" do
|
946
969
|
setup do
|
947
|
-
|
948
|
-
@design.reset!
|
970
|
+
Counter.reset!
|
949
971
|
|
950
972
|
# increment the counter to maximum value
|
951
973
|
MAX.times do relay_verilog end
|
952
|
-
|
974
|
+
Counter.count.intVal.should_equal MAX
|
953
975
|
end
|
954
976
|
|
955
977
|
specify "should overflow upon increment" do
|
956
978
|
relay_verilog # increment the counter
|
957
|
-
|
979
|
+
Counter.count.intVal.should_equal 0
|
958
980
|
end
|
959
981
|
end
|
960
982
|
|
961
|
-
Figure
|
983
|
+
Figure 4.5. Specification implemented in xUnit format
|
962
984
|
|
963
|
-
|
964
|
-
|
985
|
+
# lowest upper bound of counter's value
|
986
|
+
LIMIT = 2 ** Counter.Size.intVal
|
965
987
|
|
966
|
-
|
967
|
-
|
988
|
+
# maximum allowed value for a counter
|
989
|
+
MAX = LIMIT - 1
|
968
990
|
|
991
|
+
class ResettedCounterValue < Test::Unit::TestCase
|
969
992
|
def setup
|
970
|
-
|
971
|
-
@design.reset!
|
993
|
+
Counter.reset!
|
972
994
|
end
|
973
995
|
|
974
996
|
def test_zero
|
975
|
-
assert_equal 0,
|
997
|
+
assert_equal 0, Counter.count.intVal
|
976
998
|
end
|
977
999
|
|
978
1000
|
def test_increment
|
979
1001
|
LIMIT.times do |i|
|
980
|
-
assert_equal i,
|
1002
|
+
assert_equal i, Counter.count.intVal
|
981
1003
|
relay_verilog # advance the clock
|
982
1004
|
end
|
983
1005
|
end
|
984
1006
|
end
|
985
1007
|
|
986
1008
|
class MaximumCounterValue < Test::Unit::TestCase
|
987
|
-
include Vpi
|
988
|
-
|
989
1009
|
def setup
|
990
|
-
|
991
|
-
@design.reset!
|
1010
|
+
Counter.reset!
|
992
1011
|
|
993
1012
|
# increment the counter to maximum value
|
994
1013
|
MAX.times do relay_verilog end
|
995
|
-
assert_equal MAX,
|
1014
|
+
assert_equal MAX, Counter.count.intVal
|
996
1015
|
end
|
997
1016
|
|
998
1017
|
def test_overflow
|
999
1018
|
relay_verilog # increment the counter
|
1000
|
-
assert_equal 0,
|
1019
|
+
assert_equal 0, Counter.count.intVal
|
1001
1020
|
end
|
1002
1021
|
end
|
1003
1022
|
|
1023
|
+
[Important] Before we continue…
|
1024
|
+
● Replace the contents of the file named counter_rspec_spec.rb
|
1025
|
+
with the source code shown in Figure 4.4, “Specification
|
1026
|
+
implemented in rSpec format”.
|
1027
|
+
|
1028
|
+
● Replace the contents of the file named counter_xunit_spec.rb
|
1029
|
+
with the source code shown in Figure 4.5, “Specification
|
1030
|
+
implemented in xUnit format”.
|
1031
|
+
|
1032
|
+
● Replace the contents of the files named counter_rspec_design.rb
|
1033
|
+
and counter_xunit_design.rb with the following code. This code
|
1034
|
+
defines the reset! method which resets our Verilog design.
|
1035
|
+
|
1036
|
+
class << Counter
|
1037
|
+
def reset!
|
1038
|
+
reset.intVal = 1
|
1039
|
+
relay_verilog # advance the clock
|
1040
|
+
reset.intVal = 0
|
1041
|
+
end
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
|
1004
1045
|
Implement the prototype
|
1005
1046
|
|
1006
1047
|
Now that we have a Specification against which to verify our Design, let us
|
1007
1048
|
build a prototype of our design. By doing so, we exercise our specification,
|
1008
1049
|
experience potential problems that may arise when we later implement our design
|
1009
|
-
in Verilog, and gain confidence in our work. Figure
|
1050
|
+
in Verilog, and gain confidence in our work. Figure 4.6, “Ruby prototype of our
|
1010
1051
|
Verilog design” shows the completed prototype for our design.
|
1011
1052
|
|
1012
|
-
|
1013
|
-
Replace the contents of the files named counter_rspec_proto.rb and
|
1014
|
-
counter_xunit_proto.rb with the source code shown in Figure 3.6,
|
1015
|
-
“Ruby prototype of our Verilog design”.
|
1016
|
-
|
1017
|
-
Figure 3.6. Ruby prototype of our Verilog design
|
1053
|
+
Figure 4.6. Ruby prototype of our Verilog design
|
1018
1054
|
|
1019
|
-
class
|
1055
|
+
class << Counter
|
1020
1056
|
def simulate!
|
1021
|
-
if
|
1022
|
-
|
1057
|
+
if reset.intVal == 1
|
1058
|
+
count.intVal = 0
|
1023
1059
|
else
|
1024
|
-
|
1060
|
+
count.intVal += 1
|
1025
1061
|
end
|
1026
1062
|
end
|
1027
1063
|
end
|
1028
1064
|
|
1065
|
+
[Important] Before we continue…
|
1066
|
+
Replace the contents of the files named counter_rspec_proto.rb and
|
1067
|
+
counter_xunit_proto.rb with the source code shown in Figure 4.6,
|
1068
|
+
“Ruby prototype of our Verilog design”.
|
1069
|
+
|
1029
1070
|
Verify the prototype
|
1030
1071
|
|
1031
1072
|
Now that we have implemented our prototype, we are ready to verify it against
|
1032
|
-
our Specification by running the Test. Figure
|
1033
|
-
specification in rSpec format” and Figure
|
1073
|
+
our Specification by running the Test. Figure 4.7, “Running a test with
|
1074
|
+
specification in rSpec format” and Figure 4.8, “Running a test with
|
1034
1075
|
specification in xUnit format” illustrate this process.
|
1035
1076
|
|
1036
|
-
[Tip]
|
1077
|
+
[Tip] Reuse your past efforts!
|
1037
1078
|
The same specification can be used to verify both prototype and design.
|
1038
1079
|
|
1039
1080
|
Here, the PROTOTYPE environment variable is assigned a non-empty value while
|
1040
1081
|
running the test, so that, instead of our design, our prototype is verified
|
1041
1082
|
against our specification. You can also assign a value to PROTOTYPE before
|
1042
1083
|
running the test, by using your shell's export or setenv command. Finally, the
|
1043
|
-
Icarus Verilog simulator, denoted by
|
1084
|
+
Icarus Verilog simulator, denoted by cver, is used to run the simulation.
|
1044
1085
|
|
1045
|
-
|
1086
|
+
[Tip] What can the test runner do?
|
1087
|
+
If you invoke the test runner (1) without any arguments or (2) with the
|
1088
|
+
-T option, it will show you a list of tasks that it can perform for you.
|
1046
1089
|
|
1047
|
-
|
1090
|
+
Figure 4.7. Running a test with specification in rSpec format
|
1091
|
+
|
1092
|
+
$ rake -f counter_rspec_runner.rake cver PROTOTYPE=1
|
1048
1093
|
counter_rspec: verifying prototype instead of design
|
1049
1094
|
|
1050
1095
|
A resetted counter's value
|
@@ -1058,9 +1103,9 @@ Finished in 0.018199 seconds
|
|
1058
1103
|
|
1059
1104
|
3 specifications, 0 failures
|
1060
1105
|
|
1061
|
-
Figure
|
1106
|
+
Figure 4.8. Running a test with specification in xUnit format
|
1062
1107
|
|
1063
|
-
$ rake -f counter_xunit_runner.rake
|
1108
|
+
$ rake -f counter_xunit_runner.rake cver PROTOTYPE=1
|
1064
1109
|
counter_xunit: verifying prototype instead of design
|
1065
1110
|
|
1066
1111
|
Loaded suite counter_xunit_bench
|
@@ -1074,17 +1119,12 @@ Implement the design
|
|
1074
1119
|
|
1075
1120
|
Now that we have implemented and verified our prototype, we are ready to
|
1076
1121
|
implement our Design. This is often quite simple because we translate existing
|
1077
|
-
code from Ruby (our prototype) into Verilog (our design). Figure
|
1122
|
+
code from Ruby (our prototype) into Verilog (our design). Figure 4.9,
|
1078
1123
|
“Implementation of a simple up-counter with synchronous reset” illustrates the
|
1079
1124
|
result of this process. Once again, note the striking similarities between the
|
1080
1125
|
implementation of our prototype and design.
|
1081
1126
|
|
1082
|
-
|
1083
|
-
Replace the contents of the file named counter.v with the source
|
1084
|
-
code shown in Figure 3.9, “Implementation of a simple up-counter
|
1085
|
-
with synchronous reset”.
|
1086
|
-
|
1087
|
-
Figure 3.9. Implementation of a simple up-counter with synchronous reset
|
1127
|
+
Figure 4.9. Implementation of a simple up-counter with synchronous reset
|
1088
1128
|
|
1089
1129
|
module counter #(parameter Size = 5) (
|
1090
1130
|
input clock,
|
@@ -1099,22 +1139,35 @@ module counter #(parameter Size = 5) (
|
|
1099
1139
|
end
|
1100
1140
|
endmodule
|
1101
1141
|
|
1142
|
+
[Important] Before we continue…
|
1143
|
+
Replace the contents of the file named counter.v with the source
|
1144
|
+
code shown in Figure 4.9, “Implementation of a simple up-counter
|
1145
|
+
with synchronous reset”.
|
1146
|
+
|
1102
1147
|
Verify the design
|
1103
1148
|
|
1104
1149
|
Now that we have implemented our Design, we are ready to verify it against our
|
1105
|
-
Specification by running the Test. Figure
|
1106
|
-
specification in rSpec format” and Figure
|
1150
|
+
Specification by running the Test. Figure 4.10, “Running a test with
|
1151
|
+
specification in rSpec format” and Figure 4.11, “Running a test with
|
1107
1152
|
specification in xUnit format” illustrate this process.
|
1108
1153
|
|
1109
1154
|
Here, the PROTOTYPE environment variable is not specified while running the
|
1110
1155
|
test, so that our design, instead of our prototype, is verified against our
|
1111
1156
|
specification. You can also achieve this effect by assigning an empty value to
|
1112
|
-
PROTOTYPE, or by using your shell's unset command. Finally, the
|
1113
|
-
simulator, denoted by
|
1157
|
+
PROTOTYPE, or by using your shell's unset command. Finally, the GPL Cver
|
1158
|
+
Verilog simulator, denoted by cver, is used to run the simulation.
|
1159
|
+
|
1160
|
+
[Tip] Running multiple tests
|
1161
|
+
Create a file named Rakefile containing the following line.
|
1162
|
+
|
1163
|
+
require 'ruby-vpi/runner_proxy'
|
1114
1164
|
|
1115
|
-
|
1165
|
+
Now you can invoke all test runners in the current directory simply by
|
1166
|
+
executing rake cver (where cver denotes the GPL Cver simulator).
|
1116
1167
|
|
1117
|
-
|
1168
|
+
Figure 4.10. Running a test with specification in rSpec format
|
1169
|
+
|
1170
|
+
$ rake -f counter_rspec_runner.rake cver
|
1118
1171
|
A resetted counter's value
|
1119
1172
|
- should be zero
|
1120
1173
|
- should increment by one count upon each rising clock edge
|
@@ -1126,9 +1179,9 @@ Finished in 0.005628 seconds
|
|
1126
1179
|
|
1127
1180
|
3 specifications, 0 failures
|
1128
1181
|
|
1129
|
-
Figure
|
1182
|
+
Figure 4.11. Running a test with specification in xUnit format
|
1130
1183
|
|
1131
|
-
$ rake -f counter_xunit_runner.rake
|
1184
|
+
$ rake -f counter_xunit_runner.rake cver
|
1132
1185
|
Loaded suite counter_xunit_bench
|
1133
1186
|
Started
|
1134
1187
|
...
|
@@ -1136,18 +1189,17 @@ Finished in 0.006766 seconds.
|
|
1136
1189
|
|
1137
1190
|
3 tests, 35 assertions, 0 failures, 0 errors
|
1138
1191
|
|
1192
|
+
Examples
|
1139
1193
|
|
1140
|
-
|
1194
|
+
The samp directory contains several example tests which illustrate how Ruby-VPI
|
1195
|
+
can be used. Each example has an associated Rakefile which simplifies the
|
1196
|
+
process of running it. Therefore, simply navigate into an example directory and
|
1197
|
+
run the command rake to get started.
|
1141
1198
|
|
1142
|
-
|
1143
|
-
|
1144
|
-
to be undefined when Ruby-VPI is compiled under GNU/Linux and similar operating
|
1145
|
-
systems. In contrast, one cannot compile a shared object file with references
|
1146
|
-
to undefined symbols under Windows. Thus, we must find a Verilog simulator's
|
1147
|
-
shared object file, which contains definitions of all VPI symbols, and give
|
1148
|
-
this file to the linker when compiling Ruby-VPI.
|
1199
|
+
Also, some example specifications make use of BDD through the rSpec library.
|
1200
|
+
See the the section called “Methodology” for a discussion of rSpec.
|
1149
1201
|
|
1150
|
-
Chapter
|
1202
|
+
Chapter 5. Known problems
|
1151
1203
|
|
1152
1204
|
Table of Contents
|
1153
1205
|
|
@@ -1195,15 +1247,16 @@ vpi_handle_by_name
|
|
1195
1247
|
|
1196
1248
|
Give full paths to Verilog objects
|
1197
1249
|
|
1198
|
-
In version 0.8 of Icarus Verilog, the vpi_handle_by_name
|
1199
|
-
absolute path (including the name of the bench which
|
1200
|
-
to a Verilog object.
|
1250
|
+
In version 0.8 and snapshot 20061009 of Icarus Verilog, the vpi_handle_by_name
|
1251
|
+
function requires an absolute path (including the name of the bench which
|
1252
|
+
instantiates the design) to a Verilog object. In addition, vpi_handle_by_name
|
1253
|
+
is unable to retrieve the handle for a module parameter.
|
1201
1254
|
|
1202
|
-
For example, consider Example
|
1255
|
+
For example, consider Example 5.1, “Part of a bench which instantiates a
|
1203
1256
|
Verilog design”. Here, one needs to specify TestFoo.my_foo.clk instead of
|
1204
1257
|
my_foo.clk in order to access the clk input of the my_foo module instance.
|
1205
1258
|
|
1206
|
-
Example
|
1259
|
+
Example 5.1. Part of a bench which instantiates a Verilog design
|
1207
1260
|
|
1208
1261
|
module TestFoo;
|
1209
1262
|
reg clk_reg;
|
@@ -1218,17 +1271,17 @@ a parameter to a module instantiation). Otherwise, you will get a nil value as
|
|
1218
1271
|
the result of vpi_handle_by_name method.
|
1219
1272
|
|
1220
1273
|
For example, suppose you wanted to access the clk_reg register, from the bench
|
1221
|
-
shown in Example
|
1274
|
+
shown in Example 5.2, “Bad design with unconnected registers”. If you execute
|
1222
1275
|
the statement clk_reg = vpi_handle_by_name("TestFoo.clk_reg", nil) in a
|
1223
1276
|
specification, then you will discover that the vpi_handle_by_name method
|
1224
1277
|
returns nil instead of a handle to the clk_reg register.
|
1225
1278
|
|
1226
1279
|
The solution is to change the design such that it appears like the one shown in
|
1227
|
-
Example
|
1228
|
-
connected to a wire, or Example
|
1280
|
+
Example 5.3, “Fixed design with wired registers” where the register is
|
1281
|
+
connected to a wire, or Example 5.1, “Part of a bench which instantiates a
|
1229
1282
|
Verilog design” where the register is connected to a module instantiation.
|
1230
1283
|
|
1231
|
-
Example
|
1284
|
+
Example 5.2. Bad design with unconnected registers
|
1232
1285
|
|
1233
1286
|
Here the clk_reg register is not connected to anything.
|
1234
1287
|
|
@@ -1236,7 +1289,7 @@ module TestFoo;
|
|
1236
1289
|
reg clk_reg;
|
1237
1290
|
endmodule
|
1238
1291
|
|
1239
|
-
Example
|
1292
|
+
Example 5.3. Fixed design with wired registers
|
1240
1293
|
|
1241
1294
|
Here the clk_reg register is connected to the clk_wire wire.
|
1242
1295
|
|