HDLRuby 2.3.7 → 2.4.9
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.md +1 -0
- data/lib/HDLRuby/hdr_samples/bstr_bench.rb +14 -0
- data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +49 -0
- data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +27 -0
- data/lib/HDLRuby/hdr_samples/with_multi_channels.rb +300 -0
- data/lib/HDLRuby/hdrcc.rb +10 -1
- data/lib/HDLRuby/hruby_bstr.rb +7 -2
- data/lib/HDLRuby/hruby_high.rb +8 -0
- data/lib/HDLRuby/hruby_low.rb +107 -8
- data/lib/HDLRuby/hruby_low2c.rb +31 -9
- data/lib/HDLRuby/hruby_low_mutable.rb +90 -2
- data/lib/HDLRuby/hruby_low_resolve.rb +1 -0
- data/lib/HDLRuby/hruby_low_without_connection.rb +1 -0
- data/lib/HDLRuby/sim/hruby_sim.h +82 -39
- data/lib/HDLRuby/sim/hruby_sim_calc.c +89 -5
- data/lib/HDLRuby/sim/hruby_sim_core.c +32 -6
- data/lib/HDLRuby/sim/hruby_sim_vcd.c +380 -0
- data/lib/HDLRuby/sim/hruby_sim_vizualize.c +51 -12
- data/lib/HDLRuby/std/fixpoint.rb +10 -2
- data/lib/HDLRuby/std/linear.rb +33 -13
- data/lib/HDLRuby/std/memory.rb +90 -20
- data/lib/HDLRuby/version.rb +1 -1
- metadata +6 -2
data/lib/HDLRuby/std/fixpoint.rb
CHANGED
@@ -52,10 +52,18 @@ module HDLRuby::High::Std
|
|
52
52
|
end
|
53
53
|
# Redefine the multiplication and division for fixed point.
|
54
54
|
typ.define_operator(:*) do |left,right|
|
55
|
-
(
|
55
|
+
if (typ.signed?) then
|
56
|
+
(left.as(signed[isize+fsize*2])*right) >> fsize
|
57
|
+
else
|
58
|
+
(left.as([isize+fsize*2])*right) >> fsize
|
59
|
+
end
|
56
60
|
end
|
57
61
|
typ.define_operator(:/) do |left,right|
|
58
|
-
(
|
62
|
+
if (typ.signed?) then
|
63
|
+
(left.as(signed[isize+fsize*2]) << fsize) / right
|
64
|
+
else
|
65
|
+
(left.as([isize+fsize*2]) << fsize) / right
|
66
|
+
end
|
59
67
|
end
|
60
68
|
typ
|
61
69
|
end
|
data/lib/HDLRuby/std/linear.rb
CHANGED
@@ -209,37 +209,57 @@ module HDLRuby::High::Std
|
|
209
209
|
# lv and rv are valid.
|
210
210
|
lvoks = lefts.each_with_index.map { |left,i| inner :"lvok#{i}" }
|
211
211
|
inner :rvok
|
212
|
+
woks = lefts.each_with_index.map { |left,i| inner :"wok#{i}" }
|
212
213
|
# Run flag
|
213
214
|
inner :run
|
214
215
|
par(ev) do
|
215
216
|
ack <= 0
|
216
217
|
run <= 0
|
218
|
+
hif(~run) do
|
219
|
+
rvok <= 0
|
220
|
+
lefts.each_with_index do |left,i|
|
221
|
+
lvoks[i] <= 0
|
222
|
+
# avs[i] <= 0
|
223
|
+
woks[i] <= 0
|
224
|
+
end
|
225
|
+
end
|
217
226
|
hif(req | run) do
|
218
227
|
run <= 1
|
219
228
|
# Computation request.
|
220
|
-
right.read(rv) { rvok <= 1 }
|
229
|
+
hif(~rvok) { right.read(rv) { rvok <= 1 } }
|
221
230
|
lefts.each_with_index do |left,i|
|
222
|
-
left.read(lvs[i]) { lvoks[i] <= 1 }
|
231
|
+
hif(~lvoks[i]) { left.read(lvs[i]) { lvoks[i] <= 1 } }
|
223
232
|
# accs[i].read(avs[i])
|
224
|
-
hif(lvoks[i] & rvok) do
|
233
|
+
hif(lvoks[i] & rvok & ~woks[i]) do
|
225
234
|
ack <= 1
|
226
235
|
run <= 0
|
227
|
-
# accs[i].write(add.(avs[i],mul.(lvs[i],rv)))
|
228
236
|
seq do
|
229
237
|
avs[i] <= add.(avs[i],mul.(lvs[i],rv))
|
230
|
-
accs[i].write(avs[i])
|
238
|
+
accs[i].write(avs[i]) do
|
239
|
+
woks[i] <= 1
|
240
|
+
# seq do
|
241
|
+
# lvoks[i] <= 0
|
242
|
+
# rvok <= lvoks.reduce(:|)
|
243
|
+
# end
|
244
|
+
end
|
231
245
|
end
|
232
246
|
end
|
247
|
+
hif (woks.reduce(:&)) do
|
248
|
+
woks.each { |wok| wok <= 0 }
|
249
|
+
lvoks.each { | lvok| lvok <=0 }
|
250
|
+
rvok <= 0
|
251
|
+
end
|
233
252
|
end
|
234
253
|
end
|
235
|
-
helse
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
end
|
254
|
+
helse { avs.each {|av| av <= 0 } }
|
255
|
+
# helse do
|
256
|
+
# rvok <= 0
|
257
|
+
# lefts.each_with_index do |left,i|
|
258
|
+
# lvoks[i] <= 0
|
259
|
+
# # accs[i].write(0)
|
260
|
+
# avs[i] <= 0
|
261
|
+
# end
|
262
|
+
# end
|
243
263
|
end
|
244
264
|
end
|
245
265
|
|
data/lib/HDLRuby/std/memory.rb
CHANGED
@@ -292,17 +292,38 @@ HDLRuby::High::Std.channel(:mem_rom) do |typ,size,clk,rst,content,
|
|
292
292
|
trig_r <= 0
|
293
293
|
end
|
294
294
|
# The read procedure.
|
295
|
+
# par do
|
296
|
+
# hif(rst == 0) do
|
297
|
+
# # No reset, so can perform the read.
|
298
|
+
# hif(trig_r == 1) do
|
299
|
+
# # The trigger was previously set, read ok.
|
300
|
+
# target <= dbus_r
|
301
|
+
# blk.call if blk
|
302
|
+
# end
|
303
|
+
# # Prepare the read.
|
304
|
+
# abus_r <= abus_r + 1
|
305
|
+
# trig_r <= 1
|
306
|
+
# end
|
307
|
+
# end
|
308
|
+
# The read procedure.
|
295
309
|
par do
|
296
310
|
hif(rst == 0) do
|
297
311
|
# No reset, so can perform the read.
|
298
312
|
hif(trig_r == 1) do
|
299
313
|
# The trigger was previously set, read ok.
|
300
|
-
target <= dbus_r
|
301
|
-
blk.call if blk
|
314
|
+
# target <= dbus_r
|
315
|
+
# blk.call if blk
|
316
|
+
seq do
|
317
|
+
# abus_r <= abus_r + 1
|
318
|
+
target <= dbus_r
|
319
|
+
blk.call if blk
|
320
|
+
end
|
321
|
+
end
|
322
|
+
helse do
|
323
|
+
# Prepare the read.
|
324
|
+
abus_r <= abus_r + 1
|
325
|
+
trig_r <= 1
|
302
326
|
end
|
303
|
-
# Prepare the read.
|
304
|
-
abus_r <= abus_r + 1
|
305
|
-
trig_r <= 1
|
306
327
|
end
|
307
328
|
end
|
308
329
|
end
|
@@ -331,18 +352,39 @@ HDLRuby::High::Std.channel(:mem_rom) do |typ,size,clk,rst,content,
|
|
331
352
|
# Reset so switch of the access trigger.
|
332
353
|
trig_r <= 0
|
333
354
|
end
|
355
|
+
# # The read procedure.
|
356
|
+
# par do
|
357
|
+
# hif(rst == 0) do
|
358
|
+
# # No reset, so can perform the read.
|
359
|
+
# hif(trig_r == 1) do
|
360
|
+
# # The trigger was previously set, read ok.
|
361
|
+
# target <= dbus_r
|
362
|
+
# blk.call if blk
|
363
|
+
# end
|
364
|
+
# # Prepare the read.
|
365
|
+
# abus_r <= abus_r - 1
|
366
|
+
# trig_r <= 1
|
367
|
+
# end
|
368
|
+
# end
|
334
369
|
# The read procedure.
|
335
370
|
par do
|
336
371
|
hif(rst == 0) do
|
337
372
|
# No reset, so can perform the read.
|
338
373
|
hif(trig_r == 1) do
|
339
374
|
# The trigger was previously set, read ok.
|
340
|
-
target <= dbus_r
|
341
|
-
blk.call if blk
|
375
|
+
# target <= dbus_r
|
376
|
+
# blk.call if blk
|
377
|
+
seq do
|
378
|
+
# abus_r <= abus_r - 1
|
379
|
+
target <= dbus_r
|
380
|
+
blk.call if blk
|
381
|
+
end
|
382
|
+
end
|
383
|
+
helse do
|
384
|
+
# Prepare the read.
|
385
|
+
abus_r <= abus_r - 1
|
386
|
+
trig_r <= 1
|
342
387
|
end
|
343
|
-
# Prepare the read.
|
344
|
-
abus_r <= abus_r - 1
|
345
|
-
trig_r <= 1
|
346
388
|
end
|
347
389
|
end
|
348
390
|
end
|
@@ -541,12 +583,19 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
541
583
|
# No reset, so can perform the read.
|
542
584
|
hif(trig_r == 1) do
|
543
585
|
# The trigger was previously set, read ok.
|
544
|
-
target <= dbus_r
|
545
|
-
blk.call if blk
|
586
|
+
# target <= dbus_r
|
587
|
+
# blk.call if blk
|
588
|
+
seq do
|
589
|
+
# abus_r <= abus_r + 1
|
590
|
+
target <= dbus_r
|
591
|
+
blk.call if blk
|
592
|
+
end
|
593
|
+
end
|
594
|
+
helse do
|
595
|
+
# Prepare the read.
|
596
|
+
abus_r <= abus_r + 1
|
597
|
+
trig_r <= 1
|
546
598
|
end
|
547
|
-
# Prepare the read.
|
548
|
-
abus_r <= abus_r + 1
|
549
|
-
trig_r <= 1
|
550
599
|
end
|
551
600
|
end
|
552
601
|
end
|
@@ -613,18 +662,39 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
613
662
|
# Reset so switch of the access trigger.
|
614
663
|
trig_r <= 0
|
615
664
|
end
|
665
|
+
# # The read procedure.
|
666
|
+
# par do
|
667
|
+
# hif(rst == 0) do
|
668
|
+
# # No reset, so can perform the read.
|
669
|
+
# hif(trig_r == 1) do
|
670
|
+
# # The trigger was previously set, read ok.
|
671
|
+
# target <= dbus_r
|
672
|
+
# blk.call if blk
|
673
|
+
# end
|
674
|
+
# # Prepare the read.
|
675
|
+
# abus_r <= abus_r - 1
|
676
|
+
# trig_r <= 1
|
677
|
+
# end
|
678
|
+
# end
|
616
679
|
# The read procedure.
|
617
680
|
par do
|
618
681
|
hif(rst == 0) do
|
619
682
|
# No reset, so can perform the read.
|
620
683
|
hif(trig_r == 1) do
|
621
684
|
# The trigger was previously set, read ok.
|
622
|
-
target <= dbus_r
|
623
|
-
blk.call if blk
|
685
|
+
# target <= dbus_r
|
686
|
+
# blk.call if blk
|
687
|
+
seq do
|
688
|
+
# abus_r <= abus_r - 1
|
689
|
+
target <= dbus_r
|
690
|
+
blk.call if blk
|
691
|
+
end
|
692
|
+
end
|
693
|
+
helse do
|
694
|
+
# Prepare the read.
|
695
|
+
abus_r <= abus_r - 1
|
696
|
+
trig_r <= 1
|
624
697
|
end
|
625
|
-
# Prepare the read.
|
626
|
-
abus_r <= abus_r - 1
|
627
|
-
trig_r <= 1
|
628
698
|
end
|
629
699
|
end
|
630
700
|
end
|
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.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/HDLRuby/hdr_samples/addsub.rb
|
76
76
|
- lib/HDLRuby/hdr_samples/addsubz.rb
|
77
77
|
- lib/HDLRuby/hdr_samples/alu.rb
|
78
|
+
- lib/HDLRuby/hdr_samples/bstr_bench.rb
|
78
79
|
- lib/HDLRuby/hdr_samples/calculator.rb
|
79
80
|
- lib/HDLRuby/hdr_samples/counter_bench.rb
|
80
81
|
- lib/HDLRuby/hdr_samples/dff.rb
|
@@ -88,6 +89,7 @@ files:
|
|
88
89
|
- lib/HDLRuby/hdr_samples/memory_test.rb
|
89
90
|
- lib/HDLRuby/hdr_samples/multer_gen.rb
|
90
91
|
- lib/HDLRuby/hdr_samples/multer_seq.rb
|
92
|
+
- lib/HDLRuby/hdr_samples/neg_arith_bench.rb
|
91
93
|
- lib/HDLRuby/hdr_samples/neural/a.rb
|
92
94
|
- lib/HDLRuby/hdr_samples/neural/a_sub.rb
|
93
95
|
- lib/HDLRuby/hdr_samples/neural/bw.rb
|
@@ -123,6 +125,7 @@ files:
|
|
123
125
|
- lib/HDLRuby/hdr_samples/with_linear.rb
|
124
126
|
- lib/HDLRuby/hdr_samples/with_loop.rb
|
125
127
|
- lib/HDLRuby/hdr_samples/with_memory.rb
|
128
|
+
- lib/HDLRuby/hdr_samples/with_multi_channels.rb
|
126
129
|
- lib/HDLRuby/hdr_samples/with_reconf.rb
|
127
130
|
- lib/HDLRuby/hdrcc.rb
|
128
131
|
- lib/HDLRuby/high_samples/_adder_fault.rb
|
@@ -262,6 +265,7 @@ files:
|
|
262
265
|
- lib/HDLRuby/sim/hruby_sim_calc.c
|
263
266
|
- lib/HDLRuby/sim/hruby_sim_core.c
|
264
267
|
- lib/HDLRuby/sim/hruby_sim_list.c
|
268
|
+
- lib/HDLRuby/sim/hruby_sim_vcd.c
|
265
269
|
- lib/HDLRuby/sim/hruby_sim_vizualize.c
|
266
270
|
- lib/HDLRuby/sim/hruby_value_pool.c
|
267
271
|
- lib/HDLRuby/std/channel.rb
|