HDLRuby 2.11.11 → 2.11.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -18
- data/ext/hruby_sim/hruby_rcsim_build.c +27 -0
- data/ext/hruby_sim/hruby_sim.h +3 -0
- data/ext/hruby_sim/hruby_sim_core.c +17 -5
- data/ext/hruby_sim/hruby_sim_stack_calc.c +1 -1
- data/ext/hruby_sim/hruby_sim_tree_calc.c +8 -1
- data/ext/hruby_sim/hruby_sim_vcd.c +24 -7
- data/ext/hruby_sim/hruby_sim_vizualize.c +9 -1
- data/lib/HDLRuby/hdr_samples/constant_in_function.rb +3 -1
- data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +3 -1
- data/lib/HDLRuby/hdr_samples/huge_rom.rb +1 -1
- data/lib/HDLRuby/hdr_samples/mei8.rb +11 -11
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +11 -11
- data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +4 -4
- data/lib/HDLRuby/hdr_samples/rom_nest.rb +1 -1
- data/lib/HDLRuby/hdr_samples/ruby_fir_hw.rb +4 -4
- data/lib/HDLRuby/hdr_samples/struct.rb +44 -10
- data/lib/HDLRuby/hdr_samples/with_bram.rb +45 -0
- data/lib/HDLRuby/hdr_samples/with_casts.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_concat.rb +6 -6
- data/lib/HDLRuby/hdr_samples/with_connector_memory.rb +2 -2
- data/lib/HDLRuby/hdr_samples/with_def.rb +10 -3
- data/lib/HDLRuby/hdr_samples/with_define_operator.rb +44 -0
- data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +12 -12
- data/lib/HDLRuby/hdr_samples/with_init.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_leftright.rb +21 -0
- data/lib/HDLRuby/hdr_samples/with_reduce.rb +13 -13
- data/lib/HDLRuby/hdr_samples/with_ref_array.rb +6 -6
- data/lib/HDLRuby/hdr_samples/with_subsums.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_terminate.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_to_a.rb +10 -10
- data/lib/HDLRuby/hdr_samples/with_values.rb +3 -3
- data/lib/HDLRuby/hdrcc.rb +14 -1
- data/lib/HDLRuby/hruby_bstr.rb +10 -5
- data/lib/HDLRuby/hruby_high.rb +114 -27
- data/lib/HDLRuby/hruby_low.rb +187 -16
- data/lib/HDLRuby/hruby_low2c.rb +71 -11
- data/lib/HDLRuby/hruby_low2vhd.rb +2 -1
- data/lib/HDLRuby/hruby_low_fix_types.rb +1 -0
- data/lib/HDLRuby/hruby_low_mutable.rb +30 -1
- data/lib/HDLRuby/hruby_low_resolve.rb +15 -2
- data/lib/HDLRuby/hruby_low_without_concat.rb +28 -8
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +14 -4
- data/lib/HDLRuby/hruby_low_without_select.rb +2 -2
- data/lib/HDLRuby/hruby_low_without_subsignals.rb +279 -0
- data/lib/HDLRuby/hruby_rcsim.rb +80 -71
- data/lib/HDLRuby/hruby_rsim.rb +132 -7
- data/lib/HDLRuby/hruby_rsim_vcd.rb +99 -27
- data/lib/HDLRuby/hruby_values.rb +35 -31
- data/lib/HDLRuby/std/bram.rb +22 -0
- data/lib/HDLRuby/std/fixpoint.rb +2 -2
- data/lib/HDLRuby/std/fsm.rb +20 -3
- data/lib/HDLRuby/std/function_generator.rb +2 -2
- data/lib/HDLRuby/version.rb +1 -1
- metadata +7 -3
- data/lib/HDLRuby/hdr_samples/sumprod.rb +0 -29
data/lib/HDLRuby/std/fsm.rb
CHANGED
@@ -38,7 +38,8 @@ module HDLRuby::High::Std
|
|
38
38
|
@name = name.to_sym
|
39
39
|
# Check and set the type of fsm depending of the options.
|
40
40
|
@dual = false
|
41
|
-
@type = :sync
|
41
|
+
@type = :sync # By default, the FSM is synchronous.
|
42
|
+
@sequential = true # By default, the default next state is the next one in the list.
|
42
43
|
options.each do |opt|
|
43
44
|
case opt
|
44
45
|
when :sync,:synchronous then
|
@@ -47,6 +48,8 @@ module HDLRuby::High::Std
|
|
47
48
|
@type = :async
|
48
49
|
when :dual then
|
49
50
|
@dual = true
|
51
|
+
when :static then
|
52
|
+
@sequential = false
|
50
53
|
else
|
51
54
|
raise AnyError, "Invalid option for a fsm: :#{type}"
|
52
55
|
end
|
@@ -112,6 +115,7 @@ module HDLRuby::High::Std
|
|
112
115
|
mk_rst = @mk_rst
|
113
116
|
type = @type
|
114
117
|
dual = @dual
|
118
|
+
sequential = @sequential
|
115
119
|
extra_syncs = @extra_syncs
|
116
120
|
extra_asyncs = @extra_asyncs
|
117
121
|
default_codes = @default_codes
|
@@ -238,8 +242,10 @@ module HDLRuby::High::Std
|
|
238
242
|
else
|
239
243
|
# No gotos, by default the next step is
|
240
244
|
# current + 1
|
241
|
-
# this.next_state_sig <=
|
242
|
-
|
245
|
+
# this.next_state_sig <= this.cur_state_sig + 1
|
246
|
+
if sequential then
|
247
|
+
this.next_state_sig <= this.cur_state_sig + 1
|
248
|
+
end
|
243
249
|
end
|
244
250
|
end
|
245
251
|
end
|
@@ -406,6 +412,17 @@ module HDLRuby::High::Std
|
|
406
412
|
return result
|
407
413
|
end
|
408
414
|
|
415
|
+
# Get a state by +name+.
|
416
|
+
def get_state(name)
|
417
|
+
name = name.to_sym
|
418
|
+
(@states.detect { |st| st.name == name }).value
|
419
|
+
end
|
420
|
+
|
421
|
+
# Sets the next state by +name+.
|
422
|
+
def next_state(name)
|
423
|
+
@next_state_sig <= get_state(name)
|
424
|
+
end
|
425
|
+
|
409
426
|
# Sets the next state. Arguments can be:
|
410
427
|
#
|
411
428
|
# +name+: the name of the next state.
|
@@ -75,7 +75,7 @@ module HDLRuby::High::Std
|
|
75
75
|
base <= lut[address]
|
76
76
|
|
77
77
|
# Assign the next_data discrete value.
|
78
|
-
next_data <= lut[address+
|
78
|
+
next_data <= lut[address+_b1.as(address.type)]
|
79
79
|
end
|
80
80
|
|
81
81
|
|
@@ -107,7 +107,7 @@ module HDLRuby::High::Std
|
|
107
107
|
end
|
108
108
|
|
109
109
|
# Make the interpolation.
|
110
|
-
|
110
|
+
seq do
|
111
111
|
diff <= (next_data-base).as(diff.type) * remaining
|
112
112
|
if(otyp.signed?) then
|
113
113
|
interpolated_value <= base +
|
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.11.
|
4
|
+
version: 2.11.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,13 +158,13 @@ files:
|
|
158
158
|
- lib/HDLRuby/hdr_samples/seqpar_bench.rb
|
159
159
|
- lib/HDLRuby/hdr_samples/simple_counter_bench.rb
|
160
160
|
- lib/HDLRuby/hdr_samples/struct.rb
|
161
|
-
- lib/HDLRuby/hdr_samples/sumprod.rb
|
162
161
|
- lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb
|
163
162
|
- lib/HDLRuby/hdr_samples/sw_encrypt_cpu_bench.rb
|
164
163
|
- lib/HDLRuby/hdr_samples/sw_encrypt_cpusim_bench.rb
|
165
164
|
- lib/HDLRuby/hdr_samples/system_open.rb
|
166
165
|
- lib/HDLRuby/hdr_samples/tuple.rb
|
167
166
|
- lib/HDLRuby/hdr_samples/type_minmax_bench.rb
|
167
|
+
- lib/HDLRuby/hdr_samples/with_bram.rb
|
168
168
|
- lib/HDLRuby/hdr_samples/with_casts.rb
|
169
169
|
- lib/HDLRuby/hdr_samples/with_channel.rb
|
170
170
|
- lib/HDLRuby/hdr_samples/with_channel_other.rb
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/HDLRuby/hdr_samples/with_connector_memory.rb
|
175
175
|
- lib/HDLRuby/hdr_samples/with_decoder.rb
|
176
176
|
- lib/HDLRuby/hdr_samples/with_def.rb
|
177
|
+
- lib/HDLRuby/hdr_samples/with_define_operator.rb
|
177
178
|
- lib/HDLRuby/hdr_samples/with_delay.rb
|
178
179
|
- lib/HDLRuby/hdr_samples/with_fixpoint.rb
|
179
180
|
- lib/HDLRuby/hdr_samples/with_fsm.rb
|
@@ -181,6 +182,7 @@ files:
|
|
181
182
|
- lib/HDLRuby/hdr_samples/with_handshake.rb
|
182
183
|
- lib/HDLRuby/hdr_samples/with_init.rb
|
183
184
|
- lib/HDLRuby/hdr_samples/with_instance.rb
|
185
|
+
- lib/HDLRuby/hdr_samples/with_leftright.rb
|
184
186
|
- lib/HDLRuby/hdr_samples/with_linear.rb
|
185
187
|
- lib/HDLRuby/hdr_samples/with_loop.rb
|
186
188
|
- lib/HDLRuby/hdr_samples/with_memory.rb
|
@@ -287,6 +289,7 @@ files:
|
|
287
289
|
- lib/HDLRuby/hruby_low_without_outread.rb
|
288
290
|
- lib/HDLRuby/hruby_low_without_parinseq.rb
|
289
291
|
- lib/HDLRuby/hruby_low_without_select.rb
|
292
|
+
- lib/HDLRuby/hruby_low_without_subsignals.rb
|
290
293
|
- lib/HDLRuby/hruby_rcsim.rb
|
291
294
|
- lib/HDLRuby/hruby_rsim.rb
|
292
295
|
- lib/HDLRuby/hruby_rsim_mute.rb
|
@@ -339,6 +342,7 @@ files:
|
|
339
342
|
- lib/HDLRuby/low_samples/with_seq.yaml
|
340
343
|
- lib/HDLRuby/low_samples/yaml2hdr.rb
|
341
344
|
- lib/HDLRuby/low_samples/yaml2vhd.rb
|
345
|
+
- lib/HDLRuby/std/bram.rb
|
342
346
|
- lib/HDLRuby/std/channel.rb
|
343
347
|
- lib/HDLRuby/std/clocks.rb
|
344
348
|
- lib/HDLRuby/std/connector.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
system :sumprod do |typ,coefs|
|
2
|
-
typ[coefs.size].input :ins
|
3
|
-
typ.output :o
|
4
|
-
|
5
|
-
o <= coefs.each_with_index.reduce(_0) do |sum,(coef,i)|
|
6
|
-
sum + ins[i]*coef
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
typedef :sat do |width, max|
|
12
|
-
signed[width]
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
sat.define_operator(:+) do |width,max, x,y|
|
17
|
-
[width].inner :res
|
18
|
-
seq do
|
19
|
-
res <= x + y
|
20
|
-
( res <= max ).hif(res > max)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
system :sumprod_sat_16_1000, sumprod(sat(16,1000),
|
27
|
-
[3,78,43,246, 3,67,1,8, 47,82,99,13, 5,77,2,4]) do
|
28
|
-
end
|
29
|
-
|