HDLRuby 2.11.11 → 3.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.
- checksums.yaml +4 -4
- data/README.html +3274 -0
- data/README.md +608 -99
- 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_calc.c +2 -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/backend/hruby_allocator.rb +2 -2
- data/lib/HDLRuby/backend/hruby_c_allocator.rb +7 -7
- 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 +12 -12
- 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_bram_frame_stack.rb +105 -0
- data/lib/HDLRuby/hdr_samples/with_bram_stack.rb +69 -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_register_stack.rb +150 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer.rb +190 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_deep.rb +91 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +405 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +89 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +120 -0
- 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 +29 -3
- data/lib/HDLRuby/hdrlib.rb +1 -1
- data/lib/HDLRuby/hruby_bstr.rb +10 -5
- data/lib/HDLRuby/hruby_db.rb +2 -2
- data/lib/HDLRuby/hruby_high.rb +152 -47
- data/lib/HDLRuby/hruby_high_fullname.rb +3 -1
- data/lib/HDLRuby/hruby_low.rb +189 -18
- data/lib/HDLRuby/hruby_low2c.rb +129 -54
- data/lib/HDLRuby/hruby_low2hdr.rb +66 -40
- data/lib/HDLRuby/hruby_low2high.rb +86 -44
- data/lib/HDLRuby/hruby_low2seq.rb +26 -18
- data/lib/HDLRuby/hruby_low2sym.rb +14 -13
- data/lib/HDLRuby/hruby_low2vhd.rb +80 -44
- data/lib/HDLRuby/hruby_low_bool2select.rb +61 -46
- data/lib/HDLRuby/hruby_low_casts_without_expression.rb +56 -44
- data/lib/HDLRuby/hruby_low_cleanup.rb +18 -16
- data/lib/HDLRuby/hruby_low_fix_types.rb +65 -32
- data/lib/HDLRuby/hruby_low_mutable.rb +83 -119
- data/lib/HDLRuby/hruby_low_resolve.rb +38 -30
- data/lib/HDLRuby/hruby_low_with_bool.rb +33 -16
- data/lib/HDLRuby/hruby_low_with_port.rb +3 -3
- data/lib/HDLRuby/hruby_low_with_var.rb +23 -9
- data/lib/HDLRuby/hruby_low_without_concat.rb +45 -19
- data/lib/HDLRuby/hruby_low_without_namespace.rb +47 -32
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +32 -16
- data/lib/HDLRuby/hruby_low_without_select.rb +37 -24
- data/lib/HDLRuby/hruby_low_without_subsignals.rb +280 -0
- data/lib/HDLRuby/hruby_rcsim.rb +158 -134
- data/lib/HDLRuby/hruby_rsim.rb +194 -20
- data/lib/HDLRuby/hruby_rsim_mute.rb +2 -3
- data/lib/HDLRuby/hruby_rsim_vcd.rb +125 -50
- data/lib/HDLRuby/hruby_values.rb +48 -33
- data/lib/HDLRuby/hruby_verilog.rb +90 -48
- data/lib/HDLRuby/soft/stacks.rb +219 -0
- data/lib/HDLRuby/std/bram.rb +26 -0
- data/lib/HDLRuby/std/clocks.rb +1 -1
- data/lib/HDLRuby/std/fixpoint.rb +2 -2
- data/lib/HDLRuby/std/fsm.rb +48 -11
- data/lib/HDLRuby/std/function_generator.rb +2 -2
- data/lib/HDLRuby/std/sequencer.rb +1857 -0
- data/lib/HDLRuby/std/sequencer_sync.rb +400 -0
- data/lib/HDLRuby/std/std.rb +12 -0
- data/lib/HDLRuby/version.rb +1 -1
- data/tuto/adder_sat_flags_vcd.png +0 -0
- data/tuto/addsub_vcd.png +0 -0
- data/tuto/alu_vcd.png +0 -0
- data/tuto/bit_pong_vcd.png +0 -0
- data/tuto/checksum_vcd.png +0 -0
- data/tuto/circuit_hdr.odg +0 -0
- data/tuto/circuit_hdr.png +0 -0
- data/tuto/circuit_hie.odg +0 -0
- data/tuto/circuit_hie.png +0 -0
- data/tuto/circuit_view.odg +0 -0
- data/tuto/circuit_view.png +0 -0
- data/tuto/clock_counter_vcd.png +0 -0
- data/tuto/counter_ext_vcd.png +0 -0
- data/tuto/fact_vcd.png +0 -0
- data/tuto/hw_flow.odg +0 -0
- data/tuto/hw_flow.png +0 -0
- data/tuto/maxxer_vcd.png +0 -0
- data/tuto/pingpong0_vcd.png +0 -0
- data/tuto/pingpong1_vcd.png +0 -0
- data/tuto/pingpong2_vcd.png +0 -0
- data/tuto/ram_vcd.png +0 -0
- data/tuto/serializer_vcd.png +0 -0
- data/tuto/sw_flow.odg +0 -0
- data/tuto/sw_flow.png +0 -0
- data/tuto/the_counter_vcd.png +0 -0
- data/tuto/tutorial_sw.html +2359 -0
- data/tuto/tutorial_sw.md +2684 -0
- data/tuto/tutorial_sw.pdf +0 -0
- data/tuto/tutorial_sw_jp.md +417 -0
- metadata +49 -3
- data/lib/HDLRuby/hdr_samples/sumprod.rb +0 -29
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'std/sequencer.rb'
|
2
|
+
|
3
|
+
include HDLRuby::High::Std
|
4
|
+
|
5
|
+
# Checking the usage of sequencers:
|
6
|
+
# - One sequencer computes a fibbnacci series until 100
|
7
|
+
# - One sequencer computes a fibbnacci series until 1000 with early termination
|
8
|
+
# for testing sterminate.
|
9
|
+
# - One sequencer computes a fibbnacci series until 1000 with ealry break
|
10
|
+
# for testing sbreak.
|
11
|
+
# - One sequence that increase a first counter and the other one every four
|
12
|
+
# increases of the first one for testing scontinue.
|
13
|
+
# - One sequencer computes the square value of each elements of a buffer.
|
14
|
+
# - One sequencer computes the square value of each elements of a range.
|
15
|
+
# - One sequencer concatenates the value of a counter with its index.
|
16
|
+
# - One sequencer puts the sum of two arrays in a third one.
|
17
|
+
# - One sequencer iterates over two arrays.
|
18
|
+
# - One sequencer iterates downward.
|
19
|
+
system :my_seqencer do
|
20
|
+
|
21
|
+
inner :clk,:rst
|
22
|
+
[16].inner :u, :v,:res0
|
23
|
+
|
24
|
+
sequencer(clk.posedge,rst) do
|
25
|
+
hprint("#0\n")
|
26
|
+
u <= 0
|
27
|
+
v <= 1
|
28
|
+
step
|
29
|
+
res0 <= 0
|
30
|
+
hprint("#1 res0=",res0,"\n")
|
31
|
+
swhile(v < 100) do
|
32
|
+
v <= u + v
|
33
|
+
u <= v - u
|
34
|
+
hprint("#2 v=",v,"\n")
|
35
|
+
end
|
36
|
+
res0 <= v
|
37
|
+
hprint("#3 res0=",res0,"\n")
|
38
|
+
end
|
39
|
+
|
40
|
+
[16].inner :uu, :vv
|
41
|
+
sequencer(clk.posedge,rst) do
|
42
|
+
hprint("##0\n")
|
43
|
+
uu <= 0
|
44
|
+
vv <= 1
|
45
|
+
swhile(vv<10000) do
|
46
|
+
vv <= uu + vv
|
47
|
+
uu <= vv - uu
|
48
|
+
step
|
49
|
+
hprint("##1 vv=",vv,"\n")
|
50
|
+
sif(vv >= 100) { sterminate }
|
51
|
+
end
|
52
|
+
hprint("##2 vv=",vv,"... But should not be here!\n")
|
53
|
+
end
|
54
|
+
|
55
|
+
[16].inner :uuu, :vvv, :res00
|
56
|
+
|
57
|
+
sequencer(clk.posedge,rst) do
|
58
|
+
hprint("###0\n")
|
59
|
+
res00 <= 0
|
60
|
+
uuu <= 0
|
61
|
+
vvv <= 1
|
62
|
+
swhile(vvv<10000) do
|
63
|
+
vvv <= uuu + vvv
|
64
|
+
uuu <= vvv - uuu
|
65
|
+
step
|
66
|
+
hprint("##1 vvv=",vvv,"\n")
|
67
|
+
sif(vvv >= 100) { sbreak }
|
68
|
+
selse { res00 <= res00 + 1 }
|
69
|
+
end
|
70
|
+
hprint("##2 res00=",res00,"... and should be here!\n")
|
71
|
+
end
|
72
|
+
|
73
|
+
[8].inner :a,:b
|
74
|
+
|
75
|
+
sequencer(clk.posedge,rst) do
|
76
|
+
hprint("=0\n")
|
77
|
+
a <= 0
|
78
|
+
b <= 0
|
79
|
+
sfor(0..19) do
|
80
|
+
a <= a + 1
|
81
|
+
hprint("=1 a=",a,"\n")
|
82
|
+
sif(a % 4) { scontinue }
|
83
|
+
b <= b + 1
|
84
|
+
hprint("=2 b=",b,"\n")
|
85
|
+
end
|
86
|
+
hprint("=3 a=",a," b=",b,"\n")
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
bit[16][-8].inner buf: 8.times.map {|i| i.to_expr.as(bit[16]) }
|
91
|
+
[16].inner :res1
|
92
|
+
# [8].inner :idx
|
93
|
+
|
94
|
+
sequencer(clk.posedge,rst) do
|
95
|
+
res1 <= 0
|
96
|
+
hprint("$0 res1=",res1,"\n")
|
97
|
+
# sfor(buf) do |elem,idx|
|
98
|
+
# buf.seach.with_index do |elem,idx|
|
99
|
+
# res1 <= elem * elem
|
100
|
+
# hprint("$1 res1=",res1," idx=",idx,"\n")
|
101
|
+
# end
|
102
|
+
buf.seach do |elem|
|
103
|
+
res1 <= elem * elem
|
104
|
+
hprint("$1 elem=",elem," res1=",res1,"\n")
|
105
|
+
end
|
106
|
+
hprint("$2 res1=",res1,"\n")
|
107
|
+
end
|
108
|
+
|
109
|
+
[32].inner :res2
|
110
|
+
|
111
|
+
sequencer(clk.posedge,rst) do
|
112
|
+
res2 <= 0
|
113
|
+
hprint("%0 res2=",res2,"\n")
|
114
|
+
(0..7).seach do |elem|
|
115
|
+
res2 <= elem * elem
|
116
|
+
hprint("%1 elem=",elem," res2=",res2,"\n")
|
117
|
+
end
|
118
|
+
hprint("%2 res2=",res2,"\n")
|
119
|
+
end
|
120
|
+
|
121
|
+
[32].inner :res3
|
122
|
+
|
123
|
+
sequencer(clk.posedge,rst) do
|
124
|
+
res3 <= 0
|
125
|
+
hprint("&0 res3=",res3,"\n")
|
126
|
+
5.supto(10).with_index do |elem,idx|
|
127
|
+
res3 <= [elem[15..0],idx[15..0]]
|
128
|
+
hprint("&1 elem=",elem," idx=",idx," res3=",res3,"\n")
|
129
|
+
end
|
130
|
+
hprint("&2 res3=",res3,"\n")
|
131
|
+
end
|
132
|
+
|
133
|
+
bit[8][-8].inner ar0: [_h01,_h02,_h04,_h08, _h10,_h20,_h40,_h80]
|
134
|
+
bit[8][-8].inner ar1: [_h01,_h02,_h03,_h04, _h05,_h06,_h07,_h08]
|
135
|
+
bit[8][-8].inner :res4
|
136
|
+
|
137
|
+
sequencer(clk.posedge,rst) do
|
138
|
+
sfor(ar0) do |elem,idx|
|
139
|
+
res4[idx] <= elem + ar1[idx]
|
140
|
+
end
|
141
|
+
hprint("res4=",res4,"\n")
|
142
|
+
end
|
143
|
+
|
144
|
+
[8].inner :res5
|
145
|
+
|
146
|
+
sequencer(clk.posedge,rst) do
|
147
|
+
res5 <= 0
|
148
|
+
hprint("(0 res5=",res5,"\n")
|
149
|
+
(ar0.seach + ar1).seach do |elem|
|
150
|
+
res5 <= elem
|
151
|
+
hprint("(1 res5=",res5,"\n")
|
152
|
+
end
|
153
|
+
hprint("(2 res5=",res5,"\n")
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
[32].inner :res6
|
158
|
+
|
159
|
+
sequencer(clk.posedge,rst) do
|
160
|
+
res6 <= 0
|
161
|
+
hprint(")0 res6=",res6,"\n")
|
162
|
+
10.sdownto(1) do |elem|
|
163
|
+
res6 <= elem
|
164
|
+
hprint(")1 res6=",res6,"\n")
|
165
|
+
end
|
166
|
+
hprint(")2 res6=",res6,"\n")
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
timed do
|
171
|
+
clk <= 0
|
172
|
+
rst <= 0
|
173
|
+
!10.ns
|
174
|
+
clk <= 1
|
175
|
+
!10.ns
|
176
|
+
clk <= 0
|
177
|
+
rst <= 1
|
178
|
+
!10.ns
|
179
|
+
clk <= 1
|
180
|
+
!10.ns
|
181
|
+
clk <= 0
|
182
|
+
rst <= 0
|
183
|
+
!10.ns
|
184
|
+
clk <= 1
|
185
|
+
repeat(100) do
|
186
|
+
!10.ns
|
187
|
+
clk <= ~clk
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'std/sequencer.rb'
|
2
|
+
|
3
|
+
include HDLRuby::High::Std
|
4
|
+
|
5
|
+
# Checking the usage of sequencers with multiple and deep loops.
|
6
|
+
# Also checks empty loops and loops controlled from the outside.
|
7
|
+
system :my_seqencer do
|
8
|
+
|
9
|
+
inner :clk,:rst,:req
|
10
|
+
|
11
|
+
[16].inner :u, :v
|
12
|
+
|
13
|
+
sequencer(clk,rst) do
|
14
|
+
hprint("#0\n")
|
15
|
+
u <= 0
|
16
|
+
v <= 1
|
17
|
+
swhile(v<10) { v <= v + 1 }
|
18
|
+
hprint("#1\n")
|
19
|
+
swhile(u<10) { u <= u + 1 }
|
20
|
+
hprint("#2\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
[16].inner :x, :y
|
24
|
+
|
25
|
+
sequencer(clk,rst) do
|
26
|
+
hprint("!0\n")
|
27
|
+
x <= 1
|
28
|
+
y <= 0
|
29
|
+
swhile(x<20) do
|
30
|
+
hprint("!1\n")
|
31
|
+
x <= x + 4
|
32
|
+
swhile(y<x) { y <= y + 1 }
|
33
|
+
end
|
34
|
+
hprint("!2\n")
|
35
|
+
end
|
36
|
+
|
37
|
+
[16].inner :z
|
38
|
+
|
39
|
+
sequencer(clk,rst) do
|
40
|
+
hprint("$0\n")
|
41
|
+
z <= 10
|
42
|
+
swhile(x==0)
|
43
|
+
z <= 0
|
44
|
+
hprint("$1\n")
|
45
|
+
swhile(x<10)
|
46
|
+
z <= 1
|
47
|
+
hprint("$2\n")
|
48
|
+
end
|
49
|
+
|
50
|
+
[16].inner :w
|
51
|
+
|
52
|
+
sequencer(clk,rst) do
|
53
|
+
hprint(":0\n")
|
54
|
+
w <= 0
|
55
|
+
sloop do
|
56
|
+
swhile(req == 1) { w <= 1 }
|
57
|
+
w <= w + 1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
timed do
|
63
|
+
clk <= 0
|
64
|
+
rst <= 0
|
65
|
+
req <= 0
|
66
|
+
!10.ns
|
67
|
+
clk <= 1
|
68
|
+
!10.ns
|
69
|
+
clk <= 0
|
70
|
+
rst <= 1
|
71
|
+
!10.ns
|
72
|
+
clk <= 1
|
73
|
+
!10.ns
|
74
|
+
clk <= 0
|
75
|
+
rst <= 0
|
76
|
+
req <= 1
|
77
|
+
!10.ns
|
78
|
+
clk <= 1
|
79
|
+
repeat(10) do
|
80
|
+
!10.ns
|
81
|
+
clk <= ~clk
|
82
|
+
end
|
83
|
+
!10.ns
|
84
|
+
req <= 0
|
85
|
+
clk <= ~clk
|
86
|
+
repeat(60) do
|
87
|
+
!10.ns
|
88
|
+
clk <= ~clk
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,405 @@
|
|
1
|
+
require 'std/sequencer.rb'
|
2
|
+
|
3
|
+
include HDLRuby::High::Std
|
4
|
+
|
5
|
+
# Checking the usage of sequencer's enumerable capabilities.
|
6
|
+
# - The first sequencer checks sall?
|
7
|
+
# - The second sequencer checks sany?
|
8
|
+
# - The third sequencer checks schain
|
9
|
+
# - The forth sequencer checks smap
|
10
|
+
# - The fifth sequencer checks smap with with_index
|
11
|
+
# - The sixth sequencer checks scompact
|
12
|
+
# - The seventh sequencer checks scount
|
13
|
+
# - The eighth sequencer checks scycle
|
14
|
+
# - The nineth sequencer checks sfind
|
15
|
+
# - The tenth sequencer checks sdrop and sdrop_while
|
16
|
+
# - The eleventh sequencer checks seach_cons
|
17
|
+
# - The twelveth sequencer checks seach_slice
|
18
|
+
# - The thirteenth sequencer checks sto_a
|
19
|
+
# - The forteenth sequencer checks sselect
|
20
|
+
# - The fifteenth sequencer checks sfind_index
|
21
|
+
# - The sixteenth sequencer checks sfirst
|
22
|
+
# - The seventeenth sequencer checks sinject
|
23
|
+
# - The eighteenth sequencer checks smax
|
24
|
+
# - The nineteenth sequencer checks smax_by
|
25
|
+
# - The twentieth sequencer checks smax_by
|
26
|
+
# - The twenty firth sequencer checks smin
|
27
|
+
# - The twenty second sequencer checks smin_by
|
28
|
+
# - The twenty third sequencer checks sminmax and sminmax_by
|
29
|
+
# - The twenty fourth sequencer checks snone?
|
30
|
+
# - The twenty fifth sequencer checks sone?
|
31
|
+
# - The twenty sixth sequencer checks sreverse_each
|
32
|
+
# - The twenty seventh sequencer checks ssort and ssort_by
|
33
|
+
# - The twenty eighth sequencer checks ssum
|
34
|
+
# - The twenty nineth sequencer checks stake and stake_while
|
35
|
+
# - The thirtieth sequencer checks suniq
|
36
|
+
# - The thirty first sequencer checks szip
|
37
|
+
system :my_seqencer do
|
38
|
+
|
39
|
+
inner :clk,:rst
|
40
|
+
|
41
|
+
bit[8][-8].inner vals: [ _h00, _h10, _hA5, _h0B, _hFE, _h34, _h5C, _h44 ]
|
42
|
+
|
43
|
+
[16].inner :res0, :res1
|
44
|
+
|
45
|
+
sequencer(clk.posedge,rst) do
|
46
|
+
hprint("#0\n")
|
47
|
+
res0 <= 0
|
48
|
+
res1 <= 0
|
49
|
+
step
|
50
|
+
res0 <= vals.sall? { |val| val != _h11 }
|
51
|
+
res1 <= vals.sall? { |val| val != _h5C }
|
52
|
+
hprint("#1 res0=",res0," res1=",res1,"\n")
|
53
|
+
end
|
54
|
+
|
55
|
+
[16].inner :res2, :res3
|
56
|
+
|
57
|
+
sequencer(clk.posedge,rst) do
|
58
|
+
hprint("$0\n")
|
59
|
+
res2 <= 0
|
60
|
+
res3 <= 0
|
61
|
+
step
|
62
|
+
res2 <= vals.sany? { |val| val == _h11 }
|
63
|
+
res3 <= vals.sany? { |val| val == _h5C }
|
64
|
+
hprint("$1 res2=",res2," res3=",res3,"\n")
|
65
|
+
end
|
66
|
+
|
67
|
+
[16].inner :res4
|
68
|
+
|
69
|
+
sequencer(clk.posedge,rst) do
|
70
|
+
hprint("!0\n")
|
71
|
+
res4 <= 0
|
72
|
+
vals.schain(0..10).seach do |elem|
|
73
|
+
res4 <= elem
|
74
|
+
hprint("!1 res4=",res4,"\n")
|
75
|
+
end
|
76
|
+
hprint("!2 res4=",res4,"\n")
|
77
|
+
end
|
78
|
+
|
79
|
+
[8*8].inner :res5
|
80
|
+
|
81
|
+
sequencer(clk.posedge,rst) do
|
82
|
+
hprint("%0\n");
|
83
|
+
res5 <= 0
|
84
|
+
res5 <= vals.smap { |val| val + 1 }
|
85
|
+
hprint("%1 res5=",res5,"\n");
|
86
|
+
end
|
87
|
+
|
88
|
+
[8*8].inner :res6
|
89
|
+
|
90
|
+
sequencer(clk.posedge,rst) do
|
91
|
+
hprint("&0\n");
|
92
|
+
res6 <= 0
|
93
|
+
res6 <= vals.smap.with_index { |val,i| val + i }
|
94
|
+
hprint("&1 res6=",res6,"\n");
|
95
|
+
end
|
96
|
+
|
97
|
+
bit[8][-8].inner vals2: [ _h00, _h10, _h00, _h0B, _hFE, _h00, _h5C, _h00 ]
|
98
|
+
[8*8].inner :res7
|
99
|
+
|
100
|
+
sequencer(clk.posedge,rst) do
|
101
|
+
hprint("|0\n");
|
102
|
+
res7 <= 0
|
103
|
+
res7 <= vals2.scompact
|
104
|
+
hprint("|1 res7=",res7,"\n");
|
105
|
+
end
|
106
|
+
|
107
|
+
[8].inner :res8, :res9, :res10
|
108
|
+
|
109
|
+
sequencer(clk.posedge,rst) do
|
110
|
+
hprint("(0\n");
|
111
|
+
res8 <= 0
|
112
|
+
res9 <= 0
|
113
|
+
res10 <= 0
|
114
|
+
res8 <= vals2.scount
|
115
|
+
res9 <= vals2.scount(_h00)
|
116
|
+
res10 <= vals2.scount {|elem| elem > _h10 }
|
117
|
+
hprint("(1 res8=",res8," res9=",res9," res10=",res10,"\n");
|
118
|
+
end
|
119
|
+
|
120
|
+
[8].inner :res11, :res12
|
121
|
+
|
122
|
+
sequencer(clk.posedge,rst) do
|
123
|
+
hprint(")0\n")
|
124
|
+
res11 <= 0
|
125
|
+
res12 <= 0
|
126
|
+
vals.scycle(2) { |elem| res11 <= elem }
|
127
|
+
hprint(")1 res11=",res11,"\n")
|
128
|
+
vals2.scycle { |elem| res12 <= elem }
|
129
|
+
hprint(")2 Should never be here! ... res12=",res12,"\n")
|
130
|
+
end
|
131
|
+
|
132
|
+
[8].inner :res13, :res14
|
133
|
+
|
134
|
+
sequencer(clk.posedge,rst) do
|
135
|
+
hprint("=0\n")
|
136
|
+
res13 <= 0
|
137
|
+
res14 <= 0
|
138
|
+
res13 <= vals.sfind(-1) { |elem| elem > 0 }
|
139
|
+
res14 <= vals.sfind(-1) { |elem| elem == _hAA }
|
140
|
+
hprint("=1 res13=",res13," res14=",res14,"\n")
|
141
|
+
end
|
142
|
+
|
143
|
+
[8*8].inner :res15, :res16
|
144
|
+
|
145
|
+
sequencer(clk.posedge,rst) do
|
146
|
+
hprint("+0\n")
|
147
|
+
res15 <= 0
|
148
|
+
res16 <= 0
|
149
|
+
res15 <= vals.sdrop(3)
|
150
|
+
res16 <= vals.sdrop_while { |elem| elem < _hAA }
|
151
|
+
hprint("+1 res15=",res15," res16=",res16,"\n")
|
152
|
+
end
|
153
|
+
|
154
|
+
[8].inner :res17
|
155
|
+
|
156
|
+
sequencer(clk.posedge,rst) do
|
157
|
+
hprint("*0\n")
|
158
|
+
res17 <= 0
|
159
|
+
vals.seach_cons(3) { |a,b,c| res17 <= a+b+c }
|
160
|
+
hprint("*1 res17=",res17,"\n")
|
161
|
+
end
|
162
|
+
|
163
|
+
[8].inner :res18
|
164
|
+
|
165
|
+
sequencer(clk.posedge,rst) do
|
166
|
+
hprint("/0\n")
|
167
|
+
res18 <= 0
|
168
|
+
vals.seach_slice(3) { |a,b,c| res18 <= a+b+c }
|
169
|
+
hprint("/1 res18=",res18,"\n")
|
170
|
+
end
|
171
|
+
|
172
|
+
[32*4].inner :res19
|
173
|
+
|
174
|
+
sequencer(clk.posedge,rst) do
|
175
|
+
hprint("~0\n")
|
176
|
+
res19 <= 0
|
177
|
+
res19 <= (1..4).seach.sto_a
|
178
|
+
hprint("~1 res19=",res19,"\n")
|
179
|
+
end
|
180
|
+
|
181
|
+
[8].inner :res21, :res22
|
182
|
+
|
183
|
+
sequencer(clk.posedge,rst) do
|
184
|
+
hprint(">0\n")
|
185
|
+
res21 <= 0
|
186
|
+
res22 <= 0
|
187
|
+
res21 <= vals.sfind_index(_h0B)
|
188
|
+
res22 <= vals.sfind_index { |elem| elem < _hAA }
|
189
|
+
hprint(">1 res21=",res21," res22=",res22,"\n")
|
190
|
+
end
|
191
|
+
|
192
|
+
[4*8].inner :res23
|
193
|
+
|
194
|
+
sequencer(clk.posedge,rst) do
|
195
|
+
hprint("<0\n")
|
196
|
+
res23 <= 0
|
197
|
+
res23 <= vals.sfirst(4)
|
198
|
+
hprint("<1 res23=",res23,"\n")
|
199
|
+
end
|
200
|
+
|
201
|
+
inner :res24, :res25
|
202
|
+
|
203
|
+
sequencer(clk.posedge,rst) do
|
204
|
+
hprint("!0\n")
|
205
|
+
res24 <= 0
|
206
|
+
res25 <= 0
|
207
|
+
res24 <= vals.sinclude?(_h0B)
|
208
|
+
res25 <= vals.sinclude?(_hAA)
|
209
|
+
hprint("!1 res24=",res24," res25=",res25,"\n")
|
210
|
+
end
|
211
|
+
|
212
|
+
[8].inner :res26, :res27
|
213
|
+
|
214
|
+
sequencer(clk.posedge,rst) do
|
215
|
+
hprint(":0\n")
|
216
|
+
res26 <= 0
|
217
|
+
res27 <= 0
|
218
|
+
res26 <= vals.sinject(1) { |a,b| a+b }
|
219
|
+
res27 <= vals.sinject(:+)
|
220
|
+
hprint(":1 res26=",res26," res27=",res27,"\n")
|
221
|
+
end
|
222
|
+
|
223
|
+
[8].inner :res28
|
224
|
+
[8*3].inner :res29
|
225
|
+
|
226
|
+
sequencer(clk.posedge,rst) do
|
227
|
+
hprint(";0\n")
|
228
|
+
res28 <= 0
|
229
|
+
res29 <= 0
|
230
|
+
res28 <= vals.smax
|
231
|
+
res29 <= vals.smax(3)
|
232
|
+
hprint(";1 res28=",res28," res29=",res29,"\n")
|
233
|
+
end
|
234
|
+
|
235
|
+
[8].inner :res30
|
236
|
+
[8*3].inner :res31
|
237
|
+
|
238
|
+
sequencer(clk.posedge,rst) do
|
239
|
+
hprint(",0\n")
|
240
|
+
res30 <= 0
|
241
|
+
res31 <= 0
|
242
|
+
res30 <= vals.smax_by {|e| e.to_signed }
|
243
|
+
res31 <= vals.smax_by(3) {|e| e.to_signed }
|
244
|
+
hprint(",1 res30=",res30," res31=",res31,"\n")
|
245
|
+
end
|
246
|
+
|
247
|
+
[8].inner :res32
|
248
|
+
[8*3].inner :res33
|
249
|
+
|
250
|
+
sequencer(clk.posedge,rst) do
|
251
|
+
hprint(".0\n")
|
252
|
+
res32 <= 0
|
253
|
+
res33 <= 0
|
254
|
+
res32 <= vals.smin
|
255
|
+
res33 <= vals.smin(3)
|
256
|
+
hprint(".1 res32=",res32," res33=",res33,"\n")
|
257
|
+
end
|
258
|
+
|
259
|
+
[8].inner :res34
|
260
|
+
[8*3].inner :res35
|
261
|
+
|
262
|
+
sequencer(clk.posedge,rst) do
|
263
|
+
hprint(":0\n")
|
264
|
+
res34 <= 0
|
265
|
+
res35 <= 0
|
266
|
+
res34 <= vals.smin_by {|e| e.to_signed }
|
267
|
+
res35 <= vals.smin_by(3) {|e| e.to_signed }
|
268
|
+
hprint(":1 res34=",res34," res35=",res35,"\n")
|
269
|
+
end
|
270
|
+
|
271
|
+
[16].inner :res36, :res37
|
272
|
+
|
273
|
+
sequencer(clk.posedge,rst) do
|
274
|
+
hprint("]0\n")
|
275
|
+
res36 <= 0
|
276
|
+
res37 <= 0
|
277
|
+
res36 <= vals.sminmax
|
278
|
+
res37 <= vals.sminmax_by {|e| e.to_signed }
|
279
|
+
hprint("]1 res36=",res36," res37=",res37,"\n")
|
280
|
+
end
|
281
|
+
|
282
|
+
[8].inner :res38, :res39
|
283
|
+
|
284
|
+
sequencer(clk.posedge,rst) do
|
285
|
+
hprint("[0\n")
|
286
|
+
res38 <= 0
|
287
|
+
res39 <= 0
|
288
|
+
step
|
289
|
+
res38 <= vals.snone? { |val| val == _h11 }
|
290
|
+
res39 <= vals.snone?(_h5C)
|
291
|
+
hprint("[1 res38=",res38," res39=",res39,"\n")
|
292
|
+
end
|
293
|
+
|
294
|
+
[8].inner :res40, :res41, :res42
|
295
|
+
|
296
|
+
sequencer(clk.posedge,rst) do
|
297
|
+
hprint("[0\n")
|
298
|
+
res40 <= 0
|
299
|
+
res41 <= 0
|
300
|
+
res42 <= 0
|
301
|
+
step
|
302
|
+
res40 <= vals.sone?(_h5C)
|
303
|
+
res41 <= vals.sone? { |val| val == _h11 }
|
304
|
+
res42 <= vals2.sone? { |val| val == _h00 }
|
305
|
+
hprint("[1 res40=",res40," res41=",res41," res42=",res42,"\n")
|
306
|
+
end
|
307
|
+
|
308
|
+
[8].inner :res43
|
309
|
+
|
310
|
+
sequencer(clk.posedge,rst) do
|
311
|
+
hprint("_0\n")
|
312
|
+
res43 <= 0
|
313
|
+
step
|
314
|
+
(4..10).sreverse_each { |val| res43 <= val }
|
315
|
+
hprint("_1 res43=",res43,"\n")
|
316
|
+
end
|
317
|
+
|
318
|
+
[8*8].inner :res44, :res45
|
319
|
+
|
320
|
+
sequencer(clk.posedge,rst) do
|
321
|
+
hprint("@0\n")
|
322
|
+
res44 <= 0
|
323
|
+
res45 <= 0
|
324
|
+
step
|
325
|
+
res44 <= vals.ssort
|
326
|
+
res45 <= vals.ssort_by { |val| val.to_signed }
|
327
|
+
hprint("@1 res44=",res44," res45=",res45,"\n")
|
328
|
+
end
|
329
|
+
|
330
|
+
[8].inner :res46, :res47
|
331
|
+
|
332
|
+
sequencer(clk.posedge,rst) do
|
333
|
+
hprint("`0\n")
|
334
|
+
res46 <= 0
|
335
|
+
res47 <= 0
|
336
|
+
step
|
337
|
+
res46 <= vals.ssum
|
338
|
+
res47 <= vals.ssum { |val| val & _h0F }
|
339
|
+
hprint("`1 res46=",res46," res47=",res47,"\n")
|
340
|
+
end
|
341
|
+
|
342
|
+
[8*3].inner :res48
|
343
|
+
[8*8].inner :res49
|
344
|
+
|
345
|
+
sequencer(clk.posedge,rst) do
|
346
|
+
hprint("`0\n")
|
347
|
+
res48 <= 0
|
348
|
+
res49 <= 0
|
349
|
+
step
|
350
|
+
res48 <= vals.stake(3)
|
351
|
+
res49 <= vals.stake_while { |val| val < _hAA }
|
352
|
+
hprint("`1 res48=",res48," res49=",res49,"\n")
|
353
|
+
end
|
354
|
+
|
355
|
+
bit[8][-8].inner vals3: [ _hFE, _h10, _hA5, _h10, _hFE, _h34, _h5C, _h10 ]
|
356
|
+
|
357
|
+
[8*8].inner :res50,:res51
|
358
|
+
|
359
|
+
sequencer(clk.posedge,rst) do
|
360
|
+
hprint("\"0\n")
|
361
|
+
res50 <= 0
|
362
|
+
res51 <= 0
|
363
|
+
step
|
364
|
+
res50 <= vals3.suniq
|
365
|
+
res51 <= vals.suniq { |val| val & _h0F }
|
366
|
+
hprint("\"1 res50=",res50," res51=",res51,"\n")
|
367
|
+
end
|
368
|
+
|
369
|
+
[8*4*2].inner :res52
|
370
|
+
bit[8][-8].inner :res53
|
371
|
+
[3].inner :idx
|
372
|
+
|
373
|
+
sequencer(clk.posedge,rst) do
|
374
|
+
hprint("}0\n")
|
375
|
+
res52 <= 0
|
376
|
+
idx <= 0
|
377
|
+
step
|
378
|
+
res52 <= vals.szip((1..6).to_a.map {|i| i.to_expr.as(bit[8]) })
|
379
|
+
vals.szip([_h12]*8) { |a,b| res53[idx] <= a+b; idx <= idx + 1 }
|
380
|
+
hprint("}1 res52=",res52," res53=",res53,"\n")
|
381
|
+
end
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
timed do
|
386
|
+
clk <= 0
|
387
|
+
rst <= 0
|
388
|
+
!10.ns
|
389
|
+
clk <= 1
|
390
|
+
!10.ns
|
391
|
+
clk <= 0
|
392
|
+
rst <= 1
|
393
|
+
!10.ns
|
394
|
+
clk <= 1
|
395
|
+
!10.ns
|
396
|
+
clk <= 0
|
397
|
+
rst <= 0
|
398
|
+
!10.ns
|
399
|
+
clk <= 1
|
400
|
+
repeat(100) do
|
401
|
+
!10.ns
|
402
|
+
clk <= ~clk
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|