HDLRuby 2.6.4 → 2.6.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af0232d02d732388bb78569f40cf262167aeb9a5dc51b3b7ea98cf58a39da918
4
- data.tar.gz: 5f46a159e7c3e0bf4414de3cda6bc78e5ac57060d958f0760a52012e18bc551e
3
+ metadata.gz: 639411f380dad2eb07b933ae8d23f558dc32e488ceadf1af897026b353a4164b
4
+ data.tar.gz: 8fb94917c40db1b73a63d323efdc04bbb1e5ebcb65460ebe42c0c468a75ac221
5
5
  SHA512:
6
- metadata.gz: 69176b251e8c1a226e08ad1c45d3d57176c58424e849094ee07cbb3591a5743daf146a332076691ebbab9e100adb7d6a7a23104a1657bb684b79598f6df3ee03
7
- data.tar.gz: 7f99f1f0551682713ecb20b9a0e93c85b6f7244c6ad6b0c3aa7e587b915be400ce914cedbb2f17a890a1e813db79c5d50b7117746c0d405386788d78d09c22db
6
+ metadata.gz: 0d00decbd699cc46f450c913b98e5d881fc10e3a9d171126bc3744ad8d05408536b38bc90d1d15227da67302570a425eb2ceccef7d65959e19f591a35aa1f00c
7
+ data.tar.gz: 9a2f9568732a851786fdfcd794ab146efa4ea36458163a11fe6c992c59bd53f643cd4691804f68e3438f8ce233996af7dd0d8ba205834596bf2b8c7d442ca69d
@@ -0,0 +1,40 @@
1
+ # Test the comparison operators.
2
+
3
+ # A benchmark for the adder.
4
+ system :adder_bench do
5
+ [8].inner :x, :y
6
+ signed[8].inner :u,:v
7
+ inner :ue, :ult, :ule, :ugt, :uge
8
+ inner :se, :slt, :sle, :sgt, :sge
9
+
10
+ par do
11
+ ue <= (x == y)
12
+ ult <= (x < y)
13
+ ule <= (x <= y)
14
+ ugt <= (x > y)
15
+ uge <= (x >= y)
16
+
17
+ se <= (u == v)
18
+ slt <= (u < v)
19
+ sle <= (u <= v)
20
+ sgt <= (u > v)
21
+ sge <= (u >= v)
22
+ end
23
+
24
+ timed do
25
+ x <= 0
26
+ y <= 0
27
+ u <= 0
28
+ v <= 0
29
+ !10.ns
30
+ x <= 1
31
+ u <= 1
32
+ !10.ns
33
+ y <= 2
34
+ v <= 2
35
+ !10.ns
36
+ x <= 2
37
+ u <= -2
38
+ !10.ns
39
+ end
40
+ end
@@ -2,6 +2,7 @@
2
2
  # A benchmark for testing the arithmetic with signed values.
3
3
  system :neg_arith_bench do
4
4
  signed[11..0].inner :x,:y,:z
5
+ inner :cmp
5
6
 
6
7
  timed do
7
8
  x <= 10
@@ -9,41 +10,51 @@ system :neg_arith_bench do
9
10
  z <= 0
10
11
  !10.ns
11
12
  z <= 10 * 10
13
+ cmp <= (10 < 10)
12
14
  !10.ns
13
15
  z <= x * y
16
+ cmp <= (x < y)
14
17
  !10.ns
15
18
  x <= 10
16
19
  y <= -10
17
20
  !10.ns
18
21
  z <= 10 * (-10)
22
+ cmp <= (10 < -10)
19
23
  !10.ns
20
24
  z <= x * y
25
+ cmp <= (x < y)
21
26
  !10.ns
22
27
  x <= -10
23
28
  y <= 10
24
29
  !10.ns
25
30
  z <= (-10) * 10
31
+ cmp <= (-10 < 10)
26
32
  !10.ns
27
33
  z <= x * y
34
+ cmp <= (x < y)
28
35
  !10.ns
29
36
  x <= -10
30
37
  y <= -10
31
38
  !10.ns
32
39
  z <= (-10) * (-10)
40
+ cmp <= (-10 < -10)
33
41
  !10.ns
34
42
  z <= x * y
43
+ cmp <= (x < y)
35
44
  !10.ns
36
45
  x <= _000000011010
37
46
  y <= _000011111010
38
47
  z <= 0
39
48
  !10.ns
40
49
  z <= x * y
50
+ cmp <= (x < y)
41
51
  !10.ns
42
52
  x <= _000000011010
43
53
  y <= _111111111010
44
54
  z <= 0
45
55
  !10.ns
46
56
  z <= x * y
57
+ cmp <= (x < y)
47
58
  !10.ns
48
59
  end
49
60
  end
@@ -0,0 +1,37 @@
1
+ # Test the type method min and max
2
+
3
+ # A benchmark for the adder.
4
+ system :adder_bench do
5
+ [32].inner :x
6
+ signed[32].inner :y
7
+
8
+ timed do
9
+ x <= 0
10
+ y <= 0
11
+ !10.ns
12
+ x <= bit[8].max
13
+ y <= signed[8].max
14
+ !10.ns
15
+ x <= bit[8].min
16
+ y <= signed[8].min
17
+ !10.ns
18
+ x <= bit[10].max
19
+ y <= signed[10].max
20
+ !10.ns
21
+ x <= bit[10].min
22
+ y <= signed[10].min
23
+ !10.ns
24
+ x <= bit[16].max
25
+ y <= signed[16].max
26
+ !10.ns
27
+ x <= bit[16].min
28
+ y <= signed[16].min
29
+ !10.ns
30
+ x <= bit[32].max
31
+ y <= signed[32].max
32
+ !10.ns
33
+ x <= bit[32].min
34
+ y <= signed[32].min
35
+ !10.ns
36
+ end
37
+ end
@@ -0,0 +1,29 @@
1
+
2
+ def connect8(i0,i1,i2,i3,i4,i5,i6,i7,
3
+ o0,o1,o2,o3,o4,o5,o6,o7)
4
+ o0 <= i0
5
+ o1 <= i1
6
+ o2 <= i2
7
+ o3 <= i3
8
+ o4 <= i4
9
+ o5 <= i5
10
+ o6 <= i6
11
+ o7 <= i7
12
+ end
13
+
14
+ # A benchmark for testing the conversion to ruby array of expressions.
15
+ system :with_to_bench do
16
+ [8].inner :val
17
+ inner :b0,:b1,:b2,:b3,:b4,:b5,:b6,:b7
18
+
19
+ connect8(*val,b0,b1,b2,b3,b4,b5,b6,b7)
20
+
21
+ timed do
22
+ val <= _01101010
23
+ !10.ns
24
+ val <= _01011010
25
+ !10.ns
26
+ val <= _00001111
27
+ !10.ns
28
+ end
29
+ end
data/lib/HDLRuby/hdrcc.rb CHANGED
@@ -491,24 +491,28 @@ end
491
491
 
492
492
  # Generate the result.
493
493
  # Get the top systemT.
494
+ puts Time.now
494
495
  $top_system = $top_instance.to_low.systemT
495
-
496
-
497
- # Apply the pre drivers if any.
498
- Hdecorator.each_with_property(:pre_driver) do |obj, value|
499
- unless value.is_a?(Array) && value.size == 2 then
500
- raise "pre_driver requires a driver file name command name."
501
- end
502
- # Load the driver.
503
- require_relative(value[0].to_s)
504
- # Ensure obj is the low version.
505
- if obj.properties.key?(:high2low) then
506
- # obj is high, get the corresponding low.
507
- obj = obj.properties[:high2low][0]
508
- end
509
- # Execute it.
510
- send(value[1].to_sym,obj,*value[2..-1])
511
- end
496
+ $top_intance = nil # Free as much memory as possible.
497
+ puts "##### Top system built #####"
498
+ puts Time.now
499
+
500
+
501
+ # # Apply the pre drivers if any.
502
+ # Hdecorator.each_with_property(:pre_driver) do |obj, value|
503
+ # unless value.is_a?(Array) && value.size == 2 then
504
+ # raise "pre_driver requires a driver file name command name."
505
+ # end
506
+ # # Load the driver.
507
+ # require_relative(value[0].to_s)
508
+ # # Ensure obj is the low version.
509
+ # if obj.properties.key?(:high2low) then
510
+ # # obj is high, get the corresponding low.
511
+ # obj = obj.properties[:high2low][0]
512
+ # end
513
+ # # Execute it.
514
+ # send(value[1].to_sym,obj,*value[2..-1])
515
+ # end
512
516
 
513
517
 
514
518
  # Gather the non-HDLRuby code.
@@ -558,15 +562,23 @@ elsif $options[:clang] then
558
562
  # top_system = $top_system
559
563
  # Preprocess the HW description for valid C generation.
560
564
  $top_system.each_systemT_deep do |systemT|
565
+ puts "seq2seq step..."
561
566
  # Coverts the par blocks in seq blocks to seq blocks to match
562
567
  # the simulation engine.
563
568
  systemT.par_in_seq2seq!
569
+ puts Time.now
570
+ puts "connections_to_behaviors step..."
564
571
  # Converts the connections to behaviors.
565
572
  systemT.connections_to_behaviors!
573
+ puts Time.now
566
574
  # Break the RefConcat.
575
+ puts "concat_assigns step..."
567
576
  systemT.break_concat_assigns!
577
+ puts Time.now
568
578
  # Explicits the types.
579
+ puts "explicit_types step..."
569
580
  systemT.explicit_types!
581
+ puts Time.now
570
582
  end
571
583
  # Generate the C.
572
584
  if $options[:multiple] then
@@ -637,6 +649,7 @@ elsif $options[:clang] then
637
649
  name = $output + "/" +
638
650
  HDLRuby::Low::Low2C.c_name(systemT.name) +
639
651
  ".c"
652
+ # puts "for systemT=#{systemT.name} generating: #{name}"
640
653
  # Open the file for current systemT
641
654
  outfile = File.open(name,"w")
642
655
  # Generate the C code in to.
@@ -690,14 +703,26 @@ elsif $options[:verilog] then
690
703
  # top_system = $top_system
691
704
  # Make description compatible with verilog generation.
692
705
  $top_system.each_systemT_deep do |systemT|
706
+ puts "casts_without_expression! step..."
693
707
  systemT.casts_without_expression!
708
+ puts Time.now
709
+ puts "to_upper_space! step..."
694
710
  systemT.to_upper_space!
711
+ puts Time.now
712
+ puts "to_global_space! step..."
695
713
  systemT.to_global_systemTs!
714
+ puts Time.now
696
715
  # systemT.break_types!
697
716
  # systemT.expand_types!
717
+ puts "par_in_seq2seq! step..."
698
718
  systemT.par_in_seq2seq!
719
+ puts Time.now
720
+ puts "initial_concat_to_timed! step..."
699
721
  systemT.initial_concat_to_timed!
722
+ puts Time.now
723
+ puts "with_port! step..."
700
724
  systemT.with_port!
725
+ puts Time.now
701
726
  end
702
727
  # # Verilog generation
703
728
  # $output << top_system.to_verilog
@@ -787,13 +812,13 @@ elsif $options[:vhdl] then
787
812
  end
788
813
  end
789
814
 
790
- # Apply the post drivers if any.
791
- Hdecorator.each_with_property(:post_driver) do |obj, value|
792
- # Load the driver.
793
- require_relative(value[0].to_s)
794
- # Execute it.
795
- send(value[1].to_sym,obj,$output)
796
- end
815
+ # # Apply the post drivers if any.
816
+ # Hdecorator.each_with_property(:post_driver) do |obj, value|
817
+ # # Load the driver.
818
+ # require_relative(value[0].to_s)
819
+ # # Execute it.
820
+ # send(value[1].to_sym,obj,$output)
821
+ # end
797
822
 
798
823
  # Dump the properties
799
824
  if $options[:dump] then
@@ -609,7 +609,8 @@ module HDLRuby::High
609
609
  # possible arguments +args+.
610
610
  def instantiate(i_name,*args)
611
611
  # Create the eigen type.
612
- eigen = self.expand(High.names_create(i_name.to_s + ":T"), *args)
612
+ # eigen = self.expand(High.names_create(i_name.to_s + ":T"), *args)
613
+ eigen = self.expand(HDLRuby.uniq_name(i_name.to_s + ":T"), *args)
613
614
 
614
615
  # Create the instance and sets its eigen system to +eigen+.
615
616
  instance = @instance_class.new(i_name,eigen)
@@ -758,11 +759,13 @@ module HDLRuby::High
758
759
  "Cannot convert a system without a name to HDLRuby::Low."
759
760
  end
760
761
  # Create the resulting low system type.
761
- systemTL = HDLRuby::Low::SystemT.new(High.names_create(name),
762
+ # systemTL = HDLRuby::Low::SystemT.new(High.names_create(name),
763
+ systemTL = HDLRuby::Low::SystemT.new(HDLRuby.uniq_name(name),
762
764
  self.scope.to_low)
763
- # For debugging: set the source high object
764
- systemTL.properties[:low2high] = self.hdr_id
765
- self.properties[:high2low] = systemTL
765
+ # puts "New low from system #{self.name}: #{systemTL.name}"
766
+ # # For debugging: set the source high object
767
+ # systemTL.properties[:low2high] = self.hdr_id
768
+ # self.properties[:high2low] = systemTL
766
769
 
767
770
  # Fills the interface of the new system
768
771
  # from the included systems.
@@ -1308,9 +1311,9 @@ module HDLRuby::High
1308
1311
  # Create the resulting low scope.
1309
1312
  # scopeL = HDLRuby::Low::Scope.new()
1310
1313
  scopeL = HDLRuby::Low::Scope.new(self.name)
1311
- # For debugging: set the source high object
1312
- scopeL.properties[:low2high] = self.hdr_id
1313
- self.properties[:high2low] = scopeL
1314
+ # # For debugging: set the source high object
1315
+ # scopeL.properties[:low2high] = self.hdr_id
1316
+ # self.properties[:high2low] = scopeL
1314
1317
 
1315
1318
  # Push the private namespace for the low generation.
1316
1319
  High.space_push(@namespace)
@@ -1542,9 +1545,9 @@ module HDLRuby::High
1542
1545
  def to_low(name = self.name)
1543
1546
  # return HDLRuby::Low::Type.new(name)
1544
1547
  typeL = HDLRuby::Low::Type.new(name)
1545
- # For debugging: set the source high object
1546
- typeL.properties[:low2high] = self.hdr_id
1547
- self.properties[:high2low] = typeL
1548
+ # # For debugging: set the source high object
1549
+ # typeL.properties[:low2high] = self.hdr_id
1550
+ # self.properties[:high2low] = typeL
1548
1551
  return typeL
1549
1552
  end
1550
1553
  end
@@ -1696,9 +1699,9 @@ module HDLRuby::High
1696
1699
  def to_low(name = self.name)
1697
1700
  # return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
1698
1701
  typeDefL = HDLRuby::Low::TypeDef.new(name,self.def.to_low)
1699
- # For debugging: set the source high object
1700
- typeDefL.properties[:low2high] = self.hdr_id
1701
- self.properties[:high2low] = typeDefL
1702
+ # # For debugging: set the source high object
1703
+ # typeDefL.properties[:low2high] = self.hdr_id
1704
+ # self.properties[:high2low] = typeDefL
1702
1705
  return typeDefL
1703
1706
  end
1704
1707
  end
@@ -1749,9 +1752,9 @@ module HDLRuby::High
1749
1752
  def to_low(name = self.name)
1750
1753
  # return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
1751
1754
  typeDefL = HDLRuby::Low::TypeDef.new(name,self.def.to_low)
1752
- # For debugging: set the source high object
1753
- typeDefL.properties[:low2high] = self.hdr_id
1754
- self.properties[:high2low] = typeDefL
1755
+ # # For debugging: set the source high object
1756
+ # typeDefL.properties[:low2high] = self.hdr_id
1757
+ # self.properties[:high2low] = typeDefL
1755
1758
  return typeDefL
1756
1759
  end
1757
1760
  end
@@ -1767,9 +1770,9 @@ module HDLRuby::High
1767
1770
  # self.range.to_low)
1768
1771
  typeVectorL = HDLRuby::Low::TypeVector.new(name,self.base.to_low,
1769
1772
  self.range.to_low)
1770
- # For debugging: set the source high object
1771
- typeVectorL.properties[:low2high] = self.hdr_id
1772
- self.properties[:high2low] = typeVectorL
1773
+ # # For debugging: set the source high object
1774
+ # typeVectorL.properties[:low2high] = self.hdr_id
1775
+ # self.properties[:high2low] = typeVectorL
1773
1776
  return typeVectorL
1774
1777
  end
1775
1778
  end
@@ -1847,9 +1850,9 @@ module HDLRuby::High
1847
1850
  # *@types.map { |type| type.to_low } )
1848
1851
  typeTupleL = HDLRuby::Low::TypeTuple.new(name,self.direction,
1849
1852
  *@types.map { |type| type.to_low } )
1850
- # For debugging: set the source high object
1851
- typeTupleL.properties[:low2high] = self.hdr_id
1852
- self.properties[:high2low] = typeTupleL
1853
+ # # For debugging: set the source high object
1854
+ # typeTupleL.properties[:low2high] = self.hdr_id
1855
+ # self.properties[:high2low] = typeTupleL
1853
1856
  return typeTupleL
1854
1857
  end
1855
1858
  end
@@ -1868,9 +1871,9 @@ module HDLRuby::High
1868
1871
  # @types.map { |name,type| [name,type.to_low] } )
1869
1872
  typeStructL = HDLRuby::Low::TypeStruct.new(name,self.direction,
1870
1873
  @types.map { |name,type| [name,type.to_low] } )
1871
- # For debugging: set the source high object
1872
- typeStructL.properties[:low2high] = self.hdr_id
1873
- self.properties[:high2low] = typeStructL
1874
+ # # For debugging: set the source high object
1875
+ # typeStructL.properties[:low2high] = self.hdr_id
1876
+ # self.properties[:high2low] = typeStructL
1874
1877
  return typeStructL
1875
1878
  end
1876
1879
  end
@@ -2108,9 +2111,9 @@ module HDLRuby::High
2108
2111
  # Creates the resulting HDLRuby::Low instance
2109
2112
  systemIL = HDLRuby::Low::SystemI.new(High.names_create(name),
2110
2113
  systemTL)
2111
- # For debugging: set the source high object
2112
- systemIL.properties[:low2high] = self.hdr_id
2113
- self.properties[:high2low] = systemIL
2114
+ # # For debugging: set the source high object
2115
+ # systemIL.properties[:low2high] = self.hdr_id
2116
+ # self.properties[:high2low] = systemIL
2114
2117
  # Adds the other systemTs.
2115
2118
  self.each_systemT do |systemT|
2116
2119
  systemIL.add_systemT(systemT.to_low) unless systemT == self.systemT
@@ -2136,9 +2139,9 @@ module HDLRuby::High
2136
2139
  lump = lump.respond_to?(:to_low) ? lump.to_low : lump.to_s
2137
2140
  lump
2138
2141
  end)
2139
- # For debugging: set the source high object
2140
- chunkL.properties[:low2high] = self.hdr_id
2141
- self.properties[:high2low] = chunkL
2142
+ # # For debugging: set the source high object
2143
+ # chunkL.properties[:low2high] = self.hdr_id
2144
+ # self.properties[:high2low] = chunkL
2142
2145
  return chunkL
2143
2146
  end
2144
2147
  end
@@ -2150,9 +2153,9 @@ module HDLRuby::High
2150
2153
  def to_low
2151
2154
  # Create the resulting code.
2152
2155
  codeL = HDLRuby::Low::Code.new
2153
- # For debugging: set the source high object
2154
- codeL.properties[:low2high] = self.hdr_id
2155
- self.properties[:high2low] = codeL
2156
+ # # For debugging: set the source high object
2157
+ # codeL.properties[:low2high] = self.hdr_id
2158
+ # self.properties[:high2low] = codeL
2156
2159
  # Add the low-level events.
2157
2160
  self.each_event { |event| codeL.add_event(event.to_low) }
2158
2161
  # Add the low-level code chunks.
@@ -2244,9 +2247,9 @@ module HDLRuby::High
2244
2247
  ifL = HDLRuby::Low::If.new(self.condition.to_low,
2245
2248
  self.yes.to_low,noL)
2246
2249
  self.each_noif {|cond,block| ifL.add_noif(cond.to_low,block.to_low)}
2247
- # For debugging: set the source high object
2248
- ifL.properties[:low2high] = self.hdr_id
2249
- self.properties[:high2low] = ifL
2250
+ # # For debugging: set the source high object
2251
+ # ifL.properties[:low2high] = self.hdr_id
2252
+ # self.properties[:high2low] = ifL
2250
2253
  return ifL
2251
2254
  end
2252
2255
  end
@@ -2269,9 +2272,9 @@ module HDLRuby::High
2269
2272
  # self.statement.to_low)
2270
2273
  whenL = HDLRuby::Low::When.new(self.match.to_low,
2271
2274
  self.statement.to_low)
2272
- # For debugging: set the source high object
2273
- whenL.properties[:low2high] = self.hdr_id
2274
- self.properties[:high2low] = whenL
2275
+ # # For debugging: set the source high object
2276
+ # whenL.properties[:low2high] = self.hdr_id
2277
+ # self.properties[:high2low] = whenL
2275
2278
  return whenL
2276
2279
  end
2277
2280
  end
@@ -2317,9 +2320,9 @@ module HDLRuby::High
2317
2320
  def to_low
2318
2321
  # Create the low level case.
2319
2322
  caseL = HDLRuby::Low::Case.new(@value.to_low)
2320
- # For debugging: set the source high object
2321
- caseL.properties[:low2high] = self.hdr_id
2322
- self.properties[:high2low] = caseL
2323
+ # # For debugging: set the source high object
2324
+ # caseL.properties[:low2high] = self.hdr_id
2325
+ # self.properties[:high2low] = caseL
2323
2326
  # Add each when case.
2324
2327
  self.each_when do |w|
2325
2328
  caseL.add_when(w.to_low)
@@ -2348,9 +2351,9 @@ module HDLRuby::High
2348
2351
  def to_low
2349
2352
  # return HDLRuby::Low::Delay.new(self.value, self.unit)
2350
2353
  delayL = HDLRuby::Low::Delay.new(self.value, self.unit)
2351
- # For debugging: set the source high object
2352
- delayL.properties[:low2high] = self.hdr_id
2353
- self.properties[:high2low] = delayL
2354
+ # # For debugging: set the source high object
2355
+ # delayL.properties[:low2high] = self.hdr_id
2356
+ # self.properties[:high2low] = delayL
2354
2357
  return delayL
2355
2358
  end
2356
2359
  end
@@ -2364,9 +2367,9 @@ module HDLRuby::High
2364
2367
  def to_low
2365
2368
  # return HDLRuby::Low::TimeWait.new(self.delay.to_low)
2366
2369
  timeWaitL = HDLRuby::Low::TimeWait.new(self.delay.to_low)
2367
- # For debugging: set the source high object
2368
- timeWaitL.properties[:low2high] = self.hdr_id
2369
- self.properties[:high2low] = timeWaitL
2370
+ # # For debugging: set the source high object
2371
+ # timeWaitL.properties[:low2high] = self.hdr_id
2372
+ # self.properties[:high2low] = timeWaitL
2370
2373
  return timeWaitL
2371
2374
  end
2372
2375
  end
@@ -2383,9 +2386,9 @@ module HDLRuby::High
2383
2386
  # self.delay.to_low)
2384
2387
  timeRepeatL = HDLRuby::Low::TimeRepeat.new(self.statement.to_low,
2385
2388
  self.delay.to_low)
2386
- # For debugging: set the source high object
2387
- timeRepeatL.properties[:low2high] = self.hdr_id
2388
- self.properties[:high2low] = timeRepeatL
2389
+ # # For debugging: set the source high object
2390
+ # timeRepeatL.properties[:low2high] = self.hdr_id
2391
+ # self.properties[:high2low] = timeRepeatL
2389
2392
  return timeRepeatL
2390
2393
  end
2391
2394
  end
@@ -2655,7 +2658,6 @@ module HDLRuby::High
2655
2658
  end
2656
2659
  end
2657
2660
 
2658
-
2659
2661
  # Converts to a select operator using current expression as
2660
2662
  # condition for one of the +choices+.
2661
2663
  #
@@ -2671,6 +2673,7 @@ module HDLRuby::High
2671
2673
  end
2672
2674
 
2673
2675
 
2676
+
2674
2677
  # Methods for conversion for HDLRuby::Low: type processing, flattening
2675
2678
  # and so on
2676
2679
 
@@ -2743,9 +2746,9 @@ module HDLRuby::High
2743
2746
  def to_low
2744
2747
  # return HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
2745
2748
  castL =HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
2746
- # For debugging: set the source high object
2747
- castL.properties[:low2high] = self.hdr_id
2748
- self.properties[:high2low] = castL
2749
+ # # For debugging: set the source high object
2750
+ # castL.properties[:low2high] = self.hdr_id
2751
+ # self.properties[:high2low] = castL
2749
2752
  return castL
2750
2753
  end
2751
2754
  end
@@ -2767,9 +2770,9 @@ module HDLRuby::High
2767
2770
  # self.child.to_low)
2768
2771
  unaryL = HDLRuby::Low::Unary.new(self.type.to_low, self.operator,
2769
2772
  self.child.to_low)
2770
- # For debugging: set the source high object
2771
- unaryL.properties[:low2high] = self.hdr_id
2772
- self.properties[:high2low] = unaryL
2773
+ # # For debugging: set the source high object
2774
+ # unaryL.properties[:low2high] = self.hdr_id
2775
+ # self.properties[:high2low] = unaryL
2773
2776
  return unaryL
2774
2777
  end
2775
2778
  end
@@ -2792,9 +2795,9 @@ module HDLRuby::High
2792
2795
  # self.left.to_low, self.right.to_low)
2793
2796
  binaryL = HDLRuby::Low::Binary.new(self.type.to_low, self.operator,
2794
2797
  self.left.to_low, self.right.to_low)
2795
- # For debugging: set the source high object
2796
- binaryL.properties[:low2high] = self.hdr_id
2797
- self.properties[:high2low] = binaryL
2798
+ # # For debugging: set the source high object
2799
+ # binaryL.properties[:low2high] = self.hdr_id
2800
+ # self.properties[:high2low] = binaryL
2798
2801
  return binaryL
2799
2802
  end
2800
2803
  end
@@ -2827,9 +2830,9 @@ module HDLRuby::High
2827
2830
  *self.each_choice.map do |choice|
2828
2831
  choice.to_low
2829
2832
  end)
2830
- # For debugging: set the source high object
2831
- selectL.properties[:low2high] = self.hdr_id
2832
- self.properties[:high2low] = selectL
2833
+ # # For debugging: set the source high object
2834
+ # selectL.properties[:low2high] = self.hdr_id
2835
+ # self.properties[:high2low] = selectL
2833
2836
  return selectL
2834
2837
  end
2835
2838
  end
@@ -2861,9 +2864,9 @@ module HDLRuby::High
2861
2864
  expr.to_low
2862
2865
  end
2863
2866
  )
2864
- # For debugging: set the source high object
2865
- concatL.properties[:low2high] = self.hdr_id
2866
- self.properties[:high2low] = concatL
2867
+ # # For debugging: set the source high object
2868
+ # concatL.properties[:low2high] = self.hdr_id
2869
+ # self.properties[:high2low] = concatL
2867
2870
  return concatL
2868
2871
  end
2869
2872
  end
@@ -2905,9 +2908,9 @@ module HDLRuby::High
2905
2908
  # Create and return the resulting low-level value
2906
2909
  # return HDLRuby::Low::Value.new(self.type.to_low,self.content)
2907
2910
  valueL = HDLRuby::Low::Value.new(self.type.to_low,self.content)
2908
- # For debugging: set the source high object
2909
- valueL.properties[:low2high] = self.hdr_id
2910
- self.properties[:high2low] = valueL
2911
+ # # For debugging: set the source high object
2912
+ # valueL.properties[:low2high] = self.hdr_id
2913
+ # self.properties[:high2low] = valueL
2911
2914
  return valueL
2912
2915
  end
2913
2916
 
@@ -3013,9 +3016,9 @@ module HDLRuby::High
3013
3016
  # puts "to_low with base=#{@base} @object=#{@object}"
3014
3017
  refNameL = HDLRuby::Low::RefName.new(self.type.to_low,
3015
3018
  @base.to_ref.to_low,@object.name)
3016
- # For debugging: set the source high object
3017
- refNameL.properties[:low2high] = self.hdr_id
3018
- self.properties[:high2low] = refNameL
3019
+ # # For debugging: set the source high object
3020
+ # refNameL.properties[:low2high] = self.hdr_id
3021
+ # self.properties[:high2low] = refNameL
3019
3022
  return refNameL
3020
3023
  end
3021
3024
 
@@ -3053,9 +3056,9 @@ module HDLRuby::High
3053
3056
  ref.to_low
3054
3057
  end
3055
3058
  )
3056
- # For debugging: set the source high object
3057
- refConcatL.properties[:low2high] = self.hdr_id
3058
- self.properties[:high2low] = refConcatL
3059
+ # # For debugging: set the source high object
3060
+ # refConcatL.properties[:low2high] = self.hdr_id
3061
+ # self.properties[:high2low] = refConcatL
3059
3062
  return refConcatL
3060
3063
  end
3061
3064
  end
@@ -3077,9 +3080,9 @@ module HDLRuby::High
3077
3080
  # self.ref.to_low,self.index.to_low)
3078
3081
  refIndexL = HDLRuby::Low::RefIndex.new(self.type.to_low,
3079
3082
  self.ref.to_low,self.index.to_low)
3080
- # For debugging: set the source high object
3081
- refIndexL.properties[:low2high] = self.hdr_id
3082
- self.properties[:high2low] = refIndexL
3083
+ # # For debugging: set the source high object
3084
+ # refIndexL.properties[:low2high] = self.hdr_id
3085
+ # self.properties[:high2low] = refIndexL
3083
3086
  return refIndexL
3084
3087
  end
3085
3088
  end
@@ -3101,9 +3104,9 @@ module HDLRuby::High
3101
3104
  # self.ref.to_low,self.range.to_low)
3102
3105
  refRangeL = HDLRuby::Low::RefRange.new(self.type.to_low,
3103
3106
  self.ref.to_low,self.range.to_low)
3104
- # For debugging: set the source high object
3105
- refRangeL.properties[:low2high] = self.hdr_id
3106
- self.properties[:high2low] = refRangeL
3107
+ # # For debugging: set the source high object
3108
+ # refRangeL.properties[:low2high] = self.hdr_id
3109
+ # self.properties[:high2low] = refRangeL
3107
3110
  return refRangeL
3108
3111
  end
3109
3112
  end
@@ -3124,9 +3127,9 @@ module HDLRuby::High
3124
3127
  # self.ref.to_low,self.name)
3125
3128
  refNameL = HDLRuby::Low::RefName.new(self.type.to_low,
3126
3129
  self.ref.to_low,self.name)
3127
- # For debugging: set the source high object
3128
- refNameL.properties[:low2high] = self.hdr_id
3129
- self.properties[:high2low] = refNameL
3130
+ # # For debugging: set the source high object
3131
+ # refNameL.properties[:low2high] = self.hdr_id
3132
+ # self.properties[:high2low] = refNameL
3130
3133
  return refNameL
3131
3134
  end
3132
3135
  end
@@ -3161,9 +3164,9 @@ module HDLRuby::High
3161
3164
  def to_low
3162
3165
  # return HDLRuby::Low::RefThis.new
3163
3166
  refThisL = HDLRuby::Low::RefThis.new
3164
- # For debugging: set the source high object
3165
- refThisL.properties[:low2high] = self.hdr_id
3166
- self.properties[:high2low] = refThisL
3167
+ # # For debugging: set the source high object
3168
+ # refThisL.properties[:low2high] = self.hdr_id
3169
+ # self.properties[:high2low] = refThisL
3167
3170
  return refThisL
3168
3171
  end
3169
3172
  end
@@ -3234,9 +3237,9 @@ module HDLRuby::High
3234
3237
  def to_low
3235
3238
  # return HDLRuby::Low::Event.new(self.type,self.ref.to_low)
3236
3239
  eventL = HDLRuby::Low::Event.new(self.type,self.ref.to_low)
3237
- # For debugging: set the source high object
3238
- eventL.properties[:low2high] = self.hdr_id
3239
- self.properties[:high2low] = eventL
3240
+ # # For debugging: set the source high object
3241
+ # eventL.properties[:low2high] = self.hdr_id
3242
+ # self.properties[:high2low] = eventL
3240
3243
  return eventL
3241
3244
  end
3242
3245
  end
@@ -3277,9 +3280,9 @@ module HDLRuby::High
3277
3280
  # self.right.to_low)
3278
3281
  transmitL = HDLRuby::Low::Transmit.new(self.left.to_low,
3279
3282
  self.right.to_low)
3280
- # For debugging: set the source high object
3281
- transmitL.properties[:low2high] = self.hdr_id
3282
- self.properties[:high2low] = transmitL
3283
+ # # For debugging: set the source high object
3284
+ # transmitL.properties[:low2high] = self.hdr_id
3285
+ # self.properties[:high2low] = transmitL
3283
3286
  return transmitL
3284
3287
  end
3285
3288
  end
@@ -3370,9 +3373,9 @@ module HDLRuby::High
3370
3373
  # self.right.to_low)
3371
3374
  connectionL = HDLRuby::Low::Connection.new(self.left.to_low,
3372
3375
  self.right.to_low)
3373
- # For debugging: set the source high object
3374
- connectionL.properties[:low2high] = self.hdr_id
3375
- self.properties[:high2low] = connectionL
3376
+ # # For debugging: set the source high object
3377
+ # connectionL.properties[:low2high] = self.hdr_id
3378
+ # self.properties[:high2low] = connectionL
3376
3379
  return connectionL
3377
3380
  end
3378
3381
  end
@@ -3484,9 +3487,9 @@ module HDLRuby::High
3484
3487
  def to_low(name = self.name)
3485
3488
  # return HDLRuby::Low::SignalI.new(name,self.type.to_low)
3486
3489
  signalIL = HDLRuby::Low::SignalI.new(name,self.type.to_low)
3487
- # For debugging: set the source high object
3488
- signalIL.properties[:low2high] = self.hdr_id
3489
- self.properties[:high2low] = signalIL
3490
+ # # For debugging: set the source high object
3491
+ # signalIL.properties[:low2high] = self.hdr_id
3492
+ # self.properties[:high2low] = signalIL
3490
3493
  return signalIL
3491
3494
  end
3492
3495
  end
@@ -3550,9 +3553,9 @@ module HDLRuby::High
3550
3553
  # self.value.to_low)
3551
3554
  signalCL = HDLRuby::Low::SignalC.new(name,self.type.to_low,
3552
3555
  self.value.to_low)
3553
- # For debugging: set the source high object
3554
- signalCL.properties[:low2high] = self.hdr_id
3555
- self.properties[:high2low] = signalCL
3556
+ # # For debugging: set the source high object
3557
+ # signalCL.properties[:low2high] = self.hdr_id
3558
+ # self.properties[:high2low] = signalCL
3556
3559
  return signalCL
3557
3560
  end
3558
3561
  end
@@ -3763,9 +3766,9 @@ module HDLRuby::High
3763
3766
  def to_low
3764
3767
  # Create the resulting block
3765
3768
  blockL = HDLRuby::Low::Block.new(self.mode)
3766
- # For debugging: set the source high object
3767
- blockL.properties[:low2high] = self.hdr_id
3768
- self.properties[:high2low] = blockL
3769
+ # # For debugging: set the source high object
3770
+ # blockL.properties[:low2high] = self.hdr_id
3771
+ # self.properties[:high2low] = blockL
3769
3772
  # Push the namespace for the low generation.
3770
3773
  High.space_push(@namespace)
3771
3774
  # Pushes on the name stack for converting the internals of
@@ -3833,9 +3836,9 @@ module HDLRuby::High
3833
3836
  def to_low
3834
3837
  # Create the resulting block
3835
3838
  blockL = HDLRuby::Low::TimeBlock.new(self.mode)
3836
- # For debugging: set the source high object
3837
- blockL.properties[:low2high] = self.hdr_id
3838
- self.properties[:high2low] = blockL
3839
+ # # For debugging: set the source high object
3840
+ # blockL.properties[:low2high] = self.hdr_id
3841
+ # self.properties[:high2low] = blockL
3839
3842
  # Add the inner signals
3840
3843
  self.each_inner { |inner| blockL.add_inner(inner.to_low) }
3841
3844
  # Add the statements
@@ -3927,9 +3930,9 @@ module HDLRuby::High
3927
3930
  eventLs = self.each_event.map { |event| event.to_low }
3928
3931
  # Create and return the resulting low level behavior.
3929
3932
  behaviorL = HDLRuby::Low::Behavior.new(blockL)
3930
- # For debugging: set the source high object
3931
- behaviorL.properties[:low2high] = self.hdr_id
3932
- self.properties[:high2low] = behaviorL
3933
+ # # For debugging: set the source high object
3934
+ # behaviorL.properties[:low2high] = self.hdr_id
3935
+ # self.properties[:high2low] = behaviorL
3933
3936
  eventLs.each(&behaviorL.method(:add_event))
3934
3937
  return behaviorL
3935
3938
  end
@@ -3957,9 +3960,9 @@ module HDLRuby::High
3957
3960
  eventLs = self.each_event.map { |event| event.to_low }
3958
3961
  # Create and return the resulting low level behavior.
3959
3962
  timeBehaviorL = HDLRuby::Low::TimeBehavior.new(blockL)
3960
- # For debugging: set the source high object
3961
- timeBehaviorL.properties[:low2high] = self.hdr_id
3962
- self.properties[:high2low] = timeBehaviorL
3963
+ # # For debugging: set the source high object
3964
+ # timeBehaviorL.properties[:low2high] = self.hdr_id
3965
+ # self.properties[:high2low] = timeBehaviorL
3963
3966
  eventLs.each(&timeBehaviorL.method(:add_event))
3964
3967
  return timeBehaviorL
3965
3968
  end
@@ -4234,6 +4237,22 @@ module HDLRuby::High
4234
4237
  # end
4235
4238
  # end
4236
4239
 
4240
+ # Extends the TrueClass class for computing for conversion to expression.
4241
+ class ::TrueClass
4242
+ # Converts to a new high-level expression.
4243
+ def to_expr
4244
+ return Value.new(Integer,1)
4245
+ end
4246
+ end
4247
+
4248
+ # Extends the FalseClass class for computing for conversion to expression.
4249
+ class ::FalseClass
4250
+ # Converts to a new high-level expression.
4251
+ def to_expr
4252
+ return Value.new(Integer,0)
4253
+ end
4254
+ end
4255
+
4237
4256
  # Extends the Integer class for computing for conversion to expression.
4238
4257
  class ::Integer
4239
4258
  # Converts to a new high-level expression.