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.
@@ -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 remaing checks the enumerators apply on values directly.
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
- inner :clk,:rst
44
+ inner :clk,:rst
44
45
 
45
- bit[8][-8].inner vals: [ _h00, _h10, _hA5, _h0B, _hFE, _h34, _h5C, _h44 ]
46
- rvals = 8.times.to_a.reverse
46
+ bit[8][-8].inner vals: [ _h00, _h10, _hA5, _h0B, _hFE, _h34, _h5C, _h44 ]
47
+ rvals = 8.times.to_a.reverse
47
48
 
48
- [16].inner :res0, :res1, :res2, :res3
49
+ [16].inner :res0, :res1, :res2, :res3
49
50
 
50
- res0 <= vals.hall? { |val| val != _h11 }
51
- res1 <= vals.hall? { |val| val != _h5C }
51
+ res0 <= vals.hall? { |val| val != _h11 }
52
+ res1 <= vals.hall? { |val| val != _h5C }
52
53
 
53
- par(clk.posedge) do
54
- # hprint("#0\n")
55
- res2 <= rvals.hall? { |val| val.to_expr != 11 }
56
- res3 <= rvals.hall? { |val| val.to_expr != 4 }
57
- # hprint("#1 res0=",res0," res1=",res1," res2=",res2," res3=",res3,"\n")
58
- end
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
- [16].inner :res4, :res5, :res6, :res7
61
+ [16].inner :res4, :res5, :res6, :res7
61
62
 
62
- res4 <= vals.hany? { |val| val == _h11 }
63
- res5 <= vals.hany? { |val| val == _h5C }
63
+ res4 <= vals.hany? { |val| val == _h11 }
64
+ res5 <= vals.hany? { |val| val == _h5C }
64
65
 
65
- par(clk.posedge) do
66
- # hprint("$0\n")
67
- res6 <= rvals.hany? { |val| val == 11 }
68
- res7 <= rvals.hany? { |val| val == 4 }
69
- # hprint("#1 res4=",res4," res5=",res5," res6=",res6," res7=",res7,"\n")
70
- end
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
- [16].inner :res8, :res9, :res10, :res11
73
+ [16].inner :res8, :res9, :res10, :res11
73
74
 
74
- res8 <= vals.hchain(0..10).hany? { |val| val.as(bit[8]) == _h11 }
75
- res9 <= vals.hchain(0..10).hany? { |val| val.as(bit[8]) == _h05 }
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
- par(clk.posedge) do
78
- # hprint("!0\n")
79
- res10 <= rvals.hchain(vals).hany? { |val| val.as(bit[8]) == _h11 }
80
- res11 <= rvals.hchain(vals).hany? { |val| val.as(bit[8]) == _h04 }
81
- end
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
- bit[8][-8].inner :res12, :res13
84
+ bit[8][-8].inner :res12, :res13
84
85
 
85
- res12 <= vals.hmap { |val| val + 1 }
86
+ res12 <= vals.hmap { |val| val + 1 }
86
87
 
87
- par(clk.posedge) do
88
- # hprint("%0\n");
89
- res13 <= vals.hmap { |val| val + 1 }
90
- end
88
+ par(clk.posedge) do
89
+ # hprint("%0\n");
90
+ res13 <= vals.hmap { |val| val + 1 }
91
+ end
91
92
 
92
- bit[8][-8].inner :res14, :res15
93
+ bit[8][-8].inner :res14, :res15
93
94
 
94
- res14 <= vals.hmap.hwith_index { |val,i| val + i }
95
+ res14 <= vals.hmap.hwith_index { |val,i| val + i }
95
96
 
96
- par(clk.posedge) do
97
- # hprint("&0\n");
98
- res15 <= vals.hmap.hwith_index { |val,i| val + i }
99
- end
97
+ par(clk.posedge) do
98
+ # hprint("&0\n");
99
+ res15 <= vals.hmap.hwith_index { |val,i| val + i }
100
+ end
100
101
 
101
- bit[8][-8].inner vals2: [ _h00, _h10, _h00, _h0B, _hFE, _h00, _h5C, _h00 ]
102
- # bit[8][-8].inner :res16, :res17
102
+ bit[8][-8].inner vals2: [ _h00, _h10, _h00, _h0B, _hFE, _h00, _h5C, _h00 ]
103
+ # bit[8][-8].inner :res16, :res17
103
104
 
104
- # res16 <= vals2.hcompact
105
+ # res16 <= vals2.hcompact
105
106
 
106
- # sequencer(clk.posedge,rst) do
107
- # # hprint("|0\n");
108
- # res17 <= vals2.hcompact
109
- # end
107
+ # sequencer(clk.posedge,rst) do
108
+ # # hprint("|0\n");
109
+ # res17 <= vals2.hcompact
110
+ # end
110
111
 
111
- [8].inner :res18, :res19, :res20
112
+ [8].inner :res18, :res19, :res20
112
113
 
113
- res18 <= vals2.hcount
114
- res19 <= vals2.hcount(_h00)
114
+ res18 <= vals2.hcount
115
+ res19 <= vals2.hcount(_h00)
115
116
 
116
- par(clk.posedge) do
117
- # hprint("(0\n");
118
- res20 <= vals2.hcount {|elem| elem > _h10 }
119
- end
117
+ par(clk.posedge) do
118
+ # hprint("(0\n");
119
+ res20 <= vals2.hcount {|elem| elem > _h10 }
120
+ end
120
121
 
121
- # [8].inner :res21, :res22
122
+ # [8].inner :res21, :res22
122
123
 
123
- # vals.hcycle(2) { |elem| res21 <= elem }
124
+ # vals.hcycle(2) { |elem| res21 <= elem }
124
125
 
125
- # par(clk.posedge) do
126
- # # hprint(")0\n")
127
- # vals2.hcycle { |elem| res22 <= elem }
128
- # end
126
+ # par(clk.posedge) do
127
+ # # hprint(")0\n")
128
+ # vals2.hcycle { |elem| res22 <= elem }
129
+ # end
129
130
 
130
- [8].inner :res23, :res24
131
+ [8].inner :res23, :res24
131
132
 
132
- res23 <= vals.hfind(proc {-1}) { |elem| elem > 0 }
133
+ res23 <= vals.hfind(proc {-1}) { |elem| elem > 0 }
133
134
 
134
- par(clk.posedge) do
135
- # hprint("=0\n")
136
- res24 <= vals.hfind(proc {-1}) { |elem| elem == _hAA }
137
- end
135
+ par(clk.posedge) do
136
+ # hprint("=0\n")
137
+ res24 <= vals.hfind(proc {-1}) { |elem| elem == _hAA }
138
+ end
138
139
 
139
- bit[8][-8].inner :res25 #, :res26
140
-
141
- res25 <= vals.hdrop(3)
140
+ bit[8][-8].inner :res25 #, :res26
142
141
 
143
- # par(clk.posedge) do
144
- # # hprint("+0\n")
145
- # res26 <= vals.hdrop_while { |elem| elem < _hAA }
146
- # end
142
+ res25 <= vals.hdrop(3)
147
143
 
148
- bit[8][-8].inner :res27
144
+ # par(clk.posedge) do
145
+ # # hprint("+0\n")
146
+ # res26 <= vals.hdrop_while { |elem| elem < _hAA }
147
+ # end
149
148
 
150
- par(clk.posedge) do
151
- # hprint("*0\n")
152
- vals.heach_cons(3).hwith_index { |(a,b,c),i| res27[i] <= a+b+c }
153
- end
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
- bit[8][-8].inner :res28
156
-
157
- par(clk.posedge) do
158
- # hprint("/0\n")
159
- vals.heach_slice(3).hwith_index do |(a,b,c),i|
160
- if c then
161
- res28[i] <= a+b+c
162
- elsif b then
163
- res28[i] <= a+b
164
- else
165
- res28[i] <= a
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
- bit[32][-4].inner :res29
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
- [8].inner :res30, :res31, :res31x
173
+ par(clk.posedge) do
174
+ # hprint("~0\n")
175
+ res29 <= (_h00000001.._h00000004).heach.hto_a
176
+ end
178
177
 
179
- res30 <= vals.hfind_index(_h0B)
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
- bit[8][-4].inner :res32
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
- inner :res33, :res34
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
- res33 <= vals.hinclude?(_h0B)
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
- [8].inner :res35, :res36
204
- [7].inner :res35X, :res36X
190
+ par(clk.posedge) do
191
+ # hprint("<0\n")
192
+ res32 <= vals.hfirst(4)
193
+ end
205
194
 
206
- res35 <= vals.hinject(_h01) { |a,b| a+b }
195
+ inner :res33, :res34
207
196
 
208
- res35X <= vals.hinject(bit[4]) { |a,b| a+b }
197
+ res33 <= vals.hinclude?(_h0B)
209
198
 
210
- par(clk.posedge) do
211
- # hprint(":0\n")
212
- res36 <= vals.(:+)
213
- res36X <= vals.(bit[4],:+)
214
- end
199
+ par(clk.posedge) do
200
+ # hprint("!0\n")
201
+ res34 <= vals.hinclude?(_hAA)
202
+ end
215
203
 
216
- [8].inner :res37
217
- bit[8][-3].inner :res38
204
+ [8].inner :res35, :res36
205
+ [7].inner :res35X, :res36X
218
206
 
219
- res37 <= vals.hmax
207
+ res35 <= vals.hinject(_h01) { |a,b| a+b }
220
208
 
221
- par(clk.posedge) do
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
- [8].inner :res39
228
- # bit[8][-3].inner :res40
229
- [8].inner :res40
211
+ par(clk.posedge) do
212
+ # hprint(":0\n")
213
+ res36 <= vals.(:+)
214
+ res36X <= vals.(bit[4],:+)
215
+ end
230
216
 
231
- res39 <= vals.hmax_by {|e| e.to_signed }
217
+ [8].inner :res37
218
+ bit[8][-3].inner :res38
232
219
 
233
- par(clk.posedge) do
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
- [8].inner :res41
240
- bit[8][-3].inner :res42
222
+ par(clk.posedge) do
223
+ # hprint(";0\n")
224
+ # res38 <= vals.hmax(3)
225
+ res38 <= vals.hmax(1)
226
+ end
241
227
 
242
- res41 <= vals.hmin
228
+ [8].inner :res39
229
+ # bit[8][-3].inner :res40
230
+ [8].inner :res40
243
231
 
244
- par(clk.posedge) do
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
- [8].inner :res43
251
- bit[8][-3].inner :res44
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
- res43 <= vals.hmin_by {|e| e.to_signed }
240
+ [8].inner :res41
241
+ bit[8][-3].inner :res42
254
242
 
255
- par(clk.posedge) do
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
- [16].inner :res45, :res46
245
+ par(clk.posedge) do
246
+ # hprint(".0\n")
247
+ # res42 <= vals.hmin(3)
248
+ res42 <= vals.hmin(1)
249
+ end
262
250
 
263
- res45 <= vals.hminmax
251
+ [8].inner :res43
252
+ bit[8][-3].inner :res44
264
253
 
265
- par(clk.posedge) do
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
- [8].inner :res47, :res48
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
- res47 <= vals.hnone? { |val| val == _h11 }
262
+ [16].inner :res45, :res46
273
263
 
274
- par(clk.posedge) do
275
- # hprint("[0\n")
276
- res48 <= vals.hnone?(_h5C)
277
- end
264
+ res45 <= vals.hminmax
278
265
 
279
- [8].inner :res49, :res50, :res51
266
+ par(clk.posedge) do
267
+ # hprint("]0\n")
268
+ res46 <= vals.hminmax_by {|e| e.to_signed }
269
+ end
280
270
 
281
- res49 <= vals.hone?(_h5C)
271
+ [8].inner :res47, :res48
282
272
 
283
- par(clk.posedge) do
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
- bit[8][-6].inner :res52
275
+ par(clk.posedge) do
276
+ # hprint("[0\n")
277
+ res48 <= vals.hnone?(_h5C)
278
+ end
290
279
 
291
- par(clk.posedge) do
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
- bit[8][-10].inner :res53X, :res54X
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
- res53 <= vals.hsort
301
- res54 <= vals.hsort_by { |val| val.to_signed }
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
- seq(clk.posedge) do
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
- [8].inner :res55, :res56
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
- res55 <= vals.hsum
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
- par(clk.posedge) do
314
- # hprint("`0\n")
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
- bit[8][-3].inner :res57
319
- # bit[8][-8].inner :res58
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
- res57 <= vals.htake(3)
310
+ [8].inner :res55, :res56
322
311
 
323
- # par(clk.posedge) do
324
- # # hprint("`0\n")
325
- # res58 <= vals.htake_while { |val| val < _hAA }
326
- # end
312
+ res55 <= vals.hsum
327
313
 
328
- bit[8][-8].inner vals3: [ _hFE, _h10, _hA5, _h10, _hFE, _h34, _h5C, _h10 ]
314
+ par(clk.posedge) do
315
+ # hprint("`0\n")
316
+ res56 <= vals.hsum { |val| val & _h0F }
317
+ end
329
318
 
330
- # bit[8][-8].inner :res59,:res60
319
+ bit[8][-3].inner :res57
320
+ # bit[8][-8].inner :res58
331
321
 
332
- # res59 <= vals3.huniq
322
+ res57 <= vals.htake(3)
333
323
 
334
- # # par(clk.posedge) do
335
- # # # hprint("~0\n")
336
- # # res60 <= vals.huniq { |val| val & _h0F }
337
- # # end
324
+ # par(clk.posedge) do
325
+ # # hprint("`0\n")
326
+ # res58 <= vals.htake_while { |val| val < _hAA }
327
+ # end
338
328
 
339
- bit[8][-8].inner :res61
340
- bit[8][-8].inner :res62
329
+ bit[8][-8].inner vals3: [ _hFE, _h10, _hA5, _h10, _hFE, _h34, _h5C, _h10 ]
341
330
 
342
- res61 <= vals.hzip((1..6).to_a.map {|i| i.to_expr.as(bit[8]) })
331
+ # bit[8][-8].inner :res59,:res60
343
332
 
344
- par(clk.posedge) do
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
- # Test enumerators of values.
350
- inner :res63, :res64, :res65
335
+ # # par(clk.posedge) do
336
+ # # # hprint("~0\n")
337
+ # # res60 <= vals.huniq { |val| val & _h0F }
338
+ # # end
351
339
 
352
- res63 <= _b0101011.(:|)
353
- res64 <= _b0101011.(:^)
354
- res65 <= _b0101011.(:&)
340
+ bit[8][-8].inner :res61
341
+ bit[8][-8].inner :res62
355
342
 
356
- [8].inner :res66
343
+ res61 <= vals.hzip((1..6).to_a.map {|i| i.to_expr.as(bit[8]) })
357
344
 
358
- res66 <= [_h01, _h02, _h03, _h04].(:+)
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
- # Test signal declarations within iterator block.
362
- vals.heach do |v,i|
363
- inner :sig
364
- sig <= v[0]
365
- end
353
+ res63 <= _b0101011.(:|)
354
+ res64 <= _b0101011.(:^)
355
+ res65 <= _b0101011.(:&)
366
356
 
367
- [_h0001, _h0002, _h0003].heach.hwith_index do |v,i|
368
- [16].inner :sig
369
- sig <= v + i
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
- timed do
375
- clk <= 0
376
- rst <= 0
377
- !10.ns
378
- clk <= 1
379
- !10.ns
380
- clk <= 0
381
- rst <= 1
382
- !10.ns
383
- clk <= 1
384
- !10.ns
385
- clk <= 0
386
- rst <= 0
387
- !10.ns
388
- clk <= 1
389
- repeat(500) do
390
- !10.ns
391
- clk <= ~clk
392
- end
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
+