HDLRuby 2.11.11 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/README.html +3274 -0
  3. data/README.md +608 -99
  4. data/ext/hruby_sim/hruby_rcsim_build.c +27 -0
  5. data/ext/hruby_sim/hruby_sim.h +3 -0
  6. data/ext/hruby_sim/hruby_sim_calc.c +2 -0
  7. data/ext/hruby_sim/hruby_sim_core.c +17 -5
  8. data/ext/hruby_sim/hruby_sim_stack_calc.c +1 -1
  9. data/ext/hruby_sim/hruby_sim_tree_calc.c +8 -1
  10. data/ext/hruby_sim/hruby_sim_vcd.c +24 -7
  11. data/ext/hruby_sim/hruby_sim_vizualize.c +9 -1
  12. data/lib/HDLRuby/backend/hruby_allocator.rb +2 -2
  13. data/lib/HDLRuby/backend/hruby_c_allocator.rb +7 -7
  14. data/lib/HDLRuby/hdr_samples/constant_in_function.rb +3 -1
  15. data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +3 -1
  16. data/lib/HDLRuby/hdr_samples/huge_rom.rb +1 -1
  17. data/lib/HDLRuby/hdr_samples/mei8.rb +11 -11
  18. data/lib/HDLRuby/hdr_samples/mei8_bench.rb +12 -12
  19. data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +4 -4
  20. data/lib/HDLRuby/hdr_samples/rom_nest.rb +1 -1
  21. data/lib/HDLRuby/hdr_samples/ruby_fir_hw.rb +4 -4
  22. data/lib/HDLRuby/hdr_samples/struct.rb +44 -10
  23. data/lib/HDLRuby/hdr_samples/with_bram.rb +45 -0
  24. data/lib/HDLRuby/hdr_samples/with_bram_frame_stack.rb +105 -0
  25. data/lib/HDLRuby/hdr_samples/with_bram_stack.rb +69 -0
  26. data/lib/HDLRuby/hdr_samples/with_casts.rb +3 -3
  27. data/lib/HDLRuby/hdr_samples/with_concat.rb +6 -6
  28. data/lib/HDLRuby/hdr_samples/with_connector_memory.rb +2 -2
  29. data/lib/HDLRuby/hdr_samples/with_def.rb +10 -3
  30. data/lib/HDLRuby/hdr_samples/with_define_operator.rb +44 -0
  31. data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +12 -12
  32. data/lib/HDLRuby/hdr_samples/with_init.rb +3 -3
  33. data/lib/HDLRuby/hdr_samples/with_leftright.rb +21 -0
  34. data/lib/HDLRuby/hdr_samples/with_reduce.rb +13 -13
  35. data/lib/HDLRuby/hdr_samples/with_ref_array.rb +6 -6
  36. data/lib/HDLRuby/hdr_samples/with_register_stack.rb +150 -0
  37. data/lib/HDLRuby/hdr_samples/with_sequencer.rb +190 -0
  38. data/lib/HDLRuby/hdr_samples/with_sequencer_deep.rb +91 -0
  39. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +405 -0
  40. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +89 -0
  41. data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +120 -0
  42. data/lib/HDLRuby/hdr_samples/with_subsums.rb +3 -3
  43. data/lib/HDLRuby/hdr_samples/with_terminate.rb +3 -3
  44. data/lib/HDLRuby/hdr_samples/with_to_a.rb +10 -10
  45. data/lib/HDLRuby/hdr_samples/with_values.rb +3 -3
  46. data/lib/HDLRuby/hdrcc.rb +29 -3
  47. data/lib/HDLRuby/hdrlib.rb +1 -1
  48. data/lib/HDLRuby/hruby_bstr.rb +10 -5
  49. data/lib/HDLRuby/hruby_db.rb +2 -2
  50. data/lib/HDLRuby/hruby_high.rb +152 -47
  51. data/lib/HDLRuby/hruby_high_fullname.rb +3 -1
  52. data/lib/HDLRuby/hruby_low.rb +189 -18
  53. data/lib/HDLRuby/hruby_low2c.rb +129 -54
  54. data/lib/HDLRuby/hruby_low2hdr.rb +66 -40
  55. data/lib/HDLRuby/hruby_low2high.rb +86 -44
  56. data/lib/HDLRuby/hruby_low2seq.rb +26 -18
  57. data/lib/HDLRuby/hruby_low2sym.rb +14 -13
  58. data/lib/HDLRuby/hruby_low2vhd.rb +80 -44
  59. data/lib/HDLRuby/hruby_low_bool2select.rb +61 -46
  60. data/lib/HDLRuby/hruby_low_casts_without_expression.rb +56 -44
  61. data/lib/HDLRuby/hruby_low_cleanup.rb +18 -16
  62. data/lib/HDLRuby/hruby_low_fix_types.rb +65 -32
  63. data/lib/HDLRuby/hruby_low_mutable.rb +83 -119
  64. data/lib/HDLRuby/hruby_low_resolve.rb +38 -30
  65. data/lib/HDLRuby/hruby_low_with_bool.rb +33 -16
  66. data/lib/HDLRuby/hruby_low_with_port.rb +3 -3
  67. data/lib/HDLRuby/hruby_low_with_var.rb +23 -9
  68. data/lib/HDLRuby/hruby_low_without_concat.rb +45 -19
  69. data/lib/HDLRuby/hruby_low_without_namespace.rb +47 -32
  70. data/lib/HDLRuby/hruby_low_without_parinseq.rb +32 -16
  71. data/lib/HDLRuby/hruby_low_without_select.rb +37 -24
  72. data/lib/HDLRuby/hruby_low_without_subsignals.rb +280 -0
  73. data/lib/HDLRuby/hruby_rcsim.rb +158 -134
  74. data/lib/HDLRuby/hruby_rsim.rb +194 -20
  75. data/lib/HDLRuby/hruby_rsim_mute.rb +2 -3
  76. data/lib/HDLRuby/hruby_rsim_vcd.rb +125 -50
  77. data/lib/HDLRuby/hruby_values.rb +48 -33
  78. data/lib/HDLRuby/hruby_verilog.rb +90 -48
  79. data/lib/HDLRuby/soft/stacks.rb +219 -0
  80. data/lib/HDLRuby/std/bram.rb +26 -0
  81. data/lib/HDLRuby/std/clocks.rb +1 -1
  82. data/lib/HDLRuby/std/fixpoint.rb +2 -2
  83. data/lib/HDLRuby/std/fsm.rb +48 -11
  84. data/lib/HDLRuby/std/function_generator.rb +2 -2
  85. data/lib/HDLRuby/std/sequencer.rb +1857 -0
  86. data/lib/HDLRuby/std/sequencer_sync.rb +400 -0
  87. data/lib/HDLRuby/std/std.rb +12 -0
  88. data/lib/HDLRuby/version.rb +1 -1
  89. data/tuto/adder_sat_flags_vcd.png +0 -0
  90. data/tuto/addsub_vcd.png +0 -0
  91. data/tuto/alu_vcd.png +0 -0
  92. data/tuto/bit_pong_vcd.png +0 -0
  93. data/tuto/checksum_vcd.png +0 -0
  94. data/tuto/circuit_hdr.odg +0 -0
  95. data/tuto/circuit_hdr.png +0 -0
  96. data/tuto/circuit_hie.odg +0 -0
  97. data/tuto/circuit_hie.png +0 -0
  98. data/tuto/circuit_view.odg +0 -0
  99. data/tuto/circuit_view.png +0 -0
  100. data/tuto/clock_counter_vcd.png +0 -0
  101. data/tuto/counter_ext_vcd.png +0 -0
  102. data/tuto/fact_vcd.png +0 -0
  103. data/tuto/hw_flow.odg +0 -0
  104. data/tuto/hw_flow.png +0 -0
  105. data/tuto/maxxer_vcd.png +0 -0
  106. data/tuto/pingpong0_vcd.png +0 -0
  107. data/tuto/pingpong1_vcd.png +0 -0
  108. data/tuto/pingpong2_vcd.png +0 -0
  109. data/tuto/ram_vcd.png +0 -0
  110. data/tuto/serializer_vcd.png +0 -0
  111. data/tuto/sw_flow.odg +0 -0
  112. data/tuto/sw_flow.png +0 -0
  113. data/tuto/the_counter_vcd.png +0 -0
  114. data/tuto/tutorial_sw.html +2359 -0
  115. data/tuto/tutorial_sw.md +2684 -0
  116. data/tuto/tutorial_sw.pdf +0 -0
  117. data/tuto/tutorial_sw_jp.md +417 -0
  118. metadata +49 -3
  119. data/lib/HDLRuby/hdr_samples/sumprod.rb +0 -29
@@ -165,8 +165,8 @@ module HDLRuby::Low
165
165
  end
166
166
 
167
167
 
168
- ## Extends the SystemT class with generation of C text.
169
168
  class SystemT
169
+ ## Extends the SystemT class with generation of C text.
170
170
 
171
171
  # Generates the text of the equivalent HDLRuby code.
172
172
  # +level+ is the hierachical level of the object and +hnames+
@@ -402,8 +402,8 @@ module HDLRuby::Low
402
402
  end
403
403
 
404
404
 
405
- ## Extends the Scope class with generation of C text.
406
405
  class Scope
406
+ ## Extends the Scope class with generation of C text.
407
407
 
408
408
  # Generates the C text of the equivalent HDLRuby code.
409
409
  # +level+ is the hierachical level of the object.
@@ -567,8 +567,8 @@ module HDLRuby::Low
567
567
  end
568
568
 
569
569
 
570
- ## Extends the Type class with generation of C text.
571
570
  class Type
571
+ ## Extends the Type class with generation of C text.
572
572
 
573
573
  # Generates the C text of the equivalent HDLRuby code.
574
574
  # +level+ is the hierachical level of the object.
@@ -587,8 +587,9 @@ module HDLRuby::Low
587
587
  end
588
588
  end
589
589
 
590
- ## Extends the TypeDef class with generation of C text.
590
+
591
591
  class TypeDef
592
+ ## Extends the TypeDef class with generation of C text.
592
593
 
593
594
  # Generates the C text of the equivalent HDLRuby code.
594
595
  # +level+ is the hierachical level of the object.
@@ -601,8 +602,9 @@ module HDLRuby::Low
601
602
  end
602
603
  end
603
604
 
604
- ## Extends the TypeVector class with generation of C text.
605
+
605
606
  class TypeVector
607
+ ## Extends the TypeVector class with generation of C text.
606
608
 
607
609
  # Generates the C text of the equivalent HDLRuby code.
608
610
  # +level+ is the hierachical level of the object.
@@ -618,8 +620,9 @@ module HDLRuby::Low
618
620
  end
619
621
  end
620
622
 
621
- ## Extends the TypeTuple class with generation of C text.
623
+
622
624
  class TypeTuple
625
+ ## Extends the TypeTuple class with generation of C text.
623
626
 
624
627
  # Generates the C text of the equivalent HDLRuby code.
625
628
  # +level+ is the hierachical level of the object.
@@ -634,26 +637,24 @@ module HDLRuby::Low
634
637
  end
635
638
 
636
639
 
637
- ## Extends the TypeStruct class with generation of C text.
638
640
  class TypeStruct
641
+ ## Extends the TypeStruct class with generation of C text.
639
642
 
640
643
  # Generates the text of the equivalent HDLRuby code.
641
644
  # +level+ is the hierachical level of the object.
642
645
  # def to_c(level = 0)
643
646
  def to_c(res,level = 0)
644
- # return "get_type_struct(#{self.each.join(",") do |key,type|
645
- # "\"#{key.to_s}\",#{type.to_c(level+1)}"
646
- # end})"
647
- res << "get_type_struct(#{self.each.join(",") do |key,type|
648
- "\"#{key.to_s}\",#{type.to_c("",level+1)}"
649
- end})"
647
+ # res << "get_type_struct(#{self.each.map do |key,type|
648
+ # "\"#{key.to_s}\",#{type.to_c("",level+1)}"
649
+ # end.join(",")})"
650
+ self.to_vector.to_c(res,level)
650
651
  return res
651
652
  end
652
653
  end
653
654
 
654
655
 
655
- ## Extends the Behavior class with generation of C text.
656
656
  class Behavior
657
+ ## Extends the Behavior class with generation of C text.
657
658
 
658
659
  # Generates the text of the equivalent HDLRuby code.
659
660
  # +level+ is the hierachical level of the object and
@@ -839,8 +840,9 @@ module HDLRuby::Low
839
840
  end
840
841
  end
841
842
 
842
- ## Extends the TimeBehavior class with generation of C text.
843
+
843
844
  class TimeBehavior
845
+ ## Extends the TimeBehavior class with generation of C text.
844
846
 
845
847
  # Generates the C text of the equivalent HDLRuby code.
846
848
  # +level+ is the hierachical level of the object.
@@ -852,8 +854,8 @@ module HDLRuby::Low
852
854
  end
853
855
 
854
856
 
855
- ## Extends the Event class with generation of C text.
856
857
  class Event
858
+ ## Extends the Event class with generation of C text.
857
859
 
858
860
  # Generates the C text of the equivalent HDLRuby code.
859
861
  # +level+ is the hierachical level of the object.
@@ -872,8 +874,8 @@ module HDLRuby::Low
872
874
  end
873
875
 
874
876
 
875
- ## Extends the SignalI class with generation of C text.
876
877
  class SignalI
878
+ ## Extends the SignalI class with generation of C text.
877
879
 
878
880
  # The id of a signal in the simulator.
879
881
  @@signal_id = 0
@@ -897,8 +899,17 @@ module HDLRuby::Low
897
899
  # +level+ is the hierachical level of the object.
898
900
  # def to_c(level = 0)
899
901
  def to_c(res,level = 0)
902
+ # First generate the sub signals if any.
903
+ if self.each_signal.any? then
904
+ self.each_signal do |signal|
905
+ signal.to_c(res,level)
906
+ end
907
+ # return res
908
+ end
900
909
 
901
- # puts "Signal.to_c with name: #{Low2C.obj_name(self)}"
910
+ # No sub signals, generate for the current one.
911
+
912
+ # puts "Signal.to_c with signal #{self.name} and c_name: #{Low2C.obj_name(self)}"
902
913
  # Declare the global variable holding the signal.
903
914
  res << "SignalI "
904
915
  self.to_c_signal(res,level+1)
@@ -943,6 +954,22 @@ module HDLRuby::Low
943
954
  res << "signalI->type = "
944
955
  self.type.to_c(res,level+2)
945
956
  res << ";\n"
957
+
958
+ # Generate and set the sub signals if any.
959
+ res << " " * (level+1)*3
960
+ num_sig = self.each_signal.to_a.size
961
+ res << "signalI->num_signals = #{num_sig};\n"
962
+ if num_sig > 0 then
963
+ res << " " * (level+1)*3
964
+ res << "signalI->signals = calloc(sizeof(SignalI),#{num_sig});\n"
965
+ self.each_signal.with_index do |sig,i|
966
+ res << " " * (level+1)*3
967
+ res << "#{Low2C.obj_name(sig)} = #{Low2C.make_name(sig)}();\n"
968
+ res << " " * (level+1)*3
969
+ res << "signalI->signals[#{i}] = #{Low2C.obj_name(sig)};\n"
970
+ end
971
+ end
972
+
946
973
  # Set the current and the next value.
947
974
  res << " " * (level+1)*3
948
975
  res << "signalI->c_value = make_value(signalI->type,0);\n"
@@ -1000,6 +1027,15 @@ module HDLRuby::Low
1000
1027
  ## Generates the content of the h file.
1001
1028
  # def to_ch
1002
1029
  def to_ch(res)
1030
+ # First generate the sub signals if any.
1031
+ if self.each_signal.any? then
1032
+ self.each_signal do |signal|
1033
+ signal.to_ch(res)
1034
+ end
1035
+ # return res
1036
+ end
1037
+
1038
+ # No sub sub signal, generate for the current signal.
1003
1039
  # res = ""
1004
1040
  # puts "to_ch for SignalI: #{self.to_c_signal()}"
1005
1041
  # Declare the global variable holding the signal.
@@ -1053,8 +1089,8 @@ module HDLRuby::Low
1053
1089
  end
1054
1090
 
1055
1091
 
1056
- ## Extends the SystemI class with generation of C text.
1057
1092
  class SystemI
1093
+ ## Extends the SystemI class with generation of C text.
1058
1094
 
1059
1095
  ## Generates the C text of the equivalent HDLRuby code.
1060
1096
  # +level+ is the hierachical level of the object.
@@ -1134,8 +1170,8 @@ module HDLRuby::Low
1134
1170
  end
1135
1171
 
1136
1172
 
1137
- # Extend the Chunk cass with generation of text code.
1138
1173
  class HDLRuby::Low::Chunk
1174
+ # Extend the Chunk cass with generation of text code.
1139
1175
 
1140
1176
  # Generates the C text of the equivalent HDLRuby code.
1141
1177
  # +level+ is the hierachical level of the object.
@@ -1166,8 +1202,9 @@ module HDLRuby::Low
1166
1202
  end
1167
1203
 
1168
1204
 
1169
- ## Extends the SystemI class with generation of C text.
1170
1205
  class Code
1206
+ ## Extends the SystemI class with generation of C text.
1207
+
1171
1208
  # Generates the C text of the equivalent HDLRuby code.
1172
1209
  # +level+ is the hierachical level of the object.
1173
1210
  # def to_c(level = 0)
@@ -1288,8 +1325,8 @@ module HDLRuby::Low
1288
1325
  end
1289
1326
 
1290
1327
 
1291
- ## Extends the Statement class with generation of C text.
1292
1328
  class Statement
1329
+ ## Extends the Statement class with generation of C text.
1293
1330
 
1294
1331
  # Generates the C text of the equivalent HDLRuby code.
1295
1332
  # +level+ is the hierachical level of the object.
@@ -1330,8 +1367,8 @@ module HDLRuby::Low
1330
1367
  end
1331
1368
  end
1332
1369
 
1333
- ## Extends the Transmit class with generation of C text.
1334
1370
  class Transmit
1371
+ ## Extends the Transmit class with generation of C text.
1335
1372
 
1336
1373
  # # Generates the C text of the equivalent HDLRuby code.
1337
1374
  # # +level+ is the hierachical level of the object.
@@ -1432,8 +1469,8 @@ module HDLRuby::Low
1432
1469
  end
1433
1470
 
1434
1471
 
1435
- ## Extends the Print class with generation of C text.
1436
1472
  class Print
1473
+ ## Extends the Print class with generation of C text.
1437
1474
 
1438
1475
  # # Generates the C text of the equivalent HDLRuby code.
1439
1476
  # # +level+ is the hierachical level of the object.
@@ -1501,8 +1538,9 @@ module HDLRuby::Low
1501
1538
  end
1502
1539
  end
1503
1540
 
1504
- ## Extends the TimeTerminate class with generation of C text.
1541
+
1505
1542
  class TimeTerminate
1543
+ ## Extends the TimeTerminate class with generation of C text.
1506
1544
 
1507
1545
  # Generates the C text of the equivalent HDLRuby code.
1508
1546
  # +level+ is the hierachical level of the object.
@@ -1512,8 +1550,9 @@ module HDLRuby::Low
1512
1550
  end
1513
1551
  end
1514
1552
 
1515
- ## Extends the Configure class with generation of C text.
1553
+
1516
1554
  class Configure
1555
+ ## Extends the Configure class with generation of C text.
1517
1556
 
1518
1557
  # Generates the C text of the equivalent HDLRuby code.
1519
1558
  # +level+ is the hierachical level of the object.
@@ -1524,8 +1563,8 @@ module HDLRuby::Low
1524
1563
  end
1525
1564
 
1526
1565
 
1527
- ## Extends the If class with generation of C text.
1528
1566
  class If
1567
+ ## Extends the If class with generation of C text.
1529
1568
 
1530
1569
  # # Generates the C text of the equivalent HDLRuby code.
1531
1570
  # # +level+ is the hierachical level of the object.
@@ -1645,8 +1684,8 @@ module HDLRuby::Low
1645
1684
  end
1646
1685
  end
1647
1686
 
1648
- ## Extends the When class with generation of C text.
1649
1687
  class When
1688
+ ## Extends the When class with generation of C text.
1650
1689
 
1651
1690
  # Generates the C text of the equivalent HDLRuby code.
1652
1691
  # +level+ is the hierachical level of the object.
@@ -1689,8 +1728,9 @@ module HDLRuby::Low
1689
1728
  end
1690
1729
  end
1691
1730
 
1692
- ## Extends the Case class with generation of C text.
1731
+
1693
1732
  class Case
1733
+ ## Extends the Case class with generation of C text.
1694
1734
 
1695
1735
  # # Generates the text of the equivalent HDLRuby code.
1696
1736
  # # +level+ is the hierachical level of the object.
@@ -1823,8 +1863,8 @@ module HDLRuby::Low
1823
1863
  end
1824
1864
 
1825
1865
 
1826
- ## Extends the Delay class with generation of C text.
1827
1866
  class Delay
1867
+ ## Extends the Delay class with generation of C text.
1828
1868
 
1829
1869
  # Generates the C text of the equivalent HDLRuby code.
1830
1870
  # +level+ is the hierachical level of the object.
@@ -1839,8 +1879,8 @@ module HDLRuby::Low
1839
1879
  end
1840
1880
 
1841
1881
 
1842
- ## Extends the TimeWait class with generation of C text.
1843
1882
  class TimeWait
1883
+ ## Extends the TimeWait class with generation of C text.
1844
1884
 
1845
1885
  # Generates the C text of the equivalent HDLRuby code.
1846
1886
  # +level+ is the hierachical level of the object.
@@ -1860,8 +1900,9 @@ module HDLRuby::Low
1860
1900
  end
1861
1901
  end
1862
1902
 
1863
- ## Extends the TimeRepeat class with generation of C text.
1903
+
1864
1904
  class TimeRepeat
1905
+ ## Extends the TimeRepeat class with generation of C text.
1865
1906
 
1866
1907
  # # Generates the C text of the equivalent HDLRuby code.
1867
1908
  # # +level+ is the hierachical level of the object.
@@ -1901,8 +1942,9 @@ module HDLRuby::Low
1901
1942
  end
1902
1943
  end
1903
1944
 
1904
- ## Extends the Block class with generation of C text.
1945
+
1905
1946
  class Block
1947
+ ## Extends the Block class with generation of C text.
1906
1948
 
1907
1949
  # Adds the c code of the blocks to +res+ at +level+
1908
1950
  def add_blocks_code(res,level)
@@ -2054,20 +2096,22 @@ module HDLRuby::Low
2054
2096
  end
2055
2097
 
2056
2098
 
2057
- ## Extends the Block class with generation of C text.
2058
2099
  class TimeBlock
2100
+ ## Extends the Block class with generation of C text.
2101
+
2059
2102
  # TimeBlock is identical to Block in C
2060
2103
  end
2061
2104
 
2062
2105
 
2063
- ## Extends the Connection class with generation of C text.
2064
2106
  class Connection
2107
+ ## Extends the Connection class with generation of C text.
2108
+
2065
2109
  # Nothing required, Transmit is generated identically.
2066
2110
  end
2067
2111
 
2068
2112
 
2069
- ## Extends the Expression class with generation of C text.
2070
2113
  class Expression
2114
+ ## Extends the Expression class with generation of C text.
2071
2115
 
2072
2116
  # Generates the C text of the equivalent HDLRuby code.
2073
2117
  # +level+ is the hierachical level of the object.
@@ -2089,8 +2133,8 @@ module HDLRuby::Low
2089
2133
  end
2090
2134
 
2091
2135
 
2092
- ## Extends the Value class with generation of C text.
2093
2136
  class Value
2137
+ ## Extends the Value class with generation of C text.
2094
2138
 
2095
2139
  ## Generates the C text for an access to the value.
2096
2140
  # +level+ is the hierachical level of the object.
@@ -2205,7 +2249,7 @@ module HDLRuby::Low
2205
2249
  res << "value->data_int = #{self.content}LLU;\n"
2206
2250
  else
2207
2251
  res << "value->data_int = "
2208
- res << "#{self.content & 0xFFFFFFFFFFFF}LLU;\n"
2252
+ res << "#{self.content & 0xFFFF_FFFF_FFFF_FFFF}LLU;\n"
2209
2253
  end
2210
2254
  # Close the value.
2211
2255
  res << " " * (level+1)*3
@@ -2258,8 +2302,8 @@ module HDLRuby::Low
2258
2302
  end
2259
2303
 
2260
2304
 
2261
- ## Extends the Cast class with generation of C text.
2262
2305
  class Cast
2306
+ ## Extends the Cast class with generation of C text.
2263
2307
 
2264
2308
  # # Generates the C text of the equivalent HDLRuby code.
2265
2309
  # # +level+ is the hierachical level of the object.
@@ -2314,8 +2358,8 @@ module HDLRuby::Low
2314
2358
  end
2315
2359
 
2316
2360
 
2317
- ## Extends the Operation class with generation of C text.
2318
2361
  class Operation
2362
+ ## Extends the Operation class with generation of C text.
2319
2363
 
2320
2364
  # Generates the C text of the equivalent HDLRuby code.
2321
2365
  # +level+ is the hierachical level of the object.
@@ -2326,8 +2370,9 @@ module HDLRuby::Low
2326
2370
  end
2327
2371
  end
2328
2372
 
2329
- ## Extends the Unary class with generation of C text.
2373
+
2330
2374
  class Unary
2375
+ ## Extends the Unary class with generation of C text.
2331
2376
 
2332
2377
  # # Generates the C text of the equivalent HDLRuby code.
2333
2378
  # # +level+ is the hierachical level of the object.
@@ -2410,8 +2455,8 @@ module HDLRuby::Low
2410
2455
  end
2411
2456
 
2412
2457
 
2413
- ## Extends the Binary class with generation of C text.
2414
2458
  class Binary
2459
+ ## Extends the Binary class with generation of C text.
2415
2460
 
2416
2461
  # # Generates the C text of the equivalent HDLRuby code.
2417
2462
  # # +level+ is the hierachical level of the object.
@@ -2559,8 +2604,9 @@ module HDLRuby::Low
2559
2604
  end
2560
2605
  end
2561
2606
 
2562
- ## Extends the Select class with generation of C text.
2607
+
2563
2608
  class Select
2609
+ ## Extends the Select class with generation of C text.
2564
2610
 
2565
2611
  # # Generates the C text of the equivalent HDLRuby code.
2566
2612
  # # +level+ is the hierachical level of the object.
@@ -2637,9 +2683,9 @@ module HDLRuby::Low
2637
2683
  end
2638
2684
  end
2639
2685
 
2640
- ## Extends the Concat class with generation of C text.
2641
- class Concat
2642
2686
 
2687
+ class Concat
2688
+ ## Extends the Concat class with generation of C text.
2643
2689
 
2644
2690
  # # Generates the C text for the equivalent HDLRuby code.
2645
2691
  # # +level+ is the hierachical level of the object.
@@ -2697,7 +2743,7 @@ module HDLRuby::Low
2697
2743
  end
2698
2744
  # Compute the resulting concatenation.
2699
2745
  res << (" " * ((level+1)*3))
2700
- # puts "self.type.direction=#{self.type.direction}\n"
2746
+ # puts "self.type=#{self.type} self.type.direction=#{self.type.direction}\n"
2701
2747
  res << "sconcat(#{expressions.size},"
2702
2748
  res << (self.type.direction == :little ? "1" : "0")
2703
2749
  res << ");\n"
@@ -2768,8 +2814,8 @@ module HDLRuby::Low
2768
2814
 
2769
2815
 
2770
2816
 
2771
- ## Extends the Ref class with generation of C text.
2772
2817
  class Ref
2818
+ ## Extends the Ref class with generation of C text.
2773
2819
 
2774
2820
  # Generates the C text of the equivalent HDLRuby code.
2775
2821
  # +level+ is the hierachical level of the object and
@@ -2782,8 +2828,8 @@ module HDLRuby::Low
2782
2828
  end
2783
2829
 
2784
2830
 
2785
- ## Extends the RefConcat class with generation of C text.
2786
2831
  class RefConcat
2832
+ ## Extends the RefConcat class with generation of C text.
2787
2833
 
2788
2834
  # Generates the C text of the equivalent HDLRuby code.
2789
2835
  # +level+ is the hierachical level of the object and
@@ -2816,8 +2862,8 @@ module HDLRuby::Low
2816
2862
  end
2817
2863
 
2818
2864
 
2819
- ## Extends the RefIndex class with generation of C text.
2820
2865
  class RefIndex
2866
+ ## Extends the RefIndex class with generation of C text.
2821
2867
 
2822
2868
  # # Generates the C text of the equivalent HDLRuby code.
2823
2869
  # # +level+ is thehierachical level of the object and
@@ -2926,8 +2972,8 @@ module HDLRuby::Low
2926
2972
  end
2927
2973
 
2928
2974
 
2929
- ## Extends the RefRange class with generation of C text.
2930
2975
  class RefRange
2976
+ ## Extends the RefRange class with generation of C text.
2931
2977
 
2932
2978
  # # Generates the C text of the equivalent HDLRuby code.
2933
2979
  # # +level+ is the hierachical level of the object and
@@ -3039,8 +3085,8 @@ module HDLRuby::Low
3039
3085
  end
3040
3086
 
3041
3087
 
3042
- ## Extends the RefName class with generation of C text.
3043
3088
  class RefName
3089
+ ## Extends the RefName class with generation of C text.
3044
3090
 
3045
3091
  # Generates the C text of the equivalent HDLRuby code.
3046
3092
  # +level+ is the hierachical level of the object and
@@ -3054,22 +3100,51 @@ module HDLRuby::Low
3054
3100
  res << "->" << (left ? "f_value" : "c_value")
3055
3101
  res << ");\n"
3056
3102
  return res
3103
+ # sig = self.resolve
3104
+ # if sig.each_signal.any? then
3105
+ # # Save the value pool state.
3106
+ # res << (" " * (level*3)) << "PV;\n"
3107
+ # # There are sub signals, get and concat their values.
3108
+ # subs = sig.each_signal.to_a
3109
+ # subs.each do |sub|
3110
+ # res << (" " * (level*3))
3111
+ # res << "push("
3112
+ # sub.to_c_signal(res,level+1)
3113
+ # res << "->" << (left ? "f_value" : "c_value")
3114
+ # res << ");\n"
3115
+ # end
3116
+ # # Compute the resulting concatenation.
3117
+ # res << (" " * ((level+1)*3))
3118
+ # res << "sconcat(#{subs.size},"
3119
+ # res << (sig.type.direction == :little ? "1" : "0")
3120
+ # res << ");\n"
3121
+ # # Restore the value pool state.
3122
+ # res << (" " * (level*3)) << "RV;\n"
3123
+ # else
3124
+ # # There is no sub signals, get the signal value.
3125
+ # res << (" " * (level*3))
3126
+ # res << "push("
3127
+ # sig.to_c_signal(res,level+1)
3128
+ # res << "->" << (left ? "f_value" : "c_value")
3129
+ # res << ");\n"
3130
+ # end
3131
+ # return res
3057
3132
  end
3058
3133
 
3059
3134
  # Generates the C text for reference as left value to a signal.
3060
3135
  # +level+ is the hierarchical level of the object.
3061
3136
  # def to_c_signal(level = 0)
3062
3137
  def to_c_signal(res,level = 0)
3063
- # puts "to_c_signal with self=#{self.name}, resolve=#{self.resolve}"
3064
- # return "#{self.resolve.to_c_signal(level+1)}"
3138
+ # puts "to_c_signal with self=#{self.name}"
3065
3139
  self.resolve.to_c_signal(res,level+1)
3066
3140
  return res
3067
3141
  end
3068
3142
  end
3069
3143
 
3070
3144
 
3071
- ## Extends the RefThis class with generation of C text.
3072
3145
  class RefThis
3146
+ ## Extends the RefThis class with generation of C text.
3147
+
3073
3148
  # Generates the C text of the equivalent HDLRuby code.
3074
3149
  # +level+ is the hierachical level of the object and
3075
3150
  # +left+ tells if it is a left value or not.