HDLRuby 2.2.17 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -113,12 +113,9 @@ module HDLRuby
113
113
  return
114
114
  end
115
115
  # Get its required files.
116
- requires = @checks[-1].get_all_requires
116
+ requires = @checks[-1].get_all_requires +
117
+ @checks[-1].get_all_require_relatives
117
118
  requires.each do |file|
118
- # if file != "HDLRuby" &&
119
- # !@std_files.find { |std| std.include?(file) } then
120
- # read_all(file)
121
- # end
122
119
  read_all(file)
123
120
  end
124
121
  @requires += requires
@@ -244,7 +241,7 @@ include HDLRuby
244
241
  # Process the command line options
245
242
  $options = {}
246
243
  $optparse = OptionParser.new do |opts|
247
- opts.banner = "Usage: hdrcc.rb [options] <input file> [<output file>]"
244
+ opts.banner = "Usage: hdrcc.rb [options] <input file> [<output directory or file>]"
248
245
 
249
246
  opts.separator ""
250
247
  opts.separator "Where:"
@@ -326,18 +323,17 @@ $optparse = OptionParser.new do |opts|
326
323
  opts.separator ""
327
324
  opts.separator "Notice:"
328
325
  opts.separator "* If no output option is given, simply checks the input file"
329
- opts.separator "* If no output file is given, the result is given through the standard output."
330
326
  opts.separator "* If no top system is given, it will be automatically searched in the input file."
331
327
  opts.separator ""
332
328
  opts.separator "Examples:"
333
329
  opts.separator "* Compile system named `adder` from `adder.rb` input file and generate `adder.yaml` low-level YAML description:"
334
330
  opts.separator " hdrcc.rb --yaml --top adder adder.rb adder.yaml"
335
- opts.separator "* Compile `adder.rb` input file and generate `adder.vhd` low-level VHDL description:"
336
- opts.separator " hdrcc.rb --vhdl adder.rb adder.vhd"
331
+ opts.separator "* Compile `adder.rb` input file and generate low-level VHDL description files in `adder_vhd` directory:"
332
+ opts.separator " hdrcc.rb --vhdl adder.rb adder_vhd"
337
333
  opts.separator "* Check the validity of `adder.rb` input file:"
338
334
  opts.separator " hdrcc.rb adder.rb"
339
- opts.separator "* Compile system `adder` whose bit width is generic from `adder_gen.rb` input file to a 16-bit circuit whose low-level Verilog HDL description is dumped to the standard output:"
340
- opts.separator " hdrcc -v -t adder --param 16 adder_gen.rb"
335
+ opts.separator "* Compile system `adder` whose bit width is generic from `adder_gen.rb` input file to a 16-bit circuit whose low-level Verilog HDL description files are put in `adder_gen_v` directory:"
336
+ opts.separator " hdrcc -v -t adder --param 16 adder_gen.rb adder_gen_v"
341
337
  opts.separator "* Compile system `multer` with inputs and output bit width is generic from `multer_gen.rb` input file to a 16x16->32 bit cicruit whose low-level YAML description is saved to output file `multer_gen.yaml`"
342
338
  opts.separator "hdrcc -y -t multer -p 16,16,32 multer_gen.rb multer_gen.yaml"
343
339
 
@@ -45,11 +45,20 @@ module HDLRuby
45
45
  (code[1][1] == "require")
46
46
  end
47
47
 
48
+ # Tells if +code+ is require_relative description.
49
+ def is_require_relative?(code)
50
+ # return code[0] && (code[0][0] == :command) &&
51
+ # (code[0][1][1] == "require_relative")
52
+ return code && (code[0] == :command) &&
53
+ (code[1][1] == "require_relative")
54
+ end
55
+
48
56
  # Gets the required file from +code+.
49
57
  def get_require(code)
50
58
  # return (code[0][2][1][0][1][1][1])
51
59
  return (code[2][1][0][1][1][1])
52
60
  end
61
+ alias_method :get_require_relative, :get_require
53
62
 
54
63
  # Gets all the required files of +code+.
55
64
  def get_all_requires(code = @code)
@@ -66,6 +75,21 @@ module HDLRuby
66
75
  end
67
76
  end
68
77
 
78
+ # Gets all the require_relative files of +code+.
79
+ def get_all_require_relatives(code = @code)
80
+ if code.is_a?(Array) then
81
+ require_relatives = (code.select { |sub| is_require_relative?(sub) }).map! do |sub|
82
+ get_require_relative(sub)
83
+ end
84
+ code.each do |sub|
85
+ require_relatives += get_all_require_relatives(sub)
86
+ end
87
+ return require_relatives
88
+ else
89
+ return []
90
+ end
91
+ end
92
+
69
93
  # Tells if +code+ is a system description.
70
94
  def is_system?(code)
71
95
  return code.is_a?(Array) && (code[0] == :command) &&
@@ -77,7 +101,7 @@ module HDLRuby
77
101
  return code[2][1][0][1][1][1]
78
102
  end
79
103
 
80
- # Gets all the required files of +code+.
104
+ # Gets all the systems of +code+.
81
105
  def get_all_systems(code = @code)
82
106
  return [] unless code.is_a?(Array)
83
107
  return code.reduce([]) {|ar,sub| ar + get_all_systems(sub) } +
@@ -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.
@@ -1123,6 +1123,10 @@ module HDLRuby::Low
1123
1123
  return self.parent.is_a?(SystemT) ? self : self.parent.top_scope
1124
1124
  end
1125
1125
 
1126
+ # Gets the parent system, i.e., the parent of the top scope.
1127
+ def parent_system
1128
+ return self.top_scope.parent
1129
+ end
1126
1130
 
1127
1131
  end
1128
1132
 
@@ -1385,7 +1389,8 @@ module HDLRuby::Low
1385
1389
  # NOTE: type definition are actually type with a name refering to another
1386
1390
  # type (and equivalent to it).
1387
1391
  class TypeDef < Type
1388
- extend Forwardable
1392
+ # Moved to constructor
1393
+ # extend Forwardable
1389
1394
 
1390
1395
  # The definition of the type.
1391
1396
  attr_reader :def
@@ -1402,6 +1407,19 @@ module HDLRuby::Low
1402
1407
  end
1403
1408
  # Set the referened type.
1404
1409
  @def = type
1410
+
1411
+ # Sets the delegations
1412
+ self.extend Forwardable
1413
+ [ :signed?, :unsigned?, :fixed?, :float?, :leaf?,
1414
+ :width, :range?, :range, :base?, :base, :types?,
1415
+ :get_all_types, :get_type, :each, :each_type,
1416
+ :regular?,
1417
+ :each_name,
1418
+ :equivalent? ].each do |meth|
1419
+ if @def.respond_to?(meth)
1420
+ self.def_delegator :@def, meth
1421
+ end
1422
+ end
1405
1423
  end
1406
1424
 
1407
1425
  # Comparison for hash: structural comparison.
@@ -1429,14 +1447,15 @@ module HDLRuby::Low
1429
1447
  @def.each_type_deep(&ruby_block)
1430
1448
  end
1431
1449
 
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?
1450
+ # Moved to constructor
1451
+ # # Delegate the type methods to the ref.
1452
+ # def_delegators :@def,
1453
+ # :signed?, :unsigned?, :fixed?, :float?, :leaf?,
1454
+ # :width, :range?, :range, :base?, :base, :types?,
1455
+ # :get_all_types, :get_type, :each, :each_type,
1456
+ # :regular?,
1457
+ # :each_name,
1458
+ # :equivalent?
1440
1459
  end
1441
1460
 
1442
1461
 
@@ -2117,6 +2136,11 @@ module HDLRuby::Low
2117
2136
  def top_scope
2118
2137
  return parent.top_scope
2119
2138
  end
2139
+
2140
+ # Gets the parent system, i.e., the parent of the top scope.
2141
+ def parent_system
2142
+ return self.top_scope.parent
2143
+ end
2120
2144
  end
2121
2145
 
2122
2146
 
@@ -2604,6 +2628,11 @@ module HDLRuby::Low
2604
2628
  def top_scope
2605
2629
  return self.scope.top_scope
2606
2630
  end
2631
+
2632
+ # Gets the parent system, i.e., the parent of the top scope.
2633
+ def parent_system
2634
+ return self.top_scope.parent
2635
+ end
2607
2636
  end
2608
2637
 
2609
2638
 
@@ -3702,6 +3731,11 @@ module HDLRuby::Low
3702
3731
  def top_scope
3703
3732
  return self.parent.is_a?(Scope) ? self.parent : self.parent.top_scope
3704
3733
  end
3734
+
3735
+ # Gets the parent system, i.e., the parent of the top scope.
3736
+ def parent_system
3737
+ return self.top_scope.parent
3738
+ end
3705
3739
  end
3706
3740
 
3707
3741
 
@@ -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"
@@ -1942,7 +1946,9 @@ module HDLRuby::Low
1942
1946
  # Generates the C text for reference as left value to a signal.
1943
1947
  # +level+ is the hierarchical level of the object.
1944
1948
  def to_c_signal(level = 0)
1945
- return to_c(level,true)
1949
+ # return to_c(level,true)
1950
+ return "make_ref_rangeS(#{self.ref.to_c_signal(level)}," +
1951
+ "value2integer(#{self.range.first.to_c(level)}),value2integer(#{self.range.last.to_c(level)}))"
1946
1952
  end
1947
1953
  end
1948
1954
 
@@ -294,6 +294,8 @@ module HDLRuby::Low
294
294
  # Is there a type to match?
295
295
  if type then
296
296
  # Yes, update the concat to the type.
297
+ # Get the real type in case of typedef.
298
+ type = type.def while type.is_a?(TypeDef)
297
299
  # Is it an array type?
298
300
  if type.is_a?(TypeVector) then
299
301
  # Yes, update the concat without subcasting.
@@ -302,14 +304,16 @@ module HDLRuby::Low
302
304
  end)
303
305
  else
304
306
  # No, it should be a tuple.
305
- return Concat.new(type,self.expressions.map.with_index do
307
+ return Concat.new(type,
308
+ self.each_expression.map.with_index do
306
309
  |expr,i|
307
310
  expr.explicit_types(type.get_type(i))
308
311
  end)
309
312
  end
310
313
  else
311
314
  # No, recurse on the sub expressions.
312
- return Concat.new(self.type,self.expressions.map do |expr|
315
+ return Concat.new(self.type,
316
+ self.each_expression.map do |expr|
313
317
  expr.explicit_types
314
318
  end)
315
319
  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, :<<