ruby-vpi 12.1.0 → 13.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/bin/generate_test.rb +4 -5
- data/bin/generate_test_tpl/bench.rb +2 -0
- data/bin/generate_test_tpl/bench.v +4 -11
- data/bin/header_to_ruby.rb +0 -1
- data/doc/history.html +281 -206
- data/doc/history.rb +1 -1
- data/doc/history.yml +66 -35
- data/doc/manual.html +3 -3
- data/doc/memo.doc +2 -0
- data/doc/memo.html +5 -0
- data/doc/readme.doc +16 -8
- data/doc/readme.html +19 -13
- data/doc/rss.xml +7 -0
- data/ext/common.h +1 -0
- data/ext/{swig.c → main.c} +32 -6
- data/ext/{swig.h → main.h} +8 -7
- data/ext/relay.c +7 -83
- data/ext/relay.h +7 -5
- data/ext/swig_vpi.i +10 -3
- data/ext/swig_wrap.cin +4 -1
- data/ext/verilog.h +26 -10
- data/ext/vlog.c +16 -23
- data/ext/vlog.h +5 -19
- data/lib/ruby-vpi/rcov.rb +3 -3
- data/lib/ruby-vpi/runner.rb +5 -2
- data/lib/ruby-vpi/vpi.rb +1 -1
- data/lib/ruby-vpi.rb +57 -5
- data/ref/c/annotated.html +1 -7
- data/ref/c/common_8h.html +2 -1
- data/ref/c/files.html +3 -5
- data/ref/c/functions.html +24 -46
- data/ref/c/functions_vars.html +24 -46
- data/ref/c/globals.html +5 -210
- data/ref/c/globals_0x63.html +32 -48
- data/ref/c/globals_0x65.html +3 -9
- data/ref/c/globals_0x66.html +3 -19
- data/ref/c/globals_0x6d.html +5 -10
- data/ref/c/globals_0x70.html +19 -25
- data/ref/c/globals_0x72.html +8 -18
- data/ref/c/globals_0x73.html +11 -198
- data/ref/c/globals_0x74.html +2 -8
- data/ref/c/globals_0x76.html +419 -427
- data/ref/c/globals_0x78.html +3 -9
- data/ref/c/globals_defs.html +30 -35
- data/ref/c/globals_defs_0x65.html +2 -7
- data/ref/c/globals_defs_0x70.html +3 -8
- data/ref/c/globals_defs_0x76.html +416 -420
- data/ref/c/globals_defs_0x78.html +2 -7
- data/ref/c/globals_enum.html +1 -1
- data/ref/c/globals_eval.html +1 -1
- data/ref/c/globals_func.html +13 -173
- data/ref/c/globals_type.html +26 -29
- data/ref/c/globals_vars.html +4 -88
- data/ref/c/index.html +1 -1
- data/ref/c/{swig_8c.html → main_8c.html} +16 -14
- data/ref/c/{swig_8h.html → main_8h.html} +15 -14
- data/ref/c/relay_8c.html +25 -38
- data/ref/c/relay_8h.html +16 -15
- data/ref/c/structt__cb__data.html +6 -23
- data/ref/c/structt__vpi__delay.html +3 -20
- data/ref/c/structt__vpi__error__info.html +3 -71
- data/ref/c/structt__vpi__strengthval.html +3 -3
- data/ref/c/structt__vpi__systf__data.html +12 -46
- data/ref/c/structt__vpi__time.html +3 -3
- data/ref/c/structt__vpi__value.html +3 -113
- data/ref/c/structt__vpi__vecval.html +3 -3
- data/ref/c/structt__vpi__vlog__info.html +3 -54
- data/ref/c/verilog_8h.html +69 -3
- data/ref/c/vlog_8c.html +16 -61
- data/ref/c/vlog_8h.html +14 -57
- data/ref/c/vpi__user_8h.html +16 -16
- data/ref/ruby/classes/ERB.html +5 -5
- data/ref/ruby/classes/ERB.src/{M000032.html → M000026.html} +0 -0
- data/ref/ruby/classes/FileUtils.html +10 -10
- data/ref/ruby/classes/FileUtils.src/{M000034.html → M000027.html} +0 -0
- data/ref/ruby/classes/FileUtils.src/{M000035.html → M000028.html} +0 -0
- data/ref/ruby/classes/Float.html +5 -5
- data/ref/ruby/classes/Float.src/{M000027.html → M000022.html} +0 -0
- data/ref/ruby/classes/Integer.html +68 -68
- data/ref/ruby/classes/Integer.src/M000008.html +25 -0
- data/ref/ruby/classes/Integer.src/M000009.html +18 -0
- data/ref/ruby/classes/Integer.src/{M000014.html → M000010.html} +0 -0
- data/ref/ruby/classes/Integer.src/{M000015.html → M000011.html} +0 -0
- data/ref/ruby/classes/Integer.src/M000012.html +5 -12
- data/ref/ruby/classes/Integer.src/M000013.html +5 -5
- data/ref/ruby/classes/Integer.src/M000016.html +9 -5
- data/ref/ruby/classes/Integer.src/M000017.html +9 -5
- data/ref/ruby/classes/Integer.src/{M000022.html → M000018.html} +0 -0
- data/ref/ruby/classes/Integer.src/{M000023.html → M000019.html} +0 -0
- data/ref/ruby/classes/Integer.src/M000020.html +12 -9
- data/ref/ruby/classes/Integer.src/M000021.html +17 -9
- data/ref/ruby/classes/RDoc.html +5 -5
- data/ref/ruby/classes/RDoc.src/{M000050.html → M000041.html} +0 -0
- data/ref/ruby/classes/RubyVpi.html +29 -24
- data/ref/ruby/classes/RubyVpi.src/M000029.html +142 -0
- data/ref/ruby/classes/String.html +15 -15
- data/ref/ruby/classes/String.src/{M000029.html → M000023.html} +0 -0
- data/ref/ruby/classes/String.src/{M000030.html → M000024.html} +0 -0
- data/ref/ruby/classes/String.src/{M000031.html → M000025.html} +0 -0
- data/ref/ruby/classes/VerilogParser/Module/Parameter.html +5 -5
- data/ref/ruby/classes/VerilogParser/Module/Parameter.src/{M000011.html → M000007.html} +0 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.html +20 -20
- data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000007.html → M000003.html} +0 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000008.html → M000004.html} +0 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000009.html → M000005.html} +0 -0
- data/ref/ruby/classes/VerilogParser/Module/Port.src/{M000010.html → M000006.html} +0 -0
- data/ref/ruby/classes/VerilogParser/Module.html +5 -5
- data/ref/ruby/classes/VerilogParser/Module.src/{M000006.html → M000002.html} +0 -0
- data/ref/ruby/classes/VerilogParser.html +5 -5
- data/ref/ruby/classes/VerilogParser.src/{M000005.html → M000001.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.html +56 -62
- data/ref/ruby/classes/Vpi/Handle.src/M000030.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/{M000039.html → M000031.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000032.html +18 -0
- data/ref/ruby/classes/Vpi/Handle.src/{M000041.html → M000033.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.src/{M000042.html → M000034.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.src/{M000043.html → M000035.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.src/{M000044.html → M000036.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.src/{M000045.html → M000037.html} +0 -0
- data/ref/ruby/classes/Vpi/Handle.src/M000038.html +11 -5
- data/ref/ruby/classes/Vpi/Handle.src/M000040.html +55 -5
- data/ref/ruby/created.rid +1 -1
- data/ref/ruby/files/bin/generate_test_rb.html +1 -49
- data/ref/ruby/files/bin/header_to_ruby_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/rcov_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi/runner_rb.html +1 -48
- data/ref/ruby/files/lib/ruby-vpi/vpi_rb.html +1 -1
- data/ref/ruby/files/lib/ruby-vpi_rb.html +1 -1
- data/ref/ruby/fr_class_index.html +0 -5
- data/ref/ruby/fr_method_index.html +41 -50
- data/samp/counter/counter_rspec_bench.rb +2 -0
- data/samp/counter/counter_rspec_bench.v +4 -11
- data/samp/counter/counter_rspec_design.rb +2 -2
- data/samp/counter/counter_xunit_bench.rb +2 -0
- data/samp/counter/counter_xunit_bench.v +4 -11
- data/samp/counter/counter_xunit_design.rb +2 -2
- data/samp/pipelined_alu/hw5_unit_test_bench.rb +2 -0
- data/samp/pipelined_alu/hw5_unit_test_bench.v +4 -11
- metadata +37 -85
- data/ref/c/globals_0x62.html +0 -62
- data/ref/c/globals_0x67.html +0 -64
- data/ref/c/globals_0x69.html +0 -62
- data/ref/c/globals_0x6c.html +0 -64
- data/ref/c/globals_0x6e.html +0 -63
- data/ref/c/globals_0x75.html +0 -63
- data/ref/c/globals_defs_0x6c.html +0 -57
- data/ref/c/globals_defs_0x6e.html +0 -56
- data/ref/c/globals_defs_0x72.html +0 -57
- data/ref/c/globals_defs_0x73.html +0 -164
- data/ref/c/globals_defs_0x75.html +0 -56
- data/ref/c/globals_func_0x66.html +0 -62
- data/ref/c/globals_func_0x67.html +0 -55
- data/ref/c/globals_func_0x69.html +0 -53
- data/ref/c/globals_func_0x70.html +0 -53
- data/ref/c/globals_func_0x72.html +0 -57
- data/ref/c/globals_func_0x73.html +0 -114
- data/ref/c/globals_func_0x76.html +0 -57
- data/ref/c/structrelay____RubyOptions____def.html +0 -73
- data/ref/c/structswig__cast__info.html +0 -98
- data/ref/c/structswig__class.html +0 -115
- data/ref/c/structswig__module__info.html +0 -132
- data/ref/c/structswig__type__info.html +0 -132
- data/ref/c/swig__vpi_8h.html +0 -8739
- data/ref/c/swig__wrap_8cin.html +0 -11556
- data/ref/c/unions__vpi__value__value.html +0 -166
- 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 -294
- data/ref/ruby/classes/OutputInfo.src/M000026.html +0 -50
- data/ref/ruby/classes/RubyVpi.src/M000036.html +0 -107
- data/ref/ruby/classes/RubyVpi.src/M000037.html +0 -20
- data/ref/ruby/classes/Template.html +0 -158
- data/ref/ruby/classes/Template.src/M000028.html +0 -18
- data/ref/ruby/classes/Vpi/Handle/Property.html +0 -130
- data/ref/ruby/classes/Vpi/Handle/Property.src/M000049.html +0 -80
- data/ref/ruby/classes/Vpi/Handle.src/M000046.html +0 -24
- data/ref/ruby/classes/Vpi/Handle.src/M000048.html +0 -68
- data/ref/ruby/classes/XX/XMLish.html +0 -138
- data/ref/ruby/classes/XX/XMLish.src/M000033.html +0 -18
- data/ref/ruby/classes/XX.html +0 -111
- 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 -38
- 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/ext/relay.c
CHANGED
|
@@ -20,12 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
#include "relay.h"
|
|
23
|
-
|
|
24
|
-
#include "swig.h"
|
|
25
|
-
#include "common.h"
|
|
23
|
+
#include "main.h"
|
|
26
24
|
#include <pthread.h>
|
|
27
|
-
#include <ruby.h>
|
|
28
|
-
#include <assert.h>
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
pthread_t relay__rubyThread;
|
|
@@ -49,86 +45,14 @@ void relay_verilog() {
|
|
|
49
45
|
pthread_mutex_lock(&relay__rubyLock);
|
|
50
46
|
}
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
typedef struct {
|
|
56
|
-
PLI_BYTE8** mArgs; /// Array of command-line arguments.
|
|
57
|
-
unsigned int mCount; /// Number of command-line arguments.
|
|
58
|
-
} relay__RubyOptions__def;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
@param apRubyOptions relay__RubyOptions__def structure which contains command-line options passsed to the Ruby interpreter.
|
|
62
|
-
@note The structure will be freed *deeply* after use.
|
|
63
|
-
*/
|
|
64
|
-
void* ruby_run_handshake(void* apRubyOptions) {
|
|
65
|
-
ruby_init();
|
|
66
|
-
ruby_init_loadpath();
|
|
67
|
-
|
|
68
|
-
swig_init();
|
|
69
|
-
|
|
70
|
-
// pass command-line arguments to the interpreter
|
|
71
|
-
relay__RubyOptions__def* pRubyOptions = (relay__RubyOptions__def*) apRubyOptions;
|
|
72
|
-
|
|
73
|
-
PLI_BYTE8** argv = pRubyOptions->mArgs;
|
|
74
|
-
unsigned int argc = pRubyOptions->mCount;
|
|
75
|
-
|
|
76
|
-
ruby_options(argc, argv);
|
|
77
|
-
|
|
78
|
-
// free the memory used by command-line options
|
|
79
|
-
unsigned int i;
|
|
80
|
-
for (i = 0; i < argc; i++) {
|
|
81
|
-
free(argv[i]);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
free(argv);
|
|
85
|
-
free(pRubyOptions);
|
|
86
|
-
|
|
87
|
-
ruby_run();
|
|
88
|
-
ruby_finalize();
|
|
89
|
-
|
|
48
|
+
void* relay_main_handshake(void* aDummy) {
|
|
49
|
+
main_init();
|
|
90
50
|
return NULL;
|
|
91
51
|
}
|
|
92
52
|
|
|
93
|
-
void
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (pRubyOptions) {
|
|
97
|
-
pRubyOptions->mArgs = NULL;
|
|
98
|
-
pRubyOptions->mCount = 0;
|
|
99
|
-
|
|
100
|
-
// transform the arguments passed to this function by Verilog into command-line arguments for Ruby interpeter
|
|
101
|
-
vpiHandle vCall = vpi_handle(vpiSysTfCall, NULL);
|
|
102
|
-
|
|
103
|
-
if (vCall) {
|
|
104
|
-
vpiHandle vCallArgs = vpi_iterate(vpiArgument, vCall);
|
|
105
|
-
|
|
106
|
-
if (vCallArgs) {
|
|
107
|
-
vpiHandle vArg;
|
|
108
|
-
s_vpi_value argVal;
|
|
109
|
-
argVal.format = vpiStringVal;
|
|
110
|
-
|
|
111
|
-
while (vArg = vpi_scan(vCallArgs)) {
|
|
112
|
-
pRubyOptions->mCount++;
|
|
53
|
+
void relay_main() {
|
|
54
|
+
pthread_create(&relay__rubyThread, 0, relay_main_handshake, NULL);
|
|
113
55
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
pRubyOptions->mArgs = malloc(sizeof(PLI_BYTE8*) * pRubyOptions->mCount);
|
|
117
|
-
else
|
|
118
|
-
pRubyOptions->mArgs = realloc(pRubyOptions->mArgs, sizeof(PLI_BYTE8*) * pRubyOptions->mCount);
|
|
119
|
-
|
|
120
|
-
assert(pRubyOptions->mArgs != NULL);
|
|
121
|
-
|
|
122
|
-
vpi_get_value(vArg, &argVal);
|
|
123
|
-
pRubyOptions->mArgs[pRubyOptions->mCount - 1] = strdup(argVal.value.str);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
pthread_create(&relay__rubyThread, 0, ruby_run_handshake, pRubyOptions);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
common_printf("error: unable to allocate memory for Ruby's command-line arguments.");
|
|
133
|
-
exit(EXIT_FAILURE);
|
|
56
|
+
// XXX: freezee verilog because RubyVpi.init_bench will call relay_verilog (which assumes that verilog is frozen)
|
|
57
|
+
pthread_mutex_lock(&relay__verilogLock);
|
|
134
58
|
}
|
data/ext/relay.h
CHANGED
|
@@ -25,24 +25,26 @@
|
|
|
25
25
|
#ifndef RELAY_H
|
|
26
26
|
#define RELAY_H
|
|
27
27
|
|
|
28
|
+
#include "common.h"
|
|
29
|
+
|
|
28
30
|
/**
|
|
29
|
-
Initialize the relay mechanism, which enables Verilog
|
|
31
|
+
Initialize the relay mechanism, which enables Verilog to transfer control to Ruby and vice versa.
|
|
30
32
|
*/
|
|
31
33
|
void relay_init();
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
Transfers control to Ruby
|
|
36
|
+
Transfers control to Ruby.
|
|
35
37
|
*/
|
|
36
38
|
void relay_ruby();
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
|
-
Transfers control to Verilog
|
|
41
|
+
Transfers control to Verilog.
|
|
40
42
|
*/
|
|
41
43
|
void relay_verilog();
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
|
-
|
|
46
|
+
Transfers control to the main layer.
|
|
45
47
|
*/
|
|
46
|
-
|
|
48
|
+
void relay_main();
|
|
47
49
|
|
|
48
50
|
#endif
|
data/ext/swig_vpi.i
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
%module vpi
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/* Parse the header file to generate wrappers */
|
|
2
5
|
%{
|
|
3
|
-
/* Includes the header in the wrapper code */
|
|
4
6
|
#include "swig_vpi.h"
|
|
5
7
|
%}
|
|
6
|
-
|
|
7
|
-
/* Parse the header file to generate wrappers */
|
|
8
8
|
%include "swig_vpi.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/* allows us to set S_cb_data.cb_rtn = Vpi::Vlog_relay_ruby from Ruby */
|
|
12
|
+
%{
|
|
13
|
+
#include "vlog.h"
|
|
14
|
+
%}
|
|
15
|
+
%constant PLI_INT32 vlog_relay_ruby(struct t_cb_data *);
|
data/ext/swig_wrap.cin
CHANGED
|
@@ -1511,7 +1511,6 @@ static VALUE mVpi;
|
|
|
1511
1511
|
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
|
|
1512
1512
|
|
|
1513
1513
|
|
|
1514
|
-
/* Includes the header in the wrapper code */
|
|
1515
1514
|
#include "swig_vpi.h"
|
|
1516
1515
|
|
|
1517
1516
|
|
|
@@ -1766,6 +1765,9 @@ SWIG_FromCharPtr(const char *cptr)
|
|
|
1766
1765
|
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
|
|
1767
1766
|
}
|
|
1768
1767
|
|
|
1768
|
+
|
|
1769
|
+
#include "vlog.h"
|
|
1770
|
+
|
|
1769
1771
|
swig_class cS_vpi_time;
|
|
1770
1772
|
|
|
1771
1773
|
SWIGINTERN VALUE
|
|
@@ -7127,5 +7129,6 @@ SWIGEXPORT void Init_vpi(void) {
|
|
|
7127
7129
|
rb_define_module_function(mVpi, "vpi_handle_by_multi_index", _wrap_vpi_handle_by_multi_index, -1);
|
|
7128
7130
|
rb_define_singleton_method(mVpi, "vlog_startup_routines", vlog_startup_routines_get, 0);
|
|
7129
7131
|
rb_define_singleton_method(mVpi, "vlog_startup_routines=", vlog_startup_routines_set, 1);
|
|
7132
|
+
rb_define_const(mVpi, "Vlog_relay_ruby", SWIG_NewFunctionPtrObj((void *)vlog_relay_ruby, SWIGTYPE_p_f_p_struct_t_cb_data__int));
|
|
7130
7133
|
}
|
|
7131
7134
|
|
data/ext/verilog.h
CHANGED
|
@@ -22,25 +22,31 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
#ifndef VERILOG_H
|
|
25
|
-
#define
|
|
25
|
+
#define VERILOG_H
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
/*
|
|
28
|
+
Use our verbatim copy of the official IEEE Std. 1364-2005 header file, which was obtained from this URL: <http://www.boydtechinc.com/ptf/archive/ptf_2005/0737.html>
|
|
29
|
+
*/
|
|
28
30
|
#include "vpi_user.h"
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
/*
|
|
33
|
+
Adjust for the peculiarities of the Verilog simulator being used.
|
|
34
|
+
*/
|
|
31
35
|
#ifdef SYNOPSYS_VCS
|
|
32
36
|
#define VERILOG_LENIENT
|
|
33
37
|
#endif
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
/*
|
|
40
|
+
Do we want to enforce strict compliance with IEEE Std. 1364-2001? If so, Ruby-VPI might not work with Synopsys VCS, but that's not our fault. ;-)
|
|
41
|
+
*/
|
|
42
|
+
#define verilog_tf_funcPtr_strict(aPtrName) \
|
|
37
43
|
PLI_INT32 (*aPtrName)(PLI_BYTE8*)
|
|
38
44
|
|
|
39
45
|
#ifdef VERILOG_LENIENT
|
|
40
|
-
#define verilog_tf_funcPtr(aPtrName)
|
|
46
|
+
#define verilog_tf_funcPtr(aPtrName) \
|
|
41
47
|
void (*aPtrName)(void)
|
|
42
48
|
|
|
43
|
-
#define verilog_tf_funcSig(aFuncName)
|
|
49
|
+
#define verilog_tf_funcSig(aFuncName) \
|
|
44
50
|
void aFuncName(void)
|
|
45
51
|
|
|
46
52
|
#define verilog_tf_funcReturn(aReturnVal) \
|
|
@@ -48,11 +54,21 @@
|
|
|
48
54
|
#else
|
|
49
55
|
#define verilog_tf_funcPtr verilog_tf_funcPtr_strict
|
|
50
56
|
|
|
51
|
-
#define verilog_tf_funcSig(aFuncName)
|
|
52
|
-
PLI_INT32 aFuncName(PLI_BYTE8*
|
|
57
|
+
#define verilog_tf_funcSig(aFuncName) \
|
|
58
|
+
PLI_INT32 aFuncName(PLI_BYTE8* aArg)
|
|
53
59
|
|
|
54
|
-
#define verilog_tf_funcReturn(aReturnVal)
|
|
60
|
+
#define verilog_tf_funcReturn(aReturnVal) \
|
|
55
61
|
return aReturnVal
|
|
56
62
|
#endif
|
|
57
63
|
|
|
64
|
+
|
|
65
|
+
#define verilog_cb_funcPtr(aPtrName) \
|
|
66
|
+
PLI_INT32 (*aPtrName)(p_cb_data)
|
|
67
|
+
|
|
68
|
+
#define verilog_cb_funcSig(aFuncName) \
|
|
69
|
+
PLI_INT32 aFuncName(p_cb_data aArg)
|
|
70
|
+
|
|
71
|
+
#define verilog_cb_funcReturn(aReturnVal) \
|
|
72
|
+
return aReturnVal
|
|
73
|
+
|
|
58
74
|
#endif
|
data/ext/vlog.c
CHANGED
|
@@ -20,42 +20,35 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
#include "vlog.h"
|
|
23
|
-
|
|
24
23
|
#include "relay.h"
|
|
25
|
-
#include <stdlib.h>
|
|
26
24
|
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
verilog_cb_funcSig(vlog_relay_main) {
|
|
29
27
|
relay_init();
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
relay_main();
|
|
29
|
+
verilog_cb_funcReturn(0);
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
verilog_cb_funcSig(vlog_relay_ruby) {
|
|
35
33
|
relay_ruby();
|
|
36
|
-
|
|
34
|
+
verilog_cb_funcReturn(0);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
void vlog_bind_task(PLI_BYTE8* apTaskName, verilog_tf_funcPtr(apTaskDef)) {
|
|
40
|
-
s_vpi_systf_data tf;
|
|
41
|
-
|
|
42
|
-
tf.type = vpiSysTask;
|
|
43
|
-
tf.sysfunctype = 0;
|
|
44
|
-
tf.tfname = apTaskName;
|
|
45
|
-
tf.calltf = (verilog_tf_funcPtr_strict())apTaskDef;
|
|
46
|
-
tf.compiletf = NULL;
|
|
47
|
-
tf.sizetf = NULL;
|
|
48
|
-
tf.user_data = NULL;
|
|
49
|
-
|
|
50
|
-
vpi_register_systf(&tf);
|
|
51
|
-
}
|
|
52
37
|
|
|
53
38
|
/**
|
|
54
|
-
|
|
39
|
+
Registers a callback at start of simulation to vlog_relay_main();
|
|
55
40
|
*/
|
|
56
41
|
void vlog_startup() {
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
s_cb_data call;
|
|
43
|
+
|
|
44
|
+
call.reason = cbStartOfSimulation;
|
|
45
|
+
call.cb_rtn = vlog_relay_main;
|
|
46
|
+
call.obj = NULL;
|
|
47
|
+
call.time = NULL;
|
|
48
|
+
call.value = NULL;
|
|
49
|
+
call.user_data = NULL;
|
|
50
|
+
|
|
51
|
+
vpi_free_object(vpi_register_cb(&call));
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
void (*vlog_startup_routines[])() = { vlog_startup, 0 };
|
data/ext/vlog.h
CHANGED
|
@@ -24,31 +24,17 @@
|
|
|
24
24
|
#ifndef VLOG_H
|
|
25
25
|
#define VLOG_H
|
|
26
26
|
|
|
27
|
+
#include "common.h"
|
|
27
28
|
#include "verilog.h"
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
Callback for the $ruby_relay VPI task. Transfers control from Verilog to Ruby code.
|
|
32
|
-
*/
|
|
33
|
-
verilog_tf_funcSig(vlog_ruby_relay);
|
|
34
|
-
|
|
35
30
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
For example, to start the Ruby interpreter with the "-w" option and with the "hello_world.rb" script, the Verilog code would have a statement like this:
|
|
39
|
-
- <tt>$ruby_init("-w", "hello_world.rb");</tt>
|
|
31
|
+
Relays control to the main layer.
|
|
40
32
|
*/
|
|
41
|
-
|
|
33
|
+
verilog_cb_funcSig(vlog_relay_main);
|
|
42
34
|
|
|
43
35
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
For example, if we bound a VPI task named "$hello_world" to the C function hello_world(), then the hello_world() function would be invoked whenever Verilog code called the "$hello_world" VPI task.
|
|
47
|
-
|
|
48
|
-
@param apTaskName Name of the VPI task. For example, "$hello_world".
|
|
49
|
-
|
|
50
|
-
@param apTaskDef The C function which you want to associate with the given VPI task. For example, hello_world().
|
|
36
|
+
Relays control from Verilog to Ruby.
|
|
51
37
|
*/
|
|
52
|
-
|
|
38
|
+
verilog_cb_funcSig(vlog_relay_ruby);
|
|
53
39
|
|
|
54
40
|
#endif
|
data/lib/ruby-vpi/rcov.rb
CHANGED
|
@@ -24,7 +24,7 @@ require 'rcov'
|
|
|
24
24
|
# satisfy dependencies of 'rcov/report'
|
|
25
25
|
require 'xx'
|
|
26
26
|
|
|
27
|
-
module XX
|
|
27
|
+
module XX # :nodoc: all
|
|
28
28
|
module XMLish
|
|
29
29
|
include Markup
|
|
30
30
|
|
|
@@ -53,8 +53,8 @@ module RubyVpi
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
# Invokes the given block after code coverage analysis has completed.
|
|
57
|
-
def RubyVpi.with_coverage_analysis &aBlock # :
|
|
56
|
+
# Invokes the given block, which yields COVERAGE_ANALYSIS, after code coverage analysis has completed.
|
|
57
|
+
def RubyVpi.with_coverage_analysis &aBlock # :nodoc:
|
|
58
58
|
if aBlock
|
|
59
59
|
COVERAGE_ANALYSIS_HANDLERS << aBlock
|
|
60
60
|
end
|
data/lib/ruby-vpi/runner.rb
CHANGED
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
src
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
# prepare hook for rb_load_file() in main.c
|
|
55
|
+
ENV['RUBY_VPI__RUBY_BENCH_FILE'] = SIMULATOR_TARGET + '.rb'
|
|
56
|
+
|
|
54
57
|
|
|
55
58
|
require 'rake/clean'
|
|
56
59
|
require 'ruby-vpi'
|
|
@@ -63,7 +66,7 @@ BOOTSTAP_FUNC = 'vlog_startup_routines_bootstrap'
|
|
|
63
66
|
|
|
64
67
|
|
|
65
68
|
# Returns the path to the Ruby-VPI object file for the given simulator.
|
|
66
|
-
def object_file_path aSimId
|
|
69
|
+
def object_file_path aSimId # :nodoc:
|
|
67
70
|
path = File.join(OBJECT_PATH, "#{PROJECT_ID}.#{aSimId}.so")
|
|
68
71
|
|
|
69
72
|
unless File.exist? path
|
|
@@ -74,7 +77,7 @@ def object_file_path aSimId
|
|
|
74
77
|
end
|
|
75
78
|
|
|
76
79
|
# Returns an array of include-directory options.
|
|
77
|
-
def expand_include_dir_options aSimId, aIncludes = SIMULATOR_INCLUDES
|
|
80
|
+
def expand_include_dir_options aSimId, aIncludes = SIMULATOR_INCLUDES # :nodoc:
|
|
78
81
|
prefix = case aSimId
|
|
79
82
|
when :ivl
|
|
80
83
|
'-I'
|
data/lib/ruby-vpi/vpi.rb
CHANGED
|
@@ -277,7 +277,7 @@ module Vpi
|
|
|
277
277
|
Property = Struct.new :type, :name, :operation, :accessor, :assignment
|
|
278
278
|
|
|
279
279
|
# Resolves the given shorthand name into a description of its VPI property.
|
|
280
|
-
def Property.resolve aName
|
|
280
|
+
def Property.resolve aName # :nodoc:
|
|
281
281
|
# parse the given property name
|
|
282
282
|
tokens = aName.to_s.split(/_/)
|
|
283
283
|
|
data/lib/ruby-vpi.rb
CHANGED
|
@@ -26,20 +26,36 @@ module RubyVpi
|
|
|
26
26
|
#
|
|
27
27
|
# aDesignId:: The name of the Ruby design object.
|
|
28
28
|
# aSpecFormat:: The format being used by the specification.
|
|
29
|
-
|
|
29
|
+
# aClockTrigger:: When the return value of this block is +true+, then the relay_verilog method returns. This block is given one argument: a handle to the clock signal that drives the design under test. If this block is not specified, relay_verilog will always return upon the next positive edge of the clock signal.
|
|
30
|
+
#
|
|
31
|
+
# # return upon positive edge
|
|
32
|
+
# RubyVpi.init_bench ... |clk|
|
|
33
|
+
# clk.intVal == 1
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
# # return upon negative edge
|
|
37
|
+
# RubyVpi.init_bench ... do |clk|
|
|
38
|
+
# clk.intVal == 0
|
|
39
|
+
# end
|
|
40
|
+
#
|
|
41
|
+
# # return whenever clock changes
|
|
42
|
+
# RubyVpi.init_bench ... do |clk|
|
|
43
|
+
# true
|
|
44
|
+
# end
|
|
45
|
+
#
|
|
46
|
+
def RubyVpi.init_bench aDesignId, aSpecFormat, &aClockTrigger # :yields: clock_signal
|
|
30
47
|
if caller.find {|s| s =~ /^(.*?)_bench.rb:/}
|
|
31
48
|
testName = $1
|
|
32
49
|
else
|
|
33
50
|
raise 'Unable to determine name of test.'
|
|
34
51
|
end
|
|
35
52
|
|
|
53
|
+
aClockTrigger ||= lambda {|clk| clk.intVal == 1}
|
|
54
|
+
|
|
36
55
|
useDebugger = !(ENV['DEBUG'] || '').empty?
|
|
37
56
|
useCoverage = !(ENV['COVERAGE'] || '').empty?
|
|
38
57
|
usePrototype = !(ENV['PROTOTYPE'] || '').empty?
|
|
39
58
|
|
|
40
|
-
# service the $ruby_init() task
|
|
41
|
-
Vpi::relay_verilog
|
|
42
|
-
|
|
43
59
|
# set up code coverage analysis
|
|
44
60
|
if useCoverage
|
|
45
61
|
require 'ruby-vpi/rcov'
|
|
@@ -106,13 +122,49 @@ module RubyVpi
|
|
|
106
122
|
if usePrototype
|
|
107
123
|
require "#{testName}_proto.rb"
|
|
108
124
|
|
|
109
|
-
Vpi.
|
|
125
|
+
Vpi.module_eval do
|
|
110
126
|
define_method :relay_verilog do
|
|
111
127
|
design.simulate!
|
|
112
128
|
end
|
|
113
129
|
end
|
|
114
130
|
|
|
115
131
|
Vpi::vpi_printf "#{Config::PROJECT_NAME}: prototype is enabled for test #{testName.inspect}\n"
|
|
132
|
+
|
|
133
|
+
# trigger relay_verilog according to aClockTrigger
|
|
134
|
+
else
|
|
135
|
+
regs = design[VpiReg].sort_by {|h| h.lineNo}
|
|
136
|
+
clock = regs.first
|
|
137
|
+
|
|
138
|
+
Vpi.module_eval do
|
|
139
|
+
# register callback for relay_verilog
|
|
140
|
+
time = S_vpi_time.new
|
|
141
|
+
time.type = VpiSuppressTime
|
|
142
|
+
|
|
143
|
+
value = S_vpi_value.new
|
|
144
|
+
value.format = VpiSuppressVal
|
|
145
|
+
|
|
146
|
+
alarm = S_cb_data.new
|
|
147
|
+
alarm.reason = CbValueChange
|
|
148
|
+
alarm.cb_rtn = Vlog_relay_ruby
|
|
149
|
+
alarm.obj = clock
|
|
150
|
+
alarm.time = time
|
|
151
|
+
alarm.value = value
|
|
152
|
+
alarm.index = 0
|
|
153
|
+
alarm.user_data = nil
|
|
154
|
+
|
|
155
|
+
vpi_free_object(vpi_register_cb(alarm))
|
|
156
|
+
|
|
157
|
+
alias_method :relay_verilog_old, :relay_verilog
|
|
158
|
+
|
|
159
|
+
define_method :relay_verilog do
|
|
160
|
+
begin
|
|
161
|
+
relay_verilog_old
|
|
162
|
+
end until aClockTrigger.call(clock)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# XXX: this completes the handshake with pthread_mutex_lock() in relay_main() in the C extension
|
|
167
|
+
relay_verilog_old
|
|
116
168
|
end
|
|
117
169
|
|
|
118
170
|
# load the design's specification
|
data/ref/c/annotated.html
CHANGED
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
<li><a href="functions.html"><span>Data Fields</span></a></li>
|
|
18
18
|
</ul></div>
|
|
19
19
|
<h1>Ruby-VPI Data Structures</h1>Here are the data structures with brief descriptions:<table>
|
|
20
|
-
<tr><td class="indexkey"><a class="el" href="structrelay____RubyOptions____def.html">relay__RubyOptions__def</a></td><td class="indexvalue">Stores command-line options for the Ruby interpreter </td></tr>
|
|
21
|
-
<tr><td class="indexkey"><a class="el" href="unions__vpi__value__value.html">s_vpi_value_value</a></td><td class="indexvalue"></td></tr>
|
|
22
|
-
<tr><td class="indexkey"><a class="el" href="structswig__cast__info.html">swig_cast_info</a></td><td class="indexvalue"></td></tr>
|
|
23
|
-
<tr><td class="indexkey"><a class="el" href="structswig__class.html">swig_class</a></td><td class="indexvalue"></td></tr>
|
|
24
|
-
<tr><td class="indexkey"><a class="el" href="structswig__module__info.html">swig_module_info</a></td><td class="indexvalue"></td></tr>
|
|
25
|
-
<tr><td class="indexkey"><a class="el" href="structswig__type__info.html">swig_type_info</a></td><td class="indexvalue"></td></tr>
|
|
26
20
|
<tr><td class="indexkey"><a class="el" href="structt__cb__data.html">t_cb_data</a></td><td class="indexvalue"></td></tr>
|
|
27
21
|
<tr><td class="indexkey"><a class="el" href="structt__vpi__delay.html">t_vpi_delay</a></td><td class="indexvalue"></td></tr>
|
|
28
22
|
<tr><td class="indexkey"><a class="el" href="structt__vpi__error__info.html">t_vpi_error_info</a></td><td class="indexvalue"></td></tr>
|
|
@@ -33,7 +27,7 @@
|
|
|
33
27
|
<tr><td class="indexkey"><a class="el" href="structt__vpi__vecval.html">t_vpi_vecval</a></td><td class="indexvalue"></td></tr>
|
|
34
28
|
<tr><td class="indexkey"><a class="el" href="structt__vpi__vlog__info.html">t_vpi_vlog_info</a></td><td class="indexvalue"></td></tr>
|
|
35
29
|
</table>
|
|
36
|
-
<hr size="1"><address style="align: right;"><small>Generated on
|
|
30
|
+
<hr size="1"><address style="align: right;"><small>Generated on Wed Dec 27 22:29:46 2006 for Ruby-VPI by
|
|
37
31
|
<a href="http://www.doxygen.org/index.html">
|
|
38
32
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
|
|
39
33
|
</body>
|
data/ref/c/common_8h.html
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
</ul></div>
|
|
19
19
|
<h1>common.h File Reference</h1>Things common to all Ruby-VPI code. <a href="#_details">More...</a>
|
|
20
20
|
<p>
|
|
21
|
+
<code>#include <stddef.h></code><br>
|
|
21
22
|
<code>#include "<a class="el" href="verilog_8h.html">verilog.h</a>"</code><br>
|
|
22
23
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
23
24
|
<tr><td></td></tr>
|
|
@@ -139,7 +140,7 @@ Pass aroung this value instead of zero and non-zero integers. <dl compact><dt><b
|
|
|
139
140
|
|
|
140
141
|
</div>
|
|
141
142
|
</div><p>
|
|
142
|
-
<hr size="1"><address style="align: right;"><small>Generated on
|
|
143
|
+
<hr size="1"><address style="align: right;"><small>Generated on Wed Dec 27 22:29:46 2006 for Ruby-VPI by
|
|
143
144
|
<a href="http://www.doxygen.org/index.html">
|
|
144
145
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
|
|
145
146
|
</body>
|
data/ref/c/files.html
CHANGED
|
@@ -18,18 +18,16 @@
|
|
|
18
18
|
</ul></div>
|
|
19
19
|
<h1>Ruby-VPI File List</h1>Here is a list of all files with brief descriptions:<table>
|
|
20
20
|
<tr><td class="indexkey"><a class="el" href="common_8h.html">common.h</a></td><td class="indexvalue">Things common to all Ruby-VPI code </td></tr>
|
|
21
|
+
<tr><td class="indexkey"><a class="el" href="main_8c.html">main.c</a></td><td class="indexvalue"></td></tr>
|
|
22
|
+
<tr><td class="indexkey"><a class="el" href="main_8h.html">main.h</a></td><td class="indexvalue">The C extension for Ruby-VPI </td></tr>
|
|
21
23
|
<tr><td class="indexkey"><a class="el" href="relay_8c.html">relay.c</a></td><td class="indexvalue"></td></tr>
|
|
22
24
|
<tr><td class="indexkey"><a class="el" href="relay_8h.html">relay.h</a></td><td class="indexvalue">Logic for transferring control between Ruby and Verilog </td></tr>
|
|
23
|
-
<tr><td class="indexkey"><a class="el" href="swig_8c.html">swig.c</a></td><td class="indexvalue"></td></tr>
|
|
24
|
-
<tr><td class="indexkey"><a class="el" href="swig_8h.html">swig.h</a></td><td class="indexvalue">C interface to the SWIG-generated VPI interface </td></tr>
|
|
25
|
-
<tr><td class="indexkey"><a class="el" href="swig__vpi_8h.html">swig_vpi.h</a></td><td class="indexvalue"></td></tr>
|
|
26
|
-
<tr><td class="indexkey"><a class="el" href="swig__wrap_8cin.html">swig_wrap.cin</a></td><td class="indexvalue"></td></tr>
|
|
27
25
|
<tr><td class="indexkey"><a class="el" href="verilog_8h.html">verilog.h</a></td><td class="indexvalue">A proxy for all Verilog headers of interest to us </td></tr>
|
|
28
26
|
<tr><td class="indexkey"><a class="el" href="vlog_8c.html">vlog.c</a></td><td class="indexvalue"></td></tr>
|
|
29
27
|
<tr><td class="indexkey"><a class="el" href="vlog_8h.html">vlog.h</a></td><td class="indexvalue">Interface between C and Verilog code </td></tr>
|
|
30
28
|
<tr><td class="indexkey"><a class="el" href="vpi__user_8h.html">vpi_user.h</a></td><td class="indexvalue"></td></tr>
|
|
31
29
|
</table>
|
|
32
|
-
<hr size="1"><address style="align: right;"><small>Generated on
|
|
30
|
+
<hr size="1"><address style="align: right;"><small>Generated on Wed Dec 27 22:29:46 2006 for Ruby-VPI by
|
|
33
31
|
<a href="http://www.doxygen.org/index.html">
|
|
34
32
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
|
|
35
33
|
</body>
|