HDLRuby 2.2.17 → 2.3.0

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: f9512393bdc65c3c2ae471d471b30d911cb693b8c1bc18a20186320286f27602
4
- data.tar.gz: 8a5bce50d367d52c181779ce834b2cfb3ecb14fe3c6ce96388eade344692e616
3
+ metadata.gz: '08a1cfdc289eddf8a849b47ba65bf9fa0516ce40119a0ee2d498f535a5132af7'
4
+ data.tar.gz: 81f0f9897e053b894be99b5ab0c7df634c9b16919d6b0ee7cb272fac039ef44b
5
5
  SHA512:
6
- metadata.gz: 8cc2e806c2eb5d5ea9e4bc2c5cc449f2a0f6ca7270b73232efcc3fb9ae7bacdd074e2995f9233547fc47dae4ccfd98ab9b41d3903cee87374247cc4f68e353e4
7
- data.tar.gz: 698b4bd637fe294d0bf27fa163ef3c52528260cf443482d9e9a4922a56032db8400d8f95af67a3b62d67e949840c437869512514cb0db575c5b8c7b1b9b7fad9
6
+ metadata.gz: 8083b7a99ce02118442cd4ed084ea391c9bafc34635810499edf51776ef73338335a9a85afa1a2eac3f8a4a7411bf1de8f27d871af0f025b008e25a0bf44d6d8
7
+ data.tar.gz: 28009e1a04aae15416c43e900a05a7dbb9cac0db946af08abfb7dfb5cfdc7cc2f9552cbea010ffb8db295e2bc6b329a339eb0d81da4ce1efc35b222a0b4b195e
@@ -0,0 +1,96 @@
1
+ require 'std/memory.rb'
2
+ require 'std/linear.rb'
3
+ # require 'std/timing.rb'
4
+
5
+ include HDLRuby::High::Std
6
+
7
+
8
+ system :fir do |typ,iChannel,oChannel,coefs|
9
+ input :clk, :rst, :req
10
+ output :ack
11
+ # Declare the input port.
12
+ iChannel.input :iPort
13
+ # Declare the output port.
14
+ oChannel.output :oPort
15
+
16
+ # Declares the data registers.
17
+ datas = coefs.map.with_index do |coef,id|
18
+ coef.type.inner :"data_#{id}"
19
+ end
20
+
21
+ inner :req2
22
+
23
+
24
+ # Generate the mac pipeline.
25
+ mac_np(typ,clk.posedge,req2,ack,
26
+ datas.map{|data| channel_port(data) },
27
+ coefs.map{|coef| channel_port(coef) }, oPort)
28
+
29
+ # Generate the data transfer through the pipeline.
30
+ par(clk.posedge) do
31
+ req2 <= 0
32
+ hif(rst) { datas.each { |d| d <= 0 } }
33
+ hif(req) do
34
+ iPort.read(datas[0]) do
35
+ # datas.each_cons(2) { |d0,d1| d1 <= d0 }
36
+ datas[1..-1] <= datas[0..-2]
37
+ end
38
+ req2 <= 1
39
+ end
40
+ end
41
+ end
42
+
43
+
44
+
45
+
46
+
47
+ system :work do
48
+
49
+ inner :clk,:rst,:req,:ack
50
+
51
+ # The input memory.
52
+ mem_rom([8],8,clk,rst,
53
+ [_00000001,_00000010,_00000011,_00000100,
54
+ _00000101,_00000110,_00000111,_00001000]).(:iMem)
55
+ # The output memory.
56
+ mem_dual([8],8,clk,rst).(:oMem)
57
+ # The coefficients.
58
+ coefs = [_11001100,_00110011,_10101010,_01010101,
59
+ _11110000,_00001111,_11100011,_00011100]
60
+
61
+ # The filter
62
+ fir([8],iMem.branch(:rinc),oMem.branch(:winc),coefs).(:my_fir).(clk,rst,req,ack)
63
+
64
+ # iMem.branch(:rinc).inner :port
65
+ # [8].inner :a
66
+ # par(clk.posedge) do
67
+ # hif(req) { port.read(a) }
68
+ # end
69
+
70
+ timed do
71
+ req <= 0
72
+ clk <= 0
73
+ rst <= 0
74
+ !10.ns
75
+ clk <= 1
76
+ !10.ns
77
+ clk <= 0
78
+ rst <= 1
79
+ !10.ns
80
+ clk <= 1
81
+ !10.ns
82
+ clk <= 0
83
+ rst <= 0
84
+ !10.ns
85
+ clk <= 1
86
+ !10.ns
87
+ req <= 1
88
+ clk <= 0
89
+ 64.times do
90
+ !10.ns
91
+ clk <= 1
92
+ !10.ns
93
+ clk <= 0
94
+ end
95
+ end
96
+ end
@@ -15,7 +15,10 @@ system :testmat do
15
15
  inner :clk,:rst, :req
16
16
 
17
17
  # Input memories
18
- mem_dual([8],256,clk,rst, rinc: :rst,winc: :rst).(:memL0)
18
+ # mem_dual([8],256,clk,rst, rinc: :rst,winc: :rst).(:memL0)
19
+ # The first memory is 4-bank for testing purpose.
20
+ mem_bank([8],4,256/4,clk,rst, rinc: :rst,winc: :rst).(:memL0)
21
+ # The others are standard dual-edge memories.
19
22
  mem_dual([8],256,clk,rst, rinc: :rst,winc: :rst).(:memL1)
20
23
  mem_dual([8],256,clk,rst, rinc: :rst,winc: :rst).(:memR)
21
24
  # Access ports.
@@ -0,0 +1,69 @@
1
+ require 'std/loop.rb'
2
+
3
+ include HDLRuby::High::Std
4
+
5
+ system :with_loop do
6
+
7
+ # The clock and reset
8
+ inner :clk, :rst
9
+ # The running signals.
10
+ inner :doit0, :doit1
11
+ # The signal to check for finishing.
12
+ inner :over
13
+
14
+ # A counter.
15
+ [8].inner :count, :count2
16
+
17
+ # The first loop: basic while.
18
+ lp0 = while_loop(clk, proc{count<=0}, count<15) { count <= count + 1 }
19
+
20
+ # The second loop: 10 times.
21
+ lp1 = times_loop(clk,10) { count2 <= count2+2 }
22
+ # Control it using doit1 as req and over as ack.
23
+ rst_req_ack(clk.posedge,rst,doit1,over,lp1)
24
+
25
+ par(clk.posedge) do
26
+ doit1 <= 0
27
+ hif(rst) do
28
+ lp0.reset()
29
+ # lp1.reset()
30
+ # doit1 <= 0
31
+ count2 <= 0
32
+ over <= 0
33
+ end
34
+ helse do
35
+ hif(doit0) { lp0.run }
36
+ lp0.finish { doit0 <= 0; doit1 <= 1 }# ; lp1.run }
37
+ hif(doit1) { lp1.run; lp0.reset() }
38
+ # lp1.finish { over <= 1; doit1 <= 0 }
39
+ # Second pass for first loop.
40
+ hif(over) { lp0.run }
41
+ end
42
+ end
43
+
44
+ timed do
45
+ clk <= 0
46
+ rst <= 0
47
+ doit0 <= 0
48
+ !10.ns
49
+ clk <= 1
50
+ !10.ns
51
+ clk <= 0
52
+ rst <= 1
53
+ !10.ns
54
+ clk <= 1
55
+ !10.ns
56
+ clk <= 0
57
+ rst <= 0
58
+ doit0 <= 1
59
+ !10.ns
60
+ clk <= 1
61
+ !10.ns
62
+ 64.times do
63
+ clk <= 0
64
+ !10.ns
65
+ clk <= 1
66
+ !10.ns
67
+ end
68
+ end
69
+ end
@@ -108,16 +108,26 @@ system :mem_test do
108
108
  end
109
109
 
110
110
 
111
- [8].inner :sum
111
+ [8].inner :sum0, :sum1
112
112
 
113
113
  # Declares a dual edge 8-bit data and address memory.
114
114
  mem_dual([8],256,clk,rst, raddr: :rst,waddr: :rst).(:memDI)
115
115
 
116
116
  # Instantiate the producer to access port waddr of the memory.
117
- producer(memDI.branch(:waddr)).(:producerI).(clk,rst)
117
+ producer(memDI.branch(:waddr)).(:producerI0).(clk,rst)
118
118
 
119
119
  # Instantiate the producer to access port raddr of the memory.
120
- consumer(memDI.branch(:raddr)).(:consumerI).(clk,rst,sum)
120
+ consumer(memDI.branch(:raddr)).(:consumerI0).(clk,rst,sum0)
121
+
122
+
123
+ # Declares a 4-bank 8-bit data and address memory.
124
+ mem_bank([8],4,256/4,clk,rst, raddr: :rst, waddr: :rst).(:memBI)
125
+
126
+ # Instantiate the producer to access port waddr of the memory.
127
+ producer(memBI.branch(:waddr)).(:producerI1).(clk,rst)
128
+
129
+ # Instantiate the producer to access port raddr of the memory.
130
+ consumer(memBI.branch(:raddr)).(:consumerI1).(clk,rst,sum1)
121
131
 
122
132
 
123
133
  end
@@ -1308,6 +1308,12 @@ module HDLRuby::High
1308
1308
  return true
1309
1309
  end
1310
1310
 
1311
+ # Converts to a type.
1312
+ # Returns self since it is already a type.
1313
+ def to_type
1314
+ return self
1315
+ end
1316
+
1311
1317
  # Sets the +name+.
1312
1318
  #
1313
1319
  # NOTE: can only be done if the name is not already set.
@@ -1385,7 +1385,8 @@ module HDLRuby::Low
1385
1385
  # NOTE: type definition are actually type with a name refering to another
1386
1386
  # type (and equivalent to it).
1387
1387
  class TypeDef < Type
1388
- extend Forwardable
1388
+ # Moved to constructor
1389
+ # extend Forwardable
1389
1390
 
1390
1391
  # The definition of the type.
1391
1392
  attr_reader :def
@@ -1402,6 +1403,19 @@ module HDLRuby::Low
1402
1403
  end
1403
1404
  # Set the referened type.
1404
1405
  @def = type
1406
+
1407
+ # Sets the delegations
1408
+ self.extend Forwardable
1409
+ [ :signed?, :unsigned?, :fixed?, :float?, :leaf?,
1410
+ :width, :range?, :range, :base?, :base, :types?,
1411
+ :get_all_types, :get_type, :each, :each_type,
1412
+ :regular?,
1413
+ :each_name,
1414
+ :equivalent? ].each do |meth|
1415
+ if @def.respond_to?(meth)
1416
+ self.def_delegator :@def, meth
1417
+ end
1418
+ end
1405
1419
  end
1406
1420
 
1407
1421
  # Comparison for hash: structural comparison.
@@ -1429,14 +1443,15 @@ module HDLRuby::Low
1429
1443
  @def.each_type_deep(&ruby_block)
1430
1444
  end
1431
1445
 
1432
- # Delegate the type methods to the ref.
1433
- def_delegators :@def,
1434
- :signed?, :unsigned?, :fixed?, :float?, :leaf?,
1435
- :width, :range?, :range, :base?, :base, :types?,
1436
- :get_all_types, :get_type, :each, :each_type,
1437
- :regular?,
1438
- :each_name,
1439
- :equivalent?
1446
+ # Moved to constructor
1447
+ # # Delegate the type methods to the ref.
1448
+ # def_delegators :@def,
1449
+ # :signed?, :unsigned?, :fixed?, :float?, :leaf?,
1450
+ # :width, :range?, :range, :base?, :base, :types?,
1451
+ # :get_all_types, :get_type, :each, :each_type,
1452
+ # :regular?,
1453
+ # :each_name,
1454
+ # :equivalent?
1440
1455
  end
1441
1456
 
1442
1457
 
@@ -546,9 +546,10 @@ module HDLRuby::Low
546
546
  #
547
547
  # NOTE: type tuples are converted to bit vector of their contents.
548
548
  def to_c(level = 0)
549
- return "get_type_tuple(#{self.each.join(",") do |type|
550
- type.to_c(level+1)
551
- end})"
549
+ # return "get_type_tuple(#{self.each.to_a.join(",") do |type|
550
+ # type.to_c(level+1)
551
+ # end})"
552
+ return self.to_vector.to_c(level)
552
553
  end
553
554
  end
554
555
 
@@ -1872,7 +1873,8 @@ module HDLRuby::Low
1872
1873
  res << "idx = value2integer(#{self.index.to_c(level+2)});\n"
1873
1874
  # Make the access.
1874
1875
  res << (" " * ((level+1)*3))
1875
- res << "dst = read_range(ref,idx,idx,#{self.ref.type.base.to_c(level)},dst);\n"
1876
+ # res << "dst = read_range(ref,idx,idx,#{self.ref.type.base.to_c(level)},dst);\n"
1877
+ res << "dst = read_range(ref,idx,idx,#{self.type.to_c(level)},dst);\n"
1876
1878
  # Restore the state of the value pool.
1877
1879
  res << (" " * ((level+1)*3))
1878
1880
  res << "set_value_pos(pool_state);\n"
@@ -1930,7 +1932,9 @@ module HDLRuby::Low
1930
1932
  res << "last = value2integer(#{self.range.last.to_c(level+2)});\n"
1931
1933
  # Make the access.
1932
1934
  res << (" " * ((level+1)*3))
1933
- res << "dst = #{command}_range(ref,first,last,#{self.ref.type.base.to_c(level)},dst);\n"
1935
+ # res << "dst = #{command}_range(ref,first,last,#{self.ref.type.base.to_c(level)},dst);\n"
1936
+ # puts "will read_range for #{self.ref.name} with width=#{self.ref.type.width} with base width=#{self.ref.type.base.width} with range=#{self.ref.type.range} with range=#{self.range.first.content}..#{self.range.last.content}"
1937
+ res << "dst = #{command}_range(ref,first,last,#{self.type.base.to_c(level)},dst);\n"
1934
1938
  # Restore the state of the value pool.
1935
1939
  res << (" " * ((level+1)*3))
1936
1940
  res << "set_value_pos(pool_state);\n"
@@ -302,14 +302,16 @@ module HDLRuby::Low
302
302
  end)
303
303
  else
304
304
  # No, it should be a tuple.
305
- return Concat.new(type,self.expressions.map.with_index do
305
+ return Concat.new(type,
306
+ self.each_expression.map.with_index do
306
307
  |expr,i|
307
308
  expr.explicit_types(type.get_type(i))
308
309
  end)
309
310
  end
310
311
  else
311
312
  # No, recurse on the sub expressions.
312
- return Concat.new(self.type,self.expressions.map do |expr|
313
+ return Concat.new(self.type,
314
+ self.each_expression.map do |expr|
313
315
  expr.explicit_types
314
316
  end)
315
317
  end
@@ -91,7 +91,7 @@ module HDLRuby::Low
91
91
 
92
92
  ## Tells if it is a reference to a systemI signal.
93
93
  def from_systemI?
94
- return self.ref.from_systemI
94
+ return self.ref.from_systemI?
95
95
  end
96
96
  end
97
97
 
@@ -103,7 +103,7 @@ module HDLRuby::Low
103
103
 
104
104
  ## Tells if it is a reference to a systemI signal.
105
105
  def from_systemI?
106
- return self.ref.from_systemI
106
+ return self.ref.from_systemI?
107
107
  end
108
108
  end
109
109
 
@@ -119,11 +119,13 @@ module HDLRuby::Low
119
119
  if self.ref.is_a?(RefName) then
120
120
  # Look in the parent hierachy for the sub reference name.
121
121
  parent = self.parent
122
+ # puts "self.ref.name=#{self.ref.name}"
122
123
  while parent
124
+ # puts "parent=#{parent}"
123
125
  if parent.respond_to?(:get_by_name) then
124
126
  found = parent.get_by_name(self.ref.name)
125
127
  # puts "found is a :#{found.class}"
126
- return found.is_a?(SystemI)
128
+ return found.is_a?(SystemI) if found
127
129
  end
128
130
  parent = parent.parent
129
131
  end
@@ -187,11 +187,13 @@ module HDLRuby::Low
187
187
  # Generate the assignment.
188
188
  block.add_statement(
189
189
  Transmit.new(ref.clone,
190
- RefIndex.new(aux.type.base, aux.clone, idx)))
190
+ # RefIndex.new(aux.type.base, aux.clone, idx)))
191
+ RefIndex.new(bit, aux.clone, idx)))
191
192
  else
192
193
  # Multi-bits.
193
194
  # Compute the type of the right value.
194
- rtype = TypeVector.new(:"",aux.type.base,range)
195
+ # rtype = TypeVector.new(:"",aux.type.base,range)
196
+ rtype = TypeVector.new(:"",bit,range)
195
197
  # Generate the range.
196
198
  range = Value.new(Integer,range.first) ..
197
199
  Value.new(Integer,range.last)
@@ -272,11 +274,13 @@ module HDLRuby::Low
272
274
  # Generate the assignment.
273
275
  block.add_statement(
274
276
  Transmit.new(ref.clone,
275
- RefIndex.new(aux.type.base, aux.clone, idx)))
277
+ # RefIndex.new(aux.type.base, aux.clone, idx)))
278
+ RefIndex.new(bit, aux.clone, idx)))
276
279
  else
277
280
  # Multi-bits.
278
281
  # Compute the type of the right value.
279
- rtype = TypeVector.new(:"",aux.type.base,range)
282
+ # rtype = TypeVector.new(:"",aux.type.base,range)
283
+ rtype = TypeVector.new(:"",bit,range)
280
284
  # Generate the range.
281
285
  range = Value.new(Integer,range.first) ..
282
286
  Value.new(Integer,range.last)
@@ -76,19 +76,21 @@ module HDLRuby
76
76
 
77
77
  # Addition.
78
78
  def +(type)
79
- # Resolve the type class.
80
- resolved = self.resolve(type)
81
- # New type range: largest range + 1
82
- bounds = [ self.range.first.to_i, type.range.first.to_i,
83
- self.range.last.to_i, type.range.last.to_i ]
84
- res_lsb = bounds.min
85
- res_msb = bounds.max + 1
86
- # Create and return the new type: its endianess is the one of self
87
- if self.range.first.to_i > self.range.last.to_i then
88
- return resolved.make(:"",resolved.base,res_msb..res_lsb)
89
- else
90
- return resolved.make(:"",resolved.base,res_lsb..res_msb)
91
- end
79
+ # # Resolve the type class.
80
+ # resolved = self.resolve(type)
81
+ # # New type range: largest range + 1
82
+ # bounds = [ self.range.first.to_i, type.range.first.to_i,
83
+ # self.range.last.to_i, type.range.last.to_i ]
84
+ # res_lsb = bounds.min
85
+ # res_msb = bounds.max + 1
86
+ # # Create and return the new type: its endianess is the one of self
87
+ # if self.range.first.to_i > self.range.last.to_i then
88
+ # return resolved.make(:"",resolved.base,res_msb..res_lsb)
89
+ # else
90
+ # return resolved.make(:"",resolved.base,res_lsb..res_msb)
91
+ # end
92
+ # The result is the resolve result now!
93
+ return self.resolve(type)
92
94
  end
93
95
 
94
96
  # Subtraction
@@ -96,36 +98,40 @@ module HDLRuby
96
98
 
97
99
  # Multiplication
98
100
  def *(type)
99
- # Resolve the type class.
100
- resolved = self.resolve(type)
101
- # New type range: largest range * 2
102
- bounds = [ self.range.first.to_i, type.range.first.to_i,
103
- self.range.last.to_i, type.range.last.to_i ]
104
- res_lsb = bounds.min
105
- res_msb = bounds.max * 2
106
- # Create and return the new type: its endianess is the one of self
107
- if self.range.first.to_i > self.range.last.to_i then
108
- return resolved.make(:"",resolved.base,res_msb..res_lsb)
109
- else
110
- return resolved.make(:"",resolved.base,res_lsb..res_msb)
111
- end
101
+ # # Resolve the type class.
102
+ # resolved = self.resolve(type)
103
+ # # New type range: largest range * 2
104
+ # bounds = [ self.range.first.to_i, type.range.first.to_i,
105
+ # self.range.last.to_i, type.range.last.to_i ]
106
+ # res_lsb = bounds.min
107
+ # res_msb = bounds.max * 2
108
+ # # Create and return the new type: its endianess is the one of self
109
+ # if self.range.first.to_i > self.range.last.to_i then
110
+ # return resolved.make(:"",resolved.base,res_msb..res_lsb)
111
+ # else
112
+ # return resolved.make(:"",resolved.base,res_lsb..res_msb)
113
+ # end
114
+ # The result is the resolve result now!
115
+ return self.resolve(type)
112
116
  end
113
117
 
114
118
  # Division
115
119
  def /(type)
116
- # Resolve the type class.
117
- resolved = self.resolve(type)
118
- # New type range: largest range
119
- bounds = [ self.range.first.to_i, type.range.first.to_i,
120
- self.range.last.to_i, type.range.last.to_i ]
121
- res_lsb = bounds.min
122
- res_msb = bounds.max
123
- # Create and return the new type: its endianess is the one of self
124
- if self.range.first.to_i > self.range.last.to_i then
125
- return resolved.make(:"",resolved.base,res_msb..res_lsb)
126
- else
127
- return resolved.make(:"",resolved.base,res_lsb..res_msb)
128
- end
120
+ # # Resolve the type class.
121
+ # resolved = self.resolve(type)
122
+ # # New type range: largest range
123
+ # bounds = [ self.range.first.to_i, type.range.first.to_i,
124
+ # self.range.last.to_i, type.range.last.to_i ]
125
+ # res_lsb = bounds.min
126
+ # res_msb = bounds.max
127
+ # # Create and return the new type: its endianess is the one of self
128
+ # if self.range.first.to_i > self.range.last.to_i then
129
+ # return resolved.make(:"",resolved.base,res_msb..res_lsb)
130
+ # else
131
+ # return resolved.make(:"",resolved.base,res_lsb..res_msb)
132
+ # end
133
+ # The result is the resolve result now!
134
+ return self.resolve(type)
129
135
  end
130
136
 
131
137
  # Modulo
@@ -151,26 +157,28 @@ module HDLRuby
151
157
 
152
158
  # And
153
159
  def &(type)
154
- # puts "compute types with=#{self} and #{type}"
155
- # Resolve the type class.
156
- resolved = self.resolve(type)
157
-
158
- # Logical operation on non-vector types are kept as is.
159
- return resolved unless resolved.is_a?(TypeVector)
160
-
161
- # Otherwise the range is computed.
162
- # New type range: largest range
163
- bounds = [ self.range.first.to_i, type.range.first.to_i,
164
- self.range.last.to_i, type.range.last.to_i ]
165
- # puts "bounds=#{bounds}"
166
- res_lsb = bounds.min
167
- res_msb = bounds.max
168
- # Create and return the new type: its endianess is the one of self
169
- if self.range.first.to_i > self.range.last.to_i then
170
- return resolved.make(:"",resolved.base,res_msb..res_lsb)
171
- else
172
- return resolved.make(:"",resolved.base,res_lsb..res_msb)
173
- end
160
+ # # puts "compute types with=#{self} and #{type}"
161
+ # # Resolve the type class.
162
+ # resolved = self.resolve(type)
163
+ #
164
+ # # Logical operation on non-vector types are kept as is.
165
+ # return resolved unless resolved.is_a?(TypeVector)
166
+
167
+ # # Otherwise the range is computed.
168
+ # # New type range: largest range
169
+ # bounds = [ self.range.first.to_i, type.range.first.to_i,
170
+ # self.range.last.to_i, type.range.last.to_i ]
171
+ # # puts "bounds=#{bounds}"
172
+ # res_lsb = bounds.min
173
+ # res_msb = bounds.max
174
+ # # Create and return the new type: its endianess is the one of self
175
+ # if self.range.first.to_i > self.range.last.to_i then
176
+ # return resolved.make(:"",resolved.base,res_msb..res_lsb)
177
+ # else
178
+ # return resolved.make(:"",resolved.base,res_lsb..res_msb)
179
+ # end
180
+ # The result is the resolve result now!
181
+ return self.resolve(type)
174
182
  end
175
183
 
176
184
  # Or
@@ -211,19 +219,21 @@ module HDLRuby
211
219
 
212
220
  # Shift left
213
221
  def <<(type)
214
- # The result type is the type of left.
215
- resolved = self
216
- # New type range: 2**(type width) times self range
217
- bounds = [ self.range.first.to_i, self.range.last.to_i ]
218
- res_lsb = bounds.min
219
- res_msb = bounds.max +
220
- (2 ** ((type.range.last-type.range.first).abs))
221
- # Create and return the new type: its endianess is the one of self
222
- if self.range.first.to_i > self.range.last.to_i then
223
- return resolved.make(:"",resolved.base,res_msb..res_lsb)
224
- else
225
- return resolved.make(:"",resolved.base,res_lsb..res_msb)
226
- end
222
+ # # The result type is the type of left.
223
+ # resolved = self
224
+ # # New type range: 2**(type width) times self range
225
+ # bounds = [ self.range.first.to_i, self.range.last.to_i ]
226
+ # res_lsb = bounds.min
227
+ # res_msb = bounds.max +
228
+ # (2 ** ((type.range.last-type.range.first).abs))
229
+ # # Create and return the new type: its endianess is the one of self
230
+ # if self.range.first.to_i > self.range.last.to_i then
231
+ # return resolved.make(:"",resolved.base,res_msb..res_lsb)
232
+ # else
233
+ # return resolved.make(:"",resolved.base,res_lsb..res_msb)
234
+ # end
235
+ # The result is the resolve result now!
236
+ return self.resolve(type)
227
237
  end
228
238
 
229
239
  alias_method :ls, :<<