HDLRuby 2.6.25 → 2.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HDLRuby/hdr_samples/case_bench.rb +23 -18
- data/lib/HDLRuby/hdr_samples/parseq_bench.rb +61 -0
- data/lib/HDLRuby/hdr_samples/range_bench.rb +4 -1
- data/lib/HDLRuby/hdr_samples/rom_nest.rb +27 -0
- data/lib/HDLRuby/hdr_samples/with_channel_other.rb +128 -0
- data/lib/HDLRuby/hdr_samples/with_init.rb +18 -0
- data/lib/HDLRuby/hdr_samples/with_instance.rb +42 -0
- data/lib/HDLRuby/hdr_samples/with_ref_array.rb +26 -0
- data/lib/HDLRuby/hdr_samples/with_subsums.rb +33 -0
- data/lib/HDLRuby/hdr_samples/with_values.rb +61 -0
- data/lib/HDLRuby/hruby_high.rb +87 -27
- data/lib/HDLRuby/hruby_low.rb +4 -1
- data/lib/HDLRuby/hruby_low2c.rb +98 -72
- data/lib/HDLRuby/hruby_low_resolve.rb +30 -1
- data/lib/HDLRuby/hruby_tools.rb +1 -0
- data/lib/HDLRuby/sim/hruby_sim.h +9 -1
- data/lib/HDLRuby/sim/hruby_sim_core.c +5 -2
- data/lib/HDLRuby/sim/hruby_sim_stack_calc.c +80 -33
- data/lib/HDLRuby/version.rb +1 -1
- metadata +10 -2
@@ -108,7 +108,7 @@ void register_signal(SignalI signal) {
|
|
108
108
|
/** Recursively update the signals until no (untimed) behavior are
|
109
109
|
* activated. */
|
110
110
|
void hruby_sim_update_signals() {
|
111
|
-
|
111
|
+
// printf("hruby_sim_update_signals...\n");
|
112
112
|
/* As long as the list of touched signals is not empty go on computing. */
|
113
113
|
while(!empty_list(touched_signals) || !empty_list(touched_signals_seq)) {
|
114
114
|
// printf("## Checking touched signals.\n");
|
@@ -121,7 +121,6 @@ void hruby_sim_update_signals() {
|
|
121
121
|
/* Is there a change? */
|
122
122
|
if (same_content_value(sig->c_value,sig->f_value)) continue;
|
123
123
|
/* Yes, process the signal. */
|
124
|
-
// println_signal(sig);
|
125
124
|
printer.print_signal(sig);
|
126
125
|
// printf("c_value="); printer.print_value(sig->c_value);
|
127
126
|
// printf("\nf_value="); printer.print_value(sig->f_value); printf("\n");
|
@@ -441,6 +440,10 @@ void hruby_sim_core(char* name, void (*init_vizualizer)(char*),
|
|
441
440
|
/* Update the signal values (recursively executing blocks locked
|
442
441
|
* on the signals). */
|
443
442
|
hruby_sim_update_signals();
|
443
|
+
if (hruby_sim_time == 0) {
|
444
|
+
/* Initially touch all the signals. */
|
445
|
+
each_all_signal(&touch_signal);
|
446
|
+
}
|
444
447
|
if (num_run_behaviors <= 0) break;
|
445
448
|
/* Advance time to next timestep. */
|
446
449
|
hruby_sim_advance_time();
|
@@ -27,6 +27,17 @@ void push(Value val) {
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
|
30
|
+
/** Duplicates a value in the stack. */
|
31
|
+
void dup() {
|
32
|
+
if (head > 0 && head < STACK_SIZE) {
|
33
|
+
Value val = stack[head];
|
34
|
+
stack[--head] = val;
|
35
|
+
} else {
|
36
|
+
perror("Cannot dup in computation stack.\n");
|
37
|
+
exit(1);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
30
41
|
/** Pops a value.
|
31
42
|
* @return the value. */
|
32
43
|
Value pop() {
|
@@ -38,6 +49,17 @@ Value pop() {
|
|
38
49
|
}
|
39
50
|
}
|
40
51
|
|
52
|
+
/** Access the top value of the stack without removing it.
|
53
|
+
* @return the value. */
|
54
|
+
Value peek() {
|
55
|
+
if (head < STACK_SIZE) {
|
56
|
+
return stack[head];
|
57
|
+
} else {
|
58
|
+
perror("Computation stack empty.\n");
|
59
|
+
exit(1);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
41
63
|
/** Pops multiple values.
|
42
64
|
* @param num the number of values to pop.
|
43
65
|
* @return a pointer on the first value (in heap order!). */
|
@@ -58,10 +80,11 @@ static Value* popn(int num) {
|
|
58
80
|
**/
|
59
81
|
Value unary(Value (*oper)(Value,Value)) {
|
60
82
|
// printf("unary\n");
|
61
|
-
Value dst = get_top_value();
|
62
|
-
dst = oper(pop(),dst);
|
63
|
-
push(dst);
|
64
|
-
return dst;
|
83
|
+
// Value dst = get_top_value();
|
84
|
+
// dst = oper(pop(),dst);
|
85
|
+
// push(dst);
|
86
|
+
// return dst;
|
87
|
+
return oper(pop(),peek());
|
65
88
|
}
|
66
89
|
|
67
90
|
/** Binary calculation.
|
@@ -70,12 +93,15 @@ Value unary(Value (*oper)(Value,Value)) {
|
|
70
93
|
**/
|
71
94
|
Value binary(Value (*oper)(Value,Value,Value)) {
|
72
95
|
// printf("binary\n");
|
73
|
-
Value dst = get_top_value();
|
96
|
+
// Value dst = get_top_value();
|
97
|
+
// Value r = pop();
|
98
|
+
// Value l = pop();
|
99
|
+
// dst = oper(l,r,dst);
|
100
|
+
// push(dst);
|
101
|
+
// return dst;
|
74
102
|
Value r = pop();
|
75
103
|
Value l = pop();
|
76
|
-
|
77
|
-
push(dst);
|
78
|
-
return dst;
|
104
|
+
return oper(l,r,peek());
|
79
105
|
}
|
80
106
|
|
81
107
|
/** Cast calculation.
|
@@ -84,72 +110,93 @@ Value binary(Value (*oper)(Value,Value,Value)) {
|
|
84
110
|
**/
|
85
111
|
Value cast(Type typ) {
|
86
112
|
// printf("cast\n");
|
87
|
-
Value dst = get_top_value();
|
88
|
-
Value src = pop();
|
89
|
-
dst = cast_value(src,typ,dst);
|
90
|
-
push(dst);
|
91
|
-
return dst;
|
113
|
+
// Value dst = get_top_value();
|
114
|
+
// Value src = pop();
|
115
|
+
// dst = cast_value(src,typ,dst);
|
116
|
+
// push(dst);
|
117
|
+
// return dst;
|
118
|
+
return cast_value(pop(),typ,peek());
|
92
119
|
}
|
93
120
|
|
94
121
|
/* Concat values.
|
95
122
|
* @param num the number of values to concat.
|
96
123
|
* @param dir the direction. */
|
97
124
|
Value sconcat(int num, int dir) {
|
125
|
+
// Value* vals = alloca(num*sizeof(Value));
|
126
|
+
// Value dst = get_top_value();
|
127
|
+
// int i;
|
128
|
+
// // printf("sconcat\n");
|
129
|
+
// /* Get the values to concat from the stack. */
|
130
|
+
// for(i=1;i<=num;++i) vals[num-i] = pop();
|
131
|
+
// dst = concat_valueP(num,dir,dst,vals);
|
132
|
+
// push(dst);
|
133
|
+
// return dst;
|
98
134
|
Value* vals = alloca(num*sizeof(Value));
|
99
|
-
Value dst = get_top_value();
|
100
135
|
int i;
|
101
136
|
// printf("sconcat\n");
|
102
137
|
/* Get the values to concat from the stack. */
|
103
138
|
for(i=1;i<=num;++i) vals[num-i] = pop();
|
104
|
-
|
105
|
-
push(dst);
|
106
|
-
return dst;
|
139
|
+
return concat_valueP(num,dir,peek(),vals);
|
107
140
|
}
|
108
141
|
|
109
142
|
/* Index read calculation.
|
110
143
|
* @param typ the data type of the access. */
|
111
144
|
Value sreadI(Type typ) {
|
145
|
+
// // printf("sreadI\n");
|
146
|
+
// Value dst = get_top_value();
|
147
|
+
// unsigned long long idx = value2integer(pop());
|
148
|
+
// dst = read_range(pop(),idx,idx,typ,dst);
|
149
|
+
// push(dst);
|
150
|
+
// return dst;
|
112
151
|
// printf("sreadI\n");
|
113
|
-
Value dst = get_top_value();
|
114
152
|
unsigned long long idx = value2integer(pop());
|
115
|
-
|
116
|
-
push(dst);
|
117
|
-
return dst;
|
153
|
+
return read_range(pop(),idx,idx,typ,peek());
|
118
154
|
}
|
119
155
|
|
120
156
|
/* Index write calculation.
|
121
157
|
* @param typ the data type of the access. */
|
122
158
|
Value swriteI(Type typ) {
|
159
|
+
// // printf("swriteI\n");
|
160
|
+
// Value dst = get_top_value();
|
161
|
+
// unsigned long long idx = value2integer(pop());
|
162
|
+
// dst = write_range(pop(),idx,idx,typ,dst);
|
163
|
+
// push(dst);
|
164
|
+
// return dst;
|
123
165
|
// printf("swriteI\n");
|
124
|
-
Value dst = get_top_value();
|
125
166
|
unsigned long long idx = value2integer(pop());
|
126
|
-
|
127
|
-
push(dst);
|
128
|
-
return dst;
|
167
|
+
return write_range(pop(),idx,idx,typ,peek());
|
129
168
|
}
|
130
169
|
|
131
170
|
/* Range read calculation.
|
132
171
|
* @param typ the data type of the access. */
|
133
172
|
Value sreadR(Type typ) {
|
173
|
+
// // printf("sreadR\n");
|
174
|
+
// Value dst = get_top_value();
|
175
|
+
// unsigned long long last = value2integer(pop());
|
176
|
+
// unsigned long long first = value2integer(pop());
|
177
|
+
// dst = read_range(pop(),first,last,typ,dst);
|
178
|
+
// push(dst);
|
179
|
+
// return dst;
|
134
180
|
// printf("sreadR\n");
|
135
|
-
Value dst = get_top_value();
|
136
181
|
unsigned long long last = value2integer(pop());
|
137
182
|
unsigned long long first = value2integer(pop());
|
138
|
-
|
139
|
-
push(dst);
|
140
|
-
return dst;
|
183
|
+
return read_range(pop(),first,last,typ,peek());
|
141
184
|
}
|
142
185
|
|
143
186
|
/* Range write calculation.
|
144
187
|
* @param typ the data type of the access. */
|
145
188
|
Value swriteR(Type typ) {
|
189
|
+
// // printf("swriteR\n");
|
190
|
+
// Value dst = get_top_value();
|
191
|
+
// unsigned long long last = value2integer(pop());
|
192
|
+
// unsigned long long first = value2integer(pop());
|
193
|
+
// dst = write_range(pop(),first,last,typ,dst);
|
194
|
+
// push(dst);
|
195
|
+
// return dst;
|
146
196
|
// printf("swriteR\n");
|
147
|
-
Value dst = get_top_value();
|
148
197
|
unsigned long long last = value2integer(pop());
|
149
198
|
unsigned long long first = value2integer(pop());
|
150
|
-
|
151
|
-
push(dst);
|
152
|
-
return dst;
|
199
|
+
return write_range(pop(),first,last,typ,peek());
|
153
200
|
}
|
154
201
|
|
155
202
|
/** Check if the top value is defined. */
|
data/lib/HDLRuby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: HDLRuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01
|
11
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,11 +125,13 @@ files:
|
|
125
125
|
- lib/HDLRuby/hdr_samples/neural/selector.rb
|
126
126
|
- lib/HDLRuby/hdr_samples/neural/sigmoid.rb
|
127
127
|
- lib/HDLRuby/hdr_samples/neural/z.rb
|
128
|
+
- lib/HDLRuby/hdr_samples/parseq_bench.rb
|
128
129
|
- lib/HDLRuby/hdr_samples/prog.obj
|
129
130
|
- lib/HDLRuby/hdr_samples/ram.rb
|
130
131
|
- lib/HDLRuby/hdr_samples/range_bench.rb
|
131
132
|
- lib/HDLRuby/hdr_samples/register_with_code_bench.rb
|
132
133
|
- lib/HDLRuby/hdr_samples/rom.rb
|
134
|
+
- lib/HDLRuby/hdr_samples/rom_nest.rb
|
133
135
|
- lib/HDLRuby/hdr_samples/ruby_fir_hw.rb
|
134
136
|
- lib/HDLRuby/hdr_samples/seqpar_bench.rb
|
135
137
|
- lib/HDLRuby/hdr_samples/struct.rb
|
@@ -142,6 +144,7 @@ files:
|
|
142
144
|
- lib/HDLRuby/hdr_samples/type_minmax_bench.rb
|
143
145
|
- lib/HDLRuby/hdr_samples/with_casts.rb
|
144
146
|
- lib/HDLRuby/hdr_samples/with_channel.rb
|
147
|
+
- lib/HDLRuby/hdr_samples/with_channel_other.rb
|
145
148
|
- lib/HDLRuby/hdr_samples/with_class.rb
|
146
149
|
- lib/HDLRuby/hdr_samples/with_concat.rb
|
147
150
|
- lib/HDLRuby/hdr_samples/with_connector.rb
|
@@ -150,6 +153,8 @@ files:
|
|
150
153
|
- lib/HDLRuby/hdr_samples/with_fixpoint.rb
|
151
154
|
- lib/HDLRuby/hdr_samples/with_fsm.rb
|
152
155
|
- lib/HDLRuby/hdr_samples/with_function_generator.rb
|
156
|
+
- lib/HDLRuby/hdr_samples/with_init.rb
|
157
|
+
- lib/HDLRuby/hdr_samples/with_instance.rb
|
153
158
|
- lib/HDLRuby/hdr_samples/with_linear.rb
|
154
159
|
- lib/HDLRuby/hdr_samples/with_loop.rb
|
155
160
|
- lib/HDLRuby/hdr_samples/with_memory.rb
|
@@ -157,9 +162,12 @@ files:
|
|
157
162
|
- lib/HDLRuby/hdr_samples/with_multi_channels.rb
|
158
163
|
- lib/HDLRuby/hdr_samples/with_reconf.rb
|
159
164
|
- lib/HDLRuby/hdr_samples/with_reduce.rb
|
165
|
+
- lib/HDLRuby/hdr_samples/with_ref_array.rb
|
160
166
|
- lib/HDLRuby/hdr_samples/with_str2value.rb
|
167
|
+
- lib/HDLRuby/hdr_samples/with_subsums.rb
|
161
168
|
- lib/HDLRuby/hdr_samples/with_to_a.rb
|
162
169
|
- lib/HDLRuby/hdr_samples/with_to_array.rb
|
170
|
+
- lib/HDLRuby/hdr_samples/with_values.rb
|
163
171
|
- lib/HDLRuby/hdrcc.rb
|
164
172
|
- lib/HDLRuby/high_samples/_adder_fault.rb
|
165
173
|
- lib/HDLRuby/high_samples/_generic_transmission2.rb
|