HDLRuby 2.11.12 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.html +3274 -0
- data/README.md +660 -128
- data/ext/hruby_sim/hruby_sim_calc.c +2 -0
- 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 +2 -1
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/with_bram.rb +3 -3
- 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_ref_expr.rb +30 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer.rb +185 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_deep.rb +91 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +439 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +89 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_func.rb +63 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +120 -0
- data/lib/HDLRuby/hdrcc.rb +16 -3
- data/lib/HDLRuby/hdrlib.rb +1 -1
- data/lib/HDLRuby/hruby_db.rb +2 -2
- data/lib/HDLRuby/hruby_high.rb +61 -25
- data/lib/HDLRuby/hruby_high_fullname.rb +3 -1
- data/lib/HDLRuby/hruby_low.rb +2 -2
- data/lib/HDLRuby/hruby_low2c.rb +58 -43
- 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 +78 -43
- 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 +64 -32
- data/lib/HDLRuby/hruby_low_mutable.rb +53 -118
- data/lib/HDLRuby/hruby_low_resolve.rb +26 -31
- 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 +19 -13
- data/lib/HDLRuby/hruby_low_without_namespace.rb +47 -32
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +18 -12
- data/lib/HDLRuby/hruby_low_without_select.rb +36 -23
- data/lib/HDLRuby/hruby_low_without_subsignals.rb +79 -39
- data/lib/HDLRuby/hruby_rcsim.rb +79 -64
- data/lib/HDLRuby/hruby_rsim.rb +64 -15
- data/lib/HDLRuby/hruby_rsim_mute.rb +2 -3
- data/lib/HDLRuby/hruby_rsim_vcd.rb +28 -25
- data/lib/HDLRuby/hruby_types.rb +5 -5
- data/lib/HDLRuby/hruby_values.rb +19 -8
- data/lib/HDLRuby/hruby_verilog.rb +191 -65
- data/lib/HDLRuby/hruby_verilog_name.rb +49 -42
- data/lib/HDLRuby/soft/stacks.rb +219 -0
- data/lib/HDLRuby/std/bram.rb +9 -5
- data/lib/HDLRuby/std/clocks.rb +1 -1
- data/lib/HDLRuby/std/fsm.rb +39 -10
- data/lib/HDLRuby/std/sequencer.rb +2085 -0
- data/lib/HDLRuby/std/sequencer_func.rb +533 -0
- data/lib/HDLRuby/std/sequencer_sync.rb +400 -0
- data/lib/HDLRuby/std/std.rb +13 -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 +2890 -0
- data/tuto/tutorial_sw.pdf +0 -0
- data/tuto/tutorial_sw_jp.md +417 -0
- metadata +46 -2
data/lib/HDLRuby/hruby_rcsim.rb
CHANGED
@@ -88,8 +88,8 @@ module HDLRuby::High
|
|
88
88
|
|
89
89
|
|
90
90
|
|
91
|
-
## Extends the SystemT class for hybrid Ruby-C simulation.
|
92
91
|
class SystemT
|
92
|
+
## Extends the SystemT class for hybrid Ruby-C simulation.
|
93
93
|
|
94
94
|
attr_reader :rcsystemT # The access to the C version of the systemT
|
95
95
|
|
@@ -141,8 +141,8 @@ module HDLRuby::High
|
|
141
141
|
end
|
142
142
|
|
143
143
|
|
144
|
-
## Extends the Scope class for hybrid Ruby-C simulation.
|
145
144
|
class Scope
|
145
|
+
## Extends the Scope class for hybrid Ruby-C simulation.
|
146
146
|
|
147
147
|
attr_reader :rcscope # The access to the C version of the scope.
|
148
148
|
|
@@ -185,25 +185,26 @@ module HDLRuby::High
|
|
185
185
|
end)
|
186
186
|
end
|
187
187
|
|
188
|
-
#
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
188
|
+
# Create and add the behaviors and connections.
|
189
|
+
rcbehs = self.each_behavior.map {|beh| beh.to_rcsim(subowner)} # +
|
190
|
+
# self.each_connection.map {|cxt| cxt.to_rcsim(subowner) }
|
191
|
+
self.each_connection do |cnx|
|
192
|
+
# ICIICI
|
193
|
+
if !cnx.right.is_a?(RefObject) then
|
194
|
+
rcbehs << cnx.to_rcsim(subowner)
|
195
|
+
else
|
196
|
+
# puts "cnx.left.object=#{cnx.left.object.fullname} cnx.right.object=#{cnx.right.object.fullname}"
|
197
|
+
rcbehs << cnx.to_rcsim(subowner)
|
198
|
+
if cnx.left.is_a?(RefObject) then
|
199
|
+
sigL = cnx.left.object
|
200
|
+
prtL = sigL.parent
|
201
|
+
if prtL.is_a?(SystemT) and prtL.each_inout.any?{|e| e.object_id == sigL.object_id} then
|
202
|
+
# puts "write to right with sigL=#{sigL.fullname}."
|
203
|
+
rcbehs << Connection.new(cnx.right.clone,cnx.left.clone).to_rcsim(subowner)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
207
208
|
if rcbehs.any? then
|
208
209
|
RCSim.rcsim_add_scope_behaviors(@rcscope,rcbehs)
|
209
210
|
end
|
@@ -217,8 +218,8 @@ module HDLRuby::High
|
|
217
218
|
|
218
219
|
|
219
220
|
|
220
|
-
## Extends the Type class for hybrid Ruby-C simulation.
|
221
221
|
class Type
|
222
|
+
## Extends the Type class for hybrid Ruby-C simulation.
|
222
223
|
|
223
224
|
attr_reader :rctype # The access to the C version of the scope.
|
224
225
|
|
@@ -238,8 +239,8 @@ module HDLRuby::High
|
|
238
239
|
end
|
239
240
|
end
|
240
241
|
|
241
|
-
## Extends the TypeDef class for hybrid Ruby-C simulation.
|
242
242
|
class TypeDef
|
243
|
+
## Extends the TypeDef class for hybrid Ruby-C simulation.
|
243
244
|
|
244
245
|
# Generate the C description of the type.
|
245
246
|
def to_rcsim
|
@@ -249,8 +250,8 @@ module HDLRuby::High
|
|
249
250
|
end
|
250
251
|
end
|
251
252
|
|
252
|
-
## Extends the TypeVector class for hybrid Ruby-C simulation.
|
253
253
|
class TypeVector
|
254
|
+
## Extends the TypeVector class for hybrid Ruby-C simulation.
|
254
255
|
|
255
256
|
# Generate the C description of the type.
|
256
257
|
def to_rcsim
|
@@ -260,8 +261,8 @@ module HDLRuby::High
|
|
260
261
|
end
|
261
262
|
end
|
262
263
|
|
263
|
-
## Extends the TypeTuple class for hybrid Ruby-C simulation.
|
264
264
|
class TypeTuple
|
265
|
+
## Extends the TypeTuple class for hybrid Ruby-C simulation.
|
265
266
|
# Add the possibility to change the direction.
|
266
267
|
def direction=(dir)
|
267
268
|
@direction = dir == :little ? :little : :big
|
@@ -276,8 +277,9 @@ module HDLRuby::High
|
|
276
277
|
end
|
277
278
|
|
278
279
|
|
279
|
-
## Extends the TypeStruct class for hybrid Ruby-C simulation.
|
280
280
|
class TypeStruct
|
281
|
+
## Extends the TypeStruct class for hybrid Ruby-C simulation.
|
282
|
+
|
281
283
|
# Add the possibility to change the direction.
|
282
284
|
def direction=(dir)
|
283
285
|
@direction = dir == :little ? :little : :big
|
@@ -335,6 +337,18 @@ module HDLRuby::High
|
|
335
337
|
self.block.each_inner do |inner|
|
336
338
|
refs.delete_if {|r| r.name == inner.name }
|
337
339
|
end
|
340
|
+
# The get the left references: the will be removed from the
|
341
|
+
# events.
|
342
|
+
left_refs = self.block.each_node_deep.select do |node|
|
343
|
+
node.is_a?(RefObject) && node.leftvalue? &&
|
344
|
+
!node.parent.is_a?(RefObject)
|
345
|
+
end.to_a
|
346
|
+
# Keep only one left ref per signal.
|
347
|
+
left_refs.uniq! { |node| node.fullname }
|
348
|
+
# Remove the left refs.
|
349
|
+
left_refs.each do |l|
|
350
|
+
refs.delete_if {|r| r.fullname == l.fullname }
|
351
|
+
end
|
338
352
|
# Generate the event.
|
339
353
|
events = refs.map {|ref| Event.new(:anyedge,ref.clone) }
|
340
354
|
# Add them to the behavior for further processing.
|
@@ -374,19 +388,19 @@ module HDLRuby::High
|
|
374
388
|
end
|
375
389
|
|
376
390
|
|
377
|
-
## Extends the Behavior class for hybrid Ruby-C simulation.
|
378
391
|
class Behavior
|
392
|
+
## Extends the Behavior class for hybrid Ruby-C simulation.
|
379
393
|
include RCSimBehavior
|
380
394
|
end
|
381
395
|
|
382
|
-
## Extends the TimeBehavior class for hybrid Ruby-C simulation.
|
383
396
|
class TimeBehavior
|
397
|
+
## Extends the TimeBehavior class for hybrid Ruby-C simulation.
|
384
398
|
include RCSimBehavior
|
385
399
|
end
|
386
400
|
|
387
401
|
|
388
|
-
## Extends the Event class for hybrid Ruby-C simulation.
|
389
402
|
class Event
|
403
|
+
## Extends the Event class for hybrid Ruby-C simulation.
|
390
404
|
|
391
405
|
attr_reader :rcevent
|
392
406
|
|
@@ -404,8 +418,8 @@ module HDLRuby::High
|
|
404
418
|
end
|
405
419
|
|
406
420
|
|
407
|
-
## Extends the SignalI class for hybrid Ruby-C simulation.
|
408
421
|
class SignalI
|
422
|
+
## Extends the SignalI class for hybrid Ruby-C simulation.
|
409
423
|
|
410
424
|
attr_reader :rcsignalI
|
411
425
|
|
@@ -436,8 +450,8 @@ module HDLRuby::High
|
|
436
450
|
end
|
437
451
|
|
438
452
|
|
439
|
-
## Extends the SignalC class for hybrid Ruby-C simulation.
|
440
453
|
class SignalC
|
454
|
+
## Extends the SignalC class for hybrid Ruby-C simulation.
|
441
455
|
|
442
456
|
attr_reader :rcsignalC
|
443
457
|
|
@@ -459,8 +473,8 @@ module HDLRuby::High
|
|
459
473
|
end
|
460
474
|
|
461
475
|
|
462
|
-
## Extends the SystemI class for hybrid Ruby-C simulation.
|
463
476
|
class SystemI
|
477
|
+
## Extends the SystemI class for hybrid Ruby-C simulation.
|
464
478
|
|
465
479
|
attr_reader :rcsystemI
|
466
480
|
|
@@ -496,19 +510,19 @@ module HDLRuby::High
|
|
496
510
|
end
|
497
511
|
|
498
512
|
|
499
|
-
## Extends the Chunk class for hybrid Ruby-C simulation.
|
500
513
|
class Chunk
|
514
|
+
## Extends the Chunk class for hybrid Ruby-C simulation.
|
501
515
|
# TODO!!
|
502
516
|
end
|
503
517
|
|
504
|
-
## Extends the Code class for hybrid Ruby-C simulation.
|
505
518
|
class Code
|
519
|
+
## Extends the Code class for hybrid Ruby-C simulation.
|
506
520
|
# TODO!!
|
507
521
|
end
|
508
522
|
|
509
523
|
|
510
|
-
## Extends the Statement class for hybrid Ruby-C simulation.
|
511
524
|
class Statement
|
525
|
+
## Extends the Statement class for hybrid Ruby-C simulation.
|
512
526
|
|
513
527
|
attr_reader :rcstatement
|
514
528
|
|
@@ -519,8 +533,8 @@ module HDLRuby::High
|
|
519
533
|
end
|
520
534
|
|
521
535
|
|
522
|
-
## Extends the Transmit class for hybrid Ruby-C simulation.
|
523
536
|
class Transmit
|
537
|
+
## Extends the Transmit class for hybrid Ruby-C simulation.
|
524
538
|
attr_reader :rcstatement
|
525
539
|
|
526
540
|
# Generate the C description of the transmit.
|
@@ -534,8 +548,8 @@ module HDLRuby::High
|
|
534
548
|
end
|
535
549
|
|
536
550
|
|
537
|
-
## Extends the Print class for hybrid Ruby-C simulation.
|
538
551
|
class Print
|
552
|
+
## Extends the Print class for hybrid Ruby-C simulation.
|
539
553
|
attr_reader :rcstatement
|
540
554
|
|
541
555
|
# Generate the C description of the print.
|
@@ -554,8 +568,8 @@ module HDLRuby::High
|
|
554
568
|
end
|
555
569
|
|
556
570
|
|
557
|
-
## Extends the TimeTerminate class for hybrid Ruby-C simulation.
|
558
571
|
class TimeTerminate
|
572
|
+
## Extends the TimeTerminate class for hybrid Ruby-C simulation.
|
559
573
|
attr_reader :rcstatement
|
560
574
|
|
561
575
|
# Generate the C description of the terminate.
|
@@ -567,15 +581,15 @@ module HDLRuby::High
|
|
567
581
|
end
|
568
582
|
end
|
569
583
|
|
570
|
-
## Extends the Configure class for hybrid Ruby-C simulation.
|
571
584
|
class Configure
|
585
|
+
## Extends the Configure class for hybrid Ruby-C simulation.
|
572
586
|
attr_reader :rcstatement
|
573
587
|
# TODO!!!
|
574
588
|
end
|
575
589
|
|
576
590
|
|
577
|
-
## Extends the If class for hybrid Ruby-C simulation.
|
578
591
|
class If
|
592
|
+
## Extends the If class for hybrid Ruby-C simulation.
|
579
593
|
attr_reader :rcstatement
|
580
594
|
|
581
595
|
# Generate the C description of the hardware if.
|
@@ -597,13 +611,13 @@ module HDLRuby::High
|
|
597
611
|
end
|
598
612
|
|
599
613
|
|
600
|
-
## Extends the When class for hybrid Ruby-C simulation.
|
601
614
|
class When
|
615
|
+
## Extends the When class for hybrid Ruby-C simulation.
|
602
616
|
# Nothing to add.
|
603
617
|
end
|
604
618
|
|
605
|
-
## Extends the Case class for hybrid Ruby-C simulation.
|
606
619
|
class Case
|
620
|
+
## Extends the Case class for hybrid Ruby-C simulation.
|
607
621
|
attr_reader :rcstatement
|
608
622
|
|
609
623
|
# Generate the C description of the hardware case.
|
@@ -625,13 +639,13 @@ module HDLRuby::High
|
|
625
639
|
end
|
626
640
|
|
627
641
|
|
628
|
-
## Extends the Delay class for hybrid Ruby-C simulation.
|
629
642
|
class Delay
|
643
|
+
## Extends the Delay class for hybrid Ruby-C simulation.
|
630
644
|
# Nothing to do.
|
631
645
|
end
|
632
646
|
|
633
|
-
## Extends the TimeWait class for hybrid Ruby-C simulation.
|
634
647
|
class TimeWait
|
648
|
+
## Extends the TimeWait class for hybrid Ruby-C simulation.
|
635
649
|
attr_reader :rcstatement
|
636
650
|
|
637
651
|
# Generate the C description of the time wait.
|
@@ -645,8 +659,8 @@ module HDLRuby::High
|
|
645
659
|
end
|
646
660
|
|
647
661
|
|
648
|
-
## Extends the TimeRepeat class for hybrid Ruby-C simulation.
|
649
662
|
class TimeRepeat
|
663
|
+
## Extends the TimeRepeat class for hybrid Ruby-C simulation.
|
650
664
|
attr_reader :rcstatement
|
651
665
|
|
652
666
|
# Generate the C description of the hardware case.
|
@@ -701,24 +715,25 @@ module HDLRuby::High
|
|
701
715
|
end
|
702
716
|
end
|
703
717
|
|
704
|
-
## Extends the Block class for hybrid Ruby-C simulation.
|
705
718
|
class Block
|
719
|
+
## Extends the Block class for hybrid Ruby-C simulation.
|
706
720
|
include RCSimBlock
|
707
721
|
end
|
708
722
|
|
709
|
-
## Extends the TimeBlock class for hybrid Ruby-C simulation.
|
710
723
|
class TimeBlock
|
724
|
+
## Extends the TimeBlock class for hybrid Ruby-C simulation.
|
711
725
|
include RCSimBlock
|
712
726
|
end
|
713
727
|
|
714
728
|
|
715
|
-
## Extends the Connection class for hybrid Ruby-C simulation.
|
716
729
|
class Connection
|
730
|
+
## Extends the Connection class for hybrid Ruby-C simulation.
|
717
731
|
attr_reader :rcbehavior
|
718
732
|
|
719
733
|
# Add recursively any event to +rcevs+ for activativing the
|
720
734
|
# connection from signal +sig+ attached to +rcbehavior+
|
721
735
|
def self.add_rcevents(sig,rcevs,rcbehavior)
|
736
|
+
# puts "add_rcevents for sig=#{sig.fullname}"
|
722
737
|
# Recurse on sub signals if any.
|
723
738
|
sig.each_signal do |sub|
|
724
739
|
Connection.add_rcevents(sub,rcevs,rcbehavior)
|
@@ -767,8 +782,8 @@ module HDLRuby::High
|
|
767
782
|
end
|
768
783
|
|
769
784
|
|
770
|
-
## Extends the Expression class for hybrid Ruby-C simulation.
|
771
785
|
class Expression
|
786
|
+
## Extends the Expression class for hybrid Ruby-C simulation.
|
772
787
|
|
773
788
|
# attr_reader :rcexpression
|
774
789
|
|
@@ -779,8 +794,8 @@ module HDLRuby::High
|
|
779
794
|
end
|
780
795
|
|
781
796
|
|
782
|
-
## Extends the Value class for hybrid Ruby-C simulation.
|
783
797
|
class Value
|
798
|
+
## Extends the Value class for hybrid Ruby-C simulation.
|
784
799
|
# attr_reader :rcexpression
|
785
800
|
|
786
801
|
# Generate the C description of the value.
|
@@ -815,8 +830,8 @@ module HDLRuby::High
|
|
815
830
|
end
|
816
831
|
end
|
817
832
|
|
818
|
-
## Extends the StringE class for hybrid Ruby-C simulation.
|
819
833
|
class StringE
|
834
|
+
## Extends the StringE class for hybrid Ruby-C simulation.
|
820
835
|
|
821
836
|
# Generate the C description of the value.
|
822
837
|
def to_rcsim
|
@@ -826,8 +841,8 @@ module HDLRuby::High
|
|
826
841
|
end
|
827
842
|
|
828
843
|
|
829
|
-
## Extends the Cast class for hybrid Ruby-C simulation.
|
830
844
|
class Cast
|
845
|
+
## Extends the Cast class for hybrid Ruby-C simulation.
|
831
846
|
# attr_reader :rcexpression
|
832
847
|
|
833
848
|
# Generate the C description of the cast.
|
@@ -846,13 +861,13 @@ module HDLRuby::High
|
|
846
861
|
end
|
847
862
|
|
848
863
|
|
849
|
-
## Extends the Operation class for hybrid Ruby-C simulation.
|
850
864
|
class Operation
|
865
|
+
## Extends the Operation class for hybrid Ruby-C simulation.
|
851
866
|
# Nothing to do.
|
852
867
|
end
|
853
868
|
|
854
|
-
## Extends the Unary class for hybrid Ruby-C simulation.
|
855
869
|
class Unary
|
870
|
+
## Extends the Unary class for hybrid Ruby-C simulation.
|
856
871
|
attr_reader :rcexpression
|
857
872
|
|
858
873
|
# Generate the C description of the unary operation.
|
@@ -863,8 +878,8 @@ module HDLRuby::High
|
|
863
878
|
end
|
864
879
|
end
|
865
880
|
|
866
|
-
## Extends the Binary class for hybrid Ruby-C simulation.
|
867
881
|
class Binary
|
882
|
+
## Extends the Binary class for hybrid Ruby-C simulation.
|
868
883
|
# attr_reader :rcexpression
|
869
884
|
|
870
885
|
# Generate the C description of the binary operation.
|
@@ -877,8 +892,8 @@ module HDLRuby::High
|
|
877
892
|
end
|
878
893
|
|
879
894
|
|
880
|
-
## Extends the Select class for hybrid Ruby-C simulation.
|
881
895
|
class Select
|
896
|
+
## Extends the Select class for hybrid Ruby-C simulation.
|
882
897
|
# attr_reader :rcexpression
|
883
898
|
|
884
899
|
# Generate the C description of the select operation.
|
@@ -898,8 +913,8 @@ module HDLRuby::High
|
|
898
913
|
end
|
899
914
|
|
900
915
|
|
901
|
-
## Extends the Concat class for hybrid Ruby-C simulation.
|
902
916
|
class Concat
|
917
|
+
## Extends the Concat class for hybrid Ruby-C simulation.
|
903
918
|
# attr_reader :rcexpression
|
904
919
|
|
905
920
|
# Generate the C description of the concat operation.
|
@@ -920,8 +935,8 @@ module HDLRuby::High
|
|
920
935
|
|
921
936
|
|
922
937
|
|
923
|
-
## Extends the Ref class for hybrid Ruby-C simulation.
|
924
938
|
class Ref
|
939
|
+
## Extends the Ref class for hybrid Ruby-C simulation.
|
925
940
|
# attr_reader :rcref
|
926
941
|
# alias_method :rcexpression, :rcref
|
927
942
|
|
@@ -932,8 +947,8 @@ module HDLRuby::High
|
|
932
947
|
end
|
933
948
|
|
934
949
|
|
935
|
-
## Extends the RefConcat class for hybrid Ruby-C simulation.
|
936
950
|
class RefConcat
|
951
|
+
## Extends the RefConcat class for hybrid Ruby-C simulation.
|
937
952
|
# attr_reader :rcref
|
938
953
|
# alias_method :rcexpression, :rcref
|
939
954
|
|
@@ -953,8 +968,8 @@ module HDLRuby::High
|
|
953
968
|
end
|
954
969
|
|
955
970
|
|
956
|
-
## Extends the RefIndex class for hybrid Ruby-C simulation.
|
957
971
|
class RefIndex
|
972
|
+
## Extends the RefIndex class for hybrid Ruby-C simulation.
|
958
973
|
# attr_reader :rcref
|
959
974
|
# alias_method :rcexpression, :rcref
|
960
975
|
|
@@ -967,8 +982,8 @@ module HDLRuby::High
|
|
967
982
|
end
|
968
983
|
|
969
984
|
|
970
|
-
## Extends the RefRange class for hybrid Ruby-C simulation.
|
971
985
|
class RefRange
|
986
|
+
## Extends the RefRange class for hybrid Ruby-C simulation.
|
972
987
|
# attr_reader :rcref
|
973
988
|
# alias_method :rcexpression, :rcref
|
974
989
|
|
@@ -983,14 +998,14 @@ module HDLRuby::High
|
|
983
998
|
end
|
984
999
|
|
985
1000
|
|
986
|
-
## Extends the RefName class for hybrid Ruby-C simulation.
|
987
1001
|
class RefName
|
1002
|
+
## Extends the RefName class for hybrid Ruby-C simulation.
|
988
1003
|
# Should not be used with rcsim.
|
989
1004
|
end
|
990
1005
|
|
991
1006
|
|
992
|
-
## Extends the RefThis class for hybrid Ruby-C simulation.
|
993
1007
|
class RefThis
|
1008
|
+
## Extends the RefThis class for hybrid Ruby-C simulation.
|
994
1009
|
# attr_reader :rcref
|
995
1010
|
# alias_method :rcexpression, :rcref
|
996
1011
|
|
@@ -1001,8 +1016,8 @@ module HDLRuby::High
|
|
1001
1016
|
end
|
1002
1017
|
|
1003
1018
|
|
1004
|
-
## Extends the RefObject class for hybrid Ruby-C simulation.
|
1005
1019
|
class RefObject
|
1020
|
+
## Extends the RefObject class for hybrid Ruby-C simulation.
|
1006
1021
|
# attr_reader :rcref
|
1007
1022
|
# alias_method :rcexpression, :rcref
|
1008
1023
|
|
data/lib/HDLRuby/hruby_rsim.rb
CHANGED
@@ -12,13 +12,17 @@ module HDLRuby::High
|
|
12
12
|
#
|
13
13
|
########################################################################
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
|
17
17
|
class SystemT
|
18
|
+
## Enhance a system type with Ruby simulation.
|
18
19
|
|
19
20
|
# Tell if the simulation is in multithread mode or not.
|
20
21
|
attr_reader :multithread
|
21
22
|
|
23
|
+
# The current global time.
|
24
|
+
attr_reader :time
|
25
|
+
|
22
26
|
## Add untimed objet +obj+
|
23
27
|
def add_untimed(obj)
|
24
28
|
@untimeds << obj
|
@@ -66,6 +70,7 @@ module HDLRuby::High
|
|
66
70
|
@sig_active.each do |sig|
|
67
71
|
next if (sig.c_value.eql?(sig.f_value))
|
68
72
|
# next if (sig.c_value.to_vstr == sig.f_value.to_vstr)
|
73
|
+
# puts "for sig=#{sig.fullname}"
|
69
74
|
sig.each_anyedge { |beh| @sig_exec << beh }
|
70
75
|
if (sig.c_value.zero?) then
|
71
76
|
# puts "sig.c_value=#{sig.c_value.content}"
|
@@ -78,6 +83,7 @@ module HDLRuby::High
|
|
78
83
|
@sig_active.each { |sig| sig.c_value = sig.f_value }
|
79
84
|
# puts "first @sig_exec.size=#{@sig_exec.size}"
|
80
85
|
@sig_exec.uniq! {|beh| beh.object_id }
|
86
|
+
# puts "now @sig_exec.size=#{@sig_exec.size}"
|
81
87
|
# Display the activated signals.
|
82
88
|
@sig_active.each do |sig|
|
83
89
|
if !shown_values[sig].eql?(sig.f_value) then
|
@@ -93,9 +99,10 @@ module HDLRuby::High
|
|
93
99
|
@sig_exec.clear
|
94
100
|
@sig_active.uniq! {|sig| sig.object_id }
|
95
101
|
# puts "@sig_active.size=#{@sig_active.size}"
|
96
|
-
#
|
102
|
+
# Compute the nearest next time stamp.
|
97
103
|
@time = (@timed_behaviors.min {|b0,b1| b0.time <=> b1.time }).time
|
98
104
|
end
|
105
|
+
# puts "@time=#{@time}"
|
99
106
|
# Display the time
|
100
107
|
self.show_time
|
101
108
|
end
|
@@ -322,9 +329,8 @@ module HDLRuby::High
|
|
322
329
|
end
|
323
330
|
|
324
331
|
|
325
|
-
##
|
326
|
-
# Describes scopes of system types.
|
327
332
|
class Scope
|
333
|
+
## Enhance a scope with Ruby simulation.
|
328
334
|
|
329
335
|
## Initialize the simulation for system +systemT+.
|
330
336
|
def init_sim(systemT)
|
@@ -335,7 +341,26 @@ module HDLRuby::High
|
|
335
341
|
# Recurse on the systemI.
|
336
342
|
self.each_systemI { |sys| sys.init_sim(systemT) }
|
337
343
|
# Recurse on the connections.
|
338
|
-
self.each_connection { |cnx| cnx.init_sim(systemT) }
|
344
|
+
# self.each_connection { |cnx| cnx.init_sim(systemT) }
|
345
|
+
self.each_connection do |cnx|
|
346
|
+
# Connection to a real expression?
|
347
|
+
if !cnx.right.is_a?(RefObject) then
|
348
|
+
# Yes.
|
349
|
+
cnx.init_sim(systemT)
|
350
|
+
else
|
351
|
+
# No, maybe the reverse connection is also required.
|
352
|
+
# puts "cnx.left.object=#{cnx.left.object.fullname} cnx.right.object=#{cnx.right.object.fullname}"
|
353
|
+
cnx.init_sim(systemT)
|
354
|
+
if cnx.left.is_a?(RefObject) then
|
355
|
+
sigL = cnx.left.object
|
356
|
+
prtL = sigL.parent
|
357
|
+
if prtL.is_a?(SystemT) and prtL.each_inout.any?{|e| e.object_id == sigL.object_id} then
|
358
|
+
# puts "write to right with sigL=#{sigL.fullname}."
|
359
|
+
Connection.new(cnx.right.clone,cnx.left.clone).init_sim(systemT)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
339
364
|
# Recurse on the sub scopes.
|
340
365
|
self.each_scope { |sco| sco.init_sim(systemT) }
|
341
366
|
end
|
@@ -393,9 +418,21 @@ module HDLRuby::High
|
|
393
418
|
# Keep only one ref per signal.
|
394
419
|
refs.uniq! { |node| node.fullname }
|
395
420
|
# puts "refs=#{refs.map {|node| node.fullname}}"
|
421
|
+
# The get the left references: the will be removed from the
|
422
|
+
# events.
|
423
|
+
left_refs = self.block.each_node_deep.select do |node|
|
424
|
+
node.is_a?(RefObject) && node.leftvalue? &&
|
425
|
+
!node.parent.is_a?(RefObject)
|
426
|
+
end.to_a
|
427
|
+
# Keep only one left ref per signal.
|
428
|
+
left_refs.uniq! { |node| node.fullname }
|
396
429
|
# Remove the inner signals from the list.
|
397
430
|
self.block.each_inner do |inner|
|
398
|
-
refs.delete_if {|r| r.
|
431
|
+
refs.delete_if {|r| r.fullname == inner.fullname }
|
432
|
+
end
|
433
|
+
# Remove the left refs.
|
434
|
+
left_refs.each do |l|
|
435
|
+
refs.delete_if {|r| r.fullname == l.fullname }
|
399
436
|
end
|
400
437
|
# Generate the event.
|
401
438
|
events = refs.map {|ref| Event.new(:anyedge,ref.clone) }
|
@@ -494,6 +531,9 @@ module HDLRuby::High
|
|
494
531
|
|
495
532
|
## Initialize the simulation for +systemT+
|
496
533
|
def init_sim(systemT)
|
534
|
+
# Initialize the local time to -1
|
535
|
+
@time = -1
|
536
|
+
@sim = systemT
|
497
537
|
# Recurse on the sub signals if any.
|
498
538
|
if self.each_signal.any? then
|
499
539
|
self.each_signal {|sig| sig.init_sim(systemT) }
|
@@ -569,12 +609,16 @@ module HDLRuby::High
|
|
569
609
|
|
570
610
|
## Assigns +value+ the the reference.
|
571
611
|
def assign(mode,value)
|
572
|
-
# Set the next value.
|
573
|
-
@f_value = value
|
612
|
+
# # Set the next value.
|
613
|
+
# @f_value = value
|
574
614
|
# Set the mode.
|
575
615
|
@mode = mode
|
576
|
-
#
|
577
|
-
@
|
616
|
+
# @f_value = value.cast(self.type) # Cast not always inserted by HDLRuby normally
|
617
|
+
if @sim.time > @time or !value.impedence? then
|
618
|
+
# puts "assign #{value.content} to #{self.fullname}"
|
619
|
+
@f_value = value.cast(self.type) # Cast not always inserted by HDLRuby normally
|
620
|
+
@time = @sim.time
|
621
|
+
end
|
578
622
|
end
|
579
623
|
|
580
624
|
## Assigns +value+ at +index+ (integer or range).
|
@@ -673,7 +717,7 @@ module HDLRuby::High
|
|
673
717
|
|
674
718
|
## Executes the statement.
|
675
719
|
def execute(mode)
|
676
|
-
# puts "execute Transmit in mode=#{mode} for left=#{self.left.object.
|
720
|
+
# puts "execute Transmit in mode=#{mode} for left=#{self.left.object.fullname}" if left.is_a?(RefObject)
|
677
721
|
self.left.assign(mode,self.right.execute(mode))
|
678
722
|
end
|
679
723
|
end
|
@@ -685,7 +729,11 @@ module HDLRuby::High
|
|
685
729
|
## Initialize the simulation for system +systemT+.
|
686
730
|
def init_sim(systemT)
|
687
731
|
self.yes.init_sim(systemT)
|
688
|
-
self.each_noif { |cond,stmnt| stmnt.init_sim(systemT) }
|
732
|
+
# self.each_noif { |cond,stmnt| stmnt.init_sim(systemT) }
|
733
|
+
self.each_noif do |cond,stmnt|
|
734
|
+
cond.init_sim(systemT)
|
735
|
+
stmnt.init_sim(systemT)
|
736
|
+
end
|
689
737
|
self.no.init_sim(systemT) if self.no
|
690
738
|
end
|
691
739
|
|
@@ -959,8 +1007,9 @@ module HDLRuby::High
|
|
959
1007
|
|
960
1008
|
## Executes the statement.
|
961
1009
|
def execute(mode)
|
962
|
-
# puts "connection left=#{left}
|
963
|
-
self.left.assign(mode,self.right.execute(mode))
|
1010
|
+
# puts "connection left=#{left.object.fullname}"
|
1011
|
+
# self.left.assign(mode,self.right.execute(mode))
|
1012
|
+
self.left.assign(:seq,self.right.execute(mode))
|
964
1013
|
end
|
965
1014
|
end
|
966
1015
|
|
@@ -1,14 +1,13 @@
|
|
1
1
|
require "HDLRuby/hruby_rsim"
|
2
2
|
|
3
3
|
##
|
4
|
-
# Library for enhancing the Ruby simulator with
|
4
|
+
# Library for enhancing the Ruby simulator with muted output support
|
5
5
|
#
|
6
6
|
########################################################################
|
7
7
|
module HDLRuby::High
|
8
8
|
|
9
|
-
##
|
10
|
-
# Enhance the system type class with VCD support.
|
11
9
|
class SystemT
|
10
|
+
# Enhance the system type class with mute support.
|
12
11
|
|
13
12
|
## Initializes the displayer for generating a vcd on +vcdout+
|
14
13
|
def show_init(vcdout)
|