HDLRuby 3.9.1 → 3.9.3
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 +4121 -4648
- data/README.md +9 -1
- data/ext/hruby_sim/hruby_rcsim_build.c +2 -0
- data/ext/hruby_sim/hruby_sim.h +6 -0
- data/ext/hruby_sim/hruby_sim_calc.c +67 -0
- data/lib/HDLRuby/hdr_samples/with_henumerable.rb +281 -258
- data/lib/HDLRuby/hdr_samples/with_to_svg.rb +37 -0
- data/lib/HDLRuby/hdr_samples/with_unary_reduction.rb +23 -0
- data/lib/HDLRuby/hdr_samples/with_values.rb +4 -0
- data/lib/HDLRuby/hdrcc.rb +3 -0
- data/lib/HDLRuby/hruby_bstr.rb +2 -1
- data/lib/HDLRuby/hruby_high.rb +35 -7
- data/lib/HDLRuby/hruby_low.rb +52 -87
- data/lib/HDLRuby/hruby_low_split_signals.rb +213 -0
- data/lib/HDLRuby/hruby_types.rb +6 -2
- data/lib/HDLRuby/hruby_viz.rb +359 -166
- data/lib/HDLRuby/std/hruby_enum.rb +104 -28
- data/lib/HDLRuby/std/sequencer.rb +17 -3
- data/lib/HDLRuby/verilog_hruby.rb +70 -28
- data/lib/HDLRuby/verilog_parser.rb +38 -18
- data/lib/HDLRuby/version.rb +1 -1
- metadata +5 -2
|
@@ -35,360 +35,383 @@ include HDLRuby::High::Std
|
|
|
35
35
|
# - The thirtieth check is for suniq
|
|
36
36
|
# - The thirty first check is for hzip
|
|
37
37
|
#
|
|
38
|
-
# - The
|
|
38
|
+
# - The remaining checks the enumerators apply on values directly.
|
|
39
|
+
# - The second remaining checks the brak and next statements.
|
|
39
40
|
#
|
|
40
|
-
|
|
41
|
+
|
|
41
42
|
system :henmerable_checks do
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
inner :clk,:rst
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
bit[8][-8].inner vals: [ _h00, _h10, _hA5, _h0B, _hFE, _h34, _h5C, _h44 ]
|
|
47
|
+
rvals = 8.times.to_a.reverse
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
[16].inner :res0, :res1, :res2, :res3
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
res0 <= vals.hall? { |val| val != _h11 }
|
|
52
|
+
res1 <= vals.hall? { |val| val != _h5C }
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
par(clk.posedge) do
|
|
55
|
+
# hprint("#0\n")
|
|
56
|
+
res2 <= rvals.hall? { |val| val.to_expr != 11 }
|
|
57
|
+
res3 <= rvals.hall? { |val| val.to_expr != 4 }
|
|
58
|
+
# hprint("#1 res0=",res0," res1=",res1," res2=",res2," res3=",res3,"\n")
|
|
59
|
+
end
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
[16].inner :res4, :res5, :res6, :res7
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
res4 <= vals.hany? { |val| val == _h11 }
|
|
64
|
+
res5 <= vals.hany? { |val| val == _h5C }
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
par(clk.posedge) do
|
|
67
|
+
# hprint("$0\n")
|
|
68
|
+
res6 <= rvals.hany? { |val| val == 11 }
|
|
69
|
+
res7 <= rvals.hany? { |val| val == 4 }
|
|
70
|
+
# hprint("#1 res4=",res4," res5=",res5," res6=",res6," res7=",res7,"\n")
|
|
71
|
+
end
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
[16].inner :res8, :res9, :res10, :res11
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
res8 <= vals.hchain(0..10).hany? { |val| val.as(bit[8]) == _h11 }
|
|
76
|
+
res9 <= vals.hchain(0..10).hany? { |val| val.as(bit[8]) == _h05 }
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
par(clk.posedge) do
|
|
79
|
+
# hprint("!0\n")
|
|
80
|
+
res10 <= rvals.hchain(vals).hany? { |val| val.as(bit[8]) == _h11 }
|
|
81
|
+
res11 <= rvals.hchain(vals).hany? { |val| val.as(bit[8]) == _h04 }
|
|
82
|
+
end
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
bit[8][-8].inner :res12, :res13
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
res12 <= vals.hmap { |val| val + 1 }
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
par(clk.posedge) do
|
|
89
|
+
# hprint("%0\n");
|
|
90
|
+
res13 <= vals.hmap { |val| val + 1 }
|
|
91
|
+
end
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
bit[8][-8].inner :res14, :res15
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
res14 <= vals.hmap.hwith_index { |val,i| val + i }
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
par(clk.posedge) do
|
|
98
|
+
# hprint("&0\n");
|
|
99
|
+
res15 <= vals.hmap.hwith_index { |val,i| val + i }
|
|
100
|
+
end
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
bit[8][-8].inner vals2: [ _h00, _h10, _h00, _h0B, _hFE, _h00, _h5C, _h00 ]
|
|
103
|
+
# bit[8][-8].inner :res16, :res17
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
# res16 <= vals2.hcompact
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
# sequencer(clk.posedge,rst) do
|
|
108
|
+
# # hprint("|0\n");
|
|
109
|
+
# res17 <= vals2.hcompact
|
|
110
|
+
# end
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
[8].inner :res18, :res19, :res20
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
res18 <= vals2.hcount
|
|
115
|
+
res19 <= vals2.hcount(_h00)
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
par(clk.posedge) do
|
|
118
|
+
# hprint("(0\n");
|
|
119
|
+
res20 <= vals2.hcount {|elem| elem > _h10 }
|
|
120
|
+
end
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
# [8].inner :res21, :res22
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
# vals.hcycle(2) { |elem| res21 <= elem }
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
# par(clk.posedge) do
|
|
127
|
+
# # hprint(")0\n")
|
|
128
|
+
# vals2.hcycle { |elem| res22 <= elem }
|
|
129
|
+
# end
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
[8].inner :res23, :res24
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
res23 <= vals.hfind(proc {-1}) { |elem| elem > 0 }
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
par(clk.posedge) do
|
|
136
|
+
# hprint("=0\n")
|
|
137
|
+
res24 <= vals.hfind(proc {-1}) { |elem| elem == _hAA }
|
|
138
|
+
end
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
res25 <= vals.hdrop(3)
|
|
140
|
+
bit[8][-8].inner :res25 #, :res26
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
# # hprint("+0\n")
|
|
145
|
-
# res26 <= vals.hdrop_while { |elem| elem < _hAA }
|
|
146
|
-
# end
|
|
142
|
+
res25 <= vals.hdrop(3)
|
|
147
143
|
|
|
148
|
-
|
|
144
|
+
# par(clk.posedge) do
|
|
145
|
+
# # hprint("+0\n")
|
|
146
|
+
# res26 <= vals.hdrop_while { |elem| elem < _hAA }
|
|
147
|
+
# end
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
bit[8][-8].inner :res27
|
|
150
|
+
|
|
151
|
+
par(clk.posedge) do
|
|
152
|
+
# hprint("*0\n")
|
|
153
|
+
vals.heach_cons(3).hwith_index { |(a,b,c),i| res27[i] <= a+b+c }
|
|
154
|
+
end
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
end
|
|
156
|
+
bit[8][-8].inner :res28
|
|
157
|
+
|
|
158
|
+
par(clk.posedge) do
|
|
159
|
+
# hprint("/0\n")
|
|
160
|
+
vals.heach_slice(3).hwith_index do |(a,b,c),i|
|
|
161
|
+
if c then
|
|
162
|
+
res28[i] <= a+b+c
|
|
163
|
+
elsif b then
|
|
164
|
+
res28[i] <= a+b
|
|
165
|
+
else
|
|
166
|
+
res28[i] <= a
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
|
+
end
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
par(clk.posedge) do
|
|
173
|
-
# hprint("~0\n")
|
|
174
|
-
res29 <= (_h00000001.._h00000004).heach.hto_a
|
|
175
|
-
end
|
|
171
|
+
bit[32][-4].inner :res29
|
|
176
172
|
|
|
177
|
-
|
|
173
|
+
par(clk.posedge) do
|
|
174
|
+
# hprint("~0\n")
|
|
175
|
+
res29 <= (_h00000001.._h00000004).heach.hto_a
|
|
176
|
+
end
|
|
178
177
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
par(clk.posedge) do
|
|
182
|
-
# hprint(">0\n")
|
|
183
|
-
res31 <= vals.hfind_index { |elem| elem < _hAA }
|
|
184
|
-
res31x <= vals.hfind_index { |elem| elem == _hAA }
|
|
185
|
-
end
|
|
178
|
+
[8].inner :res30, :res31, :res31x
|
|
186
179
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
par(clk.posedge) do
|
|
190
|
-
# hprint("<0\n")
|
|
191
|
-
res32 <= vals.hfirst(4)
|
|
192
|
-
end
|
|
180
|
+
res30 <= vals.hfind_index(_h0B)
|
|
193
181
|
|
|
194
|
-
|
|
182
|
+
par(clk.posedge) do
|
|
183
|
+
# hprint(">0\n")
|
|
184
|
+
res31 <= vals.hfind_index { |elem| elem < _hAA }
|
|
185
|
+
res31x <= vals.hfind_index { |elem| elem == _hAA }
|
|
186
|
+
end
|
|
195
187
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
par(clk.posedge) do
|
|
199
|
-
# hprint("!0\n")
|
|
200
|
-
res34 <= vals.hinclude?(_hAA)
|
|
201
|
-
end
|
|
188
|
+
bit[8][-4].inner :res32
|
|
202
189
|
|
|
203
|
-
|
|
204
|
-
|
|
190
|
+
par(clk.posedge) do
|
|
191
|
+
# hprint("<0\n")
|
|
192
|
+
res32 <= vals.hfirst(4)
|
|
193
|
+
end
|
|
205
194
|
|
|
206
|
-
|
|
195
|
+
inner :res33, :res34
|
|
207
196
|
|
|
208
|
-
|
|
197
|
+
res33 <= vals.hinclude?(_h0B)
|
|
209
198
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
end
|
|
199
|
+
par(clk.posedge) do
|
|
200
|
+
# hprint("!0\n")
|
|
201
|
+
res34 <= vals.hinclude?(_hAA)
|
|
202
|
+
end
|
|
215
203
|
|
|
216
|
-
|
|
217
|
-
|
|
204
|
+
[8].inner :res35, :res36
|
|
205
|
+
[7].inner :res35X, :res36X
|
|
218
206
|
|
|
219
|
-
|
|
207
|
+
res35 <= vals.hinject(_h01) { |a,b| a+b }
|
|
220
208
|
|
|
221
|
-
|
|
222
|
-
# hprint(";0\n")
|
|
223
|
-
# res38 <= vals.hmax(3)
|
|
224
|
-
res38 <= vals.hmax(1)
|
|
225
|
-
end
|
|
209
|
+
res35X <= vals.hinject(bit[4]) { |a,b| a+b }
|
|
226
210
|
|
|
227
|
-
|
|
228
|
-
#
|
|
229
|
-
|
|
211
|
+
par(clk.posedge) do
|
|
212
|
+
# hprint(":0\n")
|
|
213
|
+
res36 <= vals.(:+)
|
|
214
|
+
res36X <= vals.(bit[4],:+)
|
|
215
|
+
end
|
|
230
216
|
|
|
231
|
-
|
|
217
|
+
[8].inner :res37
|
|
218
|
+
bit[8][-3].inner :res38
|
|
232
219
|
|
|
233
|
-
|
|
234
|
-
# hprint(",0\n")
|
|
235
|
-
# res40 <= vals.hmax_by(3) {|e| e.to_signed }
|
|
236
|
-
res40 <= vals.hmax_by(1) {|e| e.to_signed }
|
|
237
|
-
end
|
|
220
|
+
res37 <= vals.hmax
|
|
238
221
|
|
|
239
|
-
|
|
240
|
-
|
|
222
|
+
par(clk.posedge) do
|
|
223
|
+
# hprint(";0\n")
|
|
224
|
+
# res38 <= vals.hmax(3)
|
|
225
|
+
res38 <= vals.hmax(1)
|
|
226
|
+
end
|
|
241
227
|
|
|
242
|
-
|
|
228
|
+
[8].inner :res39
|
|
229
|
+
# bit[8][-3].inner :res40
|
|
230
|
+
[8].inner :res40
|
|
243
231
|
|
|
244
|
-
|
|
245
|
-
# hprint(".0\n")
|
|
246
|
-
# res42 <= vals.hmin(3)
|
|
247
|
-
res42 <= vals.hmin(1)
|
|
248
|
-
end
|
|
232
|
+
res39 <= vals.hmax_by {|e| e.to_signed }
|
|
249
233
|
|
|
250
|
-
|
|
251
|
-
|
|
234
|
+
par(clk.posedge) do
|
|
235
|
+
# hprint(",0\n")
|
|
236
|
+
# res40 <= vals.hmax_by(3) {|e| e.to_signed }
|
|
237
|
+
res40 <= vals.hmax_by(1) {|e| e.to_signed }
|
|
238
|
+
end
|
|
252
239
|
|
|
253
|
-
|
|
240
|
+
[8].inner :res41
|
|
241
|
+
bit[8][-3].inner :res42
|
|
254
242
|
|
|
255
|
-
|
|
256
|
-
# hprint(":0\n")
|
|
257
|
-
# res44 <= vals.hmin_by(3) {|e| e.to_signed }
|
|
258
|
-
res44 <= vals.hmin_by(1) {|e| e.to_signed }
|
|
259
|
-
end
|
|
243
|
+
res41 <= vals.hmin
|
|
260
244
|
|
|
261
|
-
|
|
245
|
+
par(clk.posedge) do
|
|
246
|
+
# hprint(".0\n")
|
|
247
|
+
# res42 <= vals.hmin(3)
|
|
248
|
+
res42 <= vals.hmin(1)
|
|
249
|
+
end
|
|
262
250
|
|
|
263
|
-
|
|
251
|
+
[8].inner :res43
|
|
252
|
+
bit[8][-3].inner :res44
|
|
264
253
|
|
|
265
|
-
|
|
266
|
-
# hprint("]0\n")
|
|
267
|
-
res46 <= vals.hminmax_by {|e| e.to_signed }
|
|
268
|
-
end
|
|
254
|
+
res43 <= vals.hmin_by {|e| e.to_signed }
|
|
269
255
|
|
|
270
|
-
|
|
256
|
+
par(clk.posedge) do
|
|
257
|
+
# hprint(":0\n")
|
|
258
|
+
# res44 <= vals.hmin_by(3) {|e| e.to_signed }
|
|
259
|
+
res44 <= vals.hmin_by(1) {|e| e.to_signed }
|
|
260
|
+
end
|
|
271
261
|
|
|
272
|
-
|
|
262
|
+
[16].inner :res45, :res46
|
|
273
263
|
|
|
274
|
-
|
|
275
|
-
# hprint("[0\n")
|
|
276
|
-
res48 <= vals.hnone?(_h5C)
|
|
277
|
-
end
|
|
264
|
+
res45 <= vals.hminmax
|
|
278
265
|
|
|
279
|
-
|
|
266
|
+
par(clk.posedge) do
|
|
267
|
+
# hprint("]0\n")
|
|
268
|
+
res46 <= vals.hminmax_by {|e| e.to_signed }
|
|
269
|
+
end
|
|
280
270
|
|
|
281
|
-
|
|
271
|
+
[8].inner :res47, :res48
|
|
282
272
|
|
|
283
|
-
|
|
284
|
-
# hprint("[0\n")
|
|
285
|
-
res50 <= vals.hone? { |val| val == _h11 }
|
|
286
|
-
res51 <= vals2.hone? { |val| val == _h00 }
|
|
287
|
-
end
|
|
273
|
+
res47 <= vals.hnone? { |val| val == _h11 }
|
|
288
274
|
|
|
289
|
-
|
|
275
|
+
par(clk.posedge) do
|
|
276
|
+
# hprint("[0\n")
|
|
277
|
+
res48 <= vals.hnone?(_h5C)
|
|
278
|
+
end
|
|
290
279
|
|
|
291
|
-
|
|
292
|
-
# hprint("_0\n")
|
|
293
|
-
(5..10).hreverse_each.hwith_index { |val,i| res52[i] <= val }
|
|
294
|
-
end
|
|
280
|
+
[8].inner :res49, :res50, :res51
|
|
295
281
|
|
|
296
|
-
|
|
297
|
-
bit[8][-8].inner :res53, :res54
|
|
298
|
-
bit[8][-10].inner valsX: [ _h00, _h10, _hA5, _h0B, _hFE, _h34, _h5C, _h44, _h01, _h82 ]
|
|
282
|
+
res49 <= vals.hone?(_h5C)
|
|
299
283
|
|
|
300
|
-
|
|
301
|
-
|
|
284
|
+
par(clk.posedge) do
|
|
285
|
+
# hprint("[0\n")
|
|
286
|
+
res50 <= vals.hone? { |val| val == _h11 }
|
|
287
|
+
res51 <= vals2.hone? { |val| val == _h00 }
|
|
288
|
+
end
|
|
302
289
|
|
|
303
|
-
|
|
304
|
-
# hprint("@0\n")
|
|
305
|
-
res53X <= valsX.hsort
|
|
306
|
-
res54X <= valsX.hsort_by(_h7F) { |val| val.to_signed }
|
|
307
|
-
end
|
|
290
|
+
bit[8][-6].inner :res52
|
|
308
291
|
|
|
309
|
-
|
|
292
|
+
par(clk.posedge) do
|
|
293
|
+
# hprint("_0\n")
|
|
294
|
+
(5..10).hreverse_each.hwith_index { |val,i| res52[i] <= val }
|
|
295
|
+
end
|
|
310
296
|
|
|
311
|
-
|
|
297
|
+
bit[8][-10].inner :res53X, :res54X
|
|
298
|
+
bit[8][-8].inner :res53, :res54
|
|
299
|
+
bit[8][-10].inner valsX: [ _h00, _h10, _hA5, _h0B, _hFE, _h34, _h5C, _h44, _h01, _h82 ]
|
|
312
300
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
res56 <= vals.hsum { |val| val & _h0F }
|
|
316
|
-
end
|
|
301
|
+
res53 <= vals.hsort
|
|
302
|
+
res54 <= vals.hsort_by { |val| val.to_signed }
|
|
317
303
|
|
|
318
|
-
|
|
319
|
-
#
|
|
304
|
+
seq(clk.posedge) do
|
|
305
|
+
# hprint("@0\n")
|
|
306
|
+
res53X <= valsX.hsort
|
|
307
|
+
res54X <= valsX.hsort_by(_h7F) { |val| val.to_signed }
|
|
308
|
+
end
|
|
320
309
|
|
|
321
|
-
|
|
310
|
+
[8].inner :res55, :res56
|
|
322
311
|
|
|
323
|
-
|
|
324
|
-
# # hprint("`0\n")
|
|
325
|
-
# res58 <= vals.htake_while { |val| val < _hAA }
|
|
326
|
-
# end
|
|
312
|
+
res55 <= vals.hsum
|
|
327
313
|
|
|
328
|
-
|
|
314
|
+
par(clk.posedge) do
|
|
315
|
+
# hprint("`0\n")
|
|
316
|
+
res56 <= vals.hsum { |val| val & _h0F }
|
|
317
|
+
end
|
|
329
318
|
|
|
330
|
-
|
|
319
|
+
bit[8][-3].inner :res57
|
|
320
|
+
# bit[8][-8].inner :res58
|
|
331
321
|
|
|
332
|
-
|
|
322
|
+
res57 <= vals.htake(3)
|
|
333
323
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
324
|
+
# par(clk.posedge) do
|
|
325
|
+
# # hprint("`0\n")
|
|
326
|
+
# res58 <= vals.htake_while { |val| val < _hAA }
|
|
327
|
+
# end
|
|
338
328
|
|
|
339
|
-
|
|
340
|
-
bit[8][-8].inner :res62
|
|
329
|
+
bit[8][-8].inner vals3: [ _hFE, _h10, _hA5, _h10, _hFE, _h34, _h5C, _h10 ]
|
|
341
330
|
|
|
342
|
-
|
|
331
|
+
# bit[8][-8].inner :res59,:res60
|
|
343
332
|
|
|
344
|
-
|
|
345
|
-
# hprint("}0\n")
|
|
346
|
-
vals.hzip([_h12]*8).each_with_index { |(a,b),i| res62[i] <= a+b }
|
|
347
|
-
end
|
|
333
|
+
# res59 <= vals3.huniq
|
|
348
334
|
|
|
349
|
-
|
|
350
|
-
|
|
335
|
+
# # par(clk.posedge) do
|
|
336
|
+
# # # hprint("~0\n")
|
|
337
|
+
# # res60 <= vals.huniq { |val| val & _h0F }
|
|
338
|
+
# # end
|
|
351
339
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
res65 <= _b0101011.(:&)
|
|
340
|
+
bit[8][-8].inner :res61
|
|
341
|
+
bit[8][-8].inner :res62
|
|
355
342
|
|
|
356
|
-
|
|
343
|
+
res61 <= vals.hzip((1..6).to_a.map {|i| i.to_expr.as(bit[8]) })
|
|
357
344
|
|
|
358
|
-
|
|
345
|
+
par(clk.posedge) do
|
|
346
|
+
# hprint("}0\n")
|
|
347
|
+
vals.hzip([_h12]*8).each_with_index { |(a,b),i| res62[i] <= a+b }
|
|
348
|
+
end
|
|
359
349
|
|
|
350
|
+
# Test enumerators of values.
|
|
351
|
+
inner :res63, :res64, :res65
|
|
360
352
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
sig <= v[0]
|
|
365
|
-
end
|
|
353
|
+
res63 <= _b0101011.(:|)
|
|
354
|
+
res64 <= _b0101011.(:^)
|
|
355
|
+
res65 <= _b0101011.(:&)
|
|
366
356
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
end
|
|
357
|
+
[8].inner :res66
|
|
358
|
+
|
|
359
|
+
res66 <= [_h01, _h02, _h03, _h04].(:+)
|
|
371
360
|
|
|
372
361
|
|
|
362
|
+
# Test signal declarations within iterator block.
|
|
363
|
+
vals.heach do |v,i|
|
|
364
|
+
inner :sig
|
|
365
|
+
sig <= v[0]
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
[_h0001, _h0002, _h0003].heach.hwith_index do |v,i|
|
|
369
|
+
[16].inner :sig
|
|
370
|
+
sig <= v + i
|
|
371
|
+
end
|
|
373
372
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
373
|
+
[8].inner :bcount
|
|
374
|
+
|
|
375
|
+
# looping = true
|
|
376
|
+
# vals.heach_with_index do |v,i|
|
|
377
|
+
# if looping then
|
|
378
|
+
# looping = false
|
|
379
|
+
# catch(:HDLRubyThrow) do
|
|
380
|
+
# bcount <= i
|
|
381
|
+
# # hif(v > 10) { hbreak }
|
|
382
|
+
# # hif(i > 2) { throw(:HDLRubyThrow) }
|
|
383
|
+
# hif(i > 2) { hbreak }
|
|
384
|
+
# looping = true
|
|
385
|
+
# end
|
|
386
|
+
# end
|
|
387
|
+
# end
|
|
388
|
+
|
|
389
|
+
vals.heach_with_index do |v,i|
|
|
390
|
+
bcount <= i
|
|
391
|
+
# hif(v > 10) { hbreak }
|
|
392
|
+
# hif(i > 2) { throw(:HDLRubyThrow) }
|
|
393
|
+
hif(i > 2) { hbreak }
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
timed do
|
|
398
|
+
clk <= 0
|
|
399
|
+
rst <= 0
|
|
400
|
+
!10.ns
|
|
401
|
+
clk <= 1
|
|
402
|
+
!10.ns
|
|
403
|
+
clk <= 0
|
|
404
|
+
rst <= 1
|
|
405
|
+
!10.ns
|
|
406
|
+
clk <= 1
|
|
407
|
+
!10.ns
|
|
408
|
+
clk <= 0
|
|
409
|
+
rst <= 0
|
|
410
|
+
!10.ns
|
|
411
|
+
clk <= 1
|
|
412
|
+
repeat(500) do
|
|
413
|
+
!10.ns
|
|
414
|
+
clk <= ~clk
|
|
393
415
|
end
|
|
416
|
+
end
|
|
394
417
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Sample for testing SVG generation.
|
|
2
|
+
|
|
3
|
+
system :somemodule do
|
|
4
|
+
[8].input :x, :y
|
|
5
|
+
[8].output :z
|
|
6
|
+
[8].inner :tmp
|
|
7
|
+
|
|
8
|
+
tmp <= x + y
|
|
9
|
+
|
|
10
|
+
z <= tmp * 2
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
system :show_components do
|
|
15
|
+
input :clk
|
|
16
|
+
[8].input :x0, :y0, :x1, :y1, :x2, :y2, :x3, :y3
|
|
17
|
+
[8].output :z0, :z1, :z2
|
|
18
|
+
|
|
19
|
+
[8].inner :sig
|
|
20
|
+
bit[8][-8].inner :mem
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
somemodule(:instance).(x0,y0,z0)
|
|
24
|
+
|
|
25
|
+
sig[6..0] <= x3[6..0] & y3[6..0]
|
|
26
|
+
sig[7] <= x3[7] & y3[7]
|
|
27
|
+
|
|
28
|
+
seq do
|
|
29
|
+
z1 <= x1 | y1 | mem[sig]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
par(clk.posedge) do
|
|
33
|
+
z2 <= x2 - y2
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|