Class: HDLRuby::High::RefConcat
- Inherits:
-
Low::RefConcat
- Object
- Low::Expression
- Low::Ref
- Low::RefConcat
- HDLRuby::High::RefConcat
- Includes:
- HRef
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb
Overview
Describes concatenation reference.
Constant Summary
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary
Attributes inherited from Low::Expression
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#assign(mode, value) ⇒ Object
Assigns +value+ the the reference.
-
#assign_at(mode, value, index) ⇒ Object
Assigns +value+ at +index+ (integer or range).
-
#execute(mode) ⇒ Object
Execute the expression.
-
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
-
#to_low ⇒ Object
Converts the concat reference to HDLRuby::Low.
-
#to_rcsim ⇒ Object
Generate the C description of the reference concat.
-
#to_ref ⇒ Object
Converts to a new reference.
Methods included from HRef
#each, included, #objects, #to_event
Methods included from Enumerable
Methods inherited from Low::RefConcat
#add_ref, #boolean_in_assign2select, #casts_without_expression!, #clone, #delete_ref!, #each_deep, #each_node_deep, #each_ref, #eql?, #explicit_types, #hash, #immutable?, #initialize, #map_refs!, #to_c, #to_c_signal, #to_hdr, #to_high, #to_verilog, #to_vhdl, #to_viz_names, #to_viz_node, #use_name?
Methods included from Low::MutableConcat
Methods inherited from Low::Ref
#each_node, #each_node_deep, #eql?, #explicit_types, #hash, #map_nodes!, #path_each, #resolve, #to_c, #to_hdr, #to_vhdl
Methods inherited from Low::Expression
#boolean?, #break_types!, #clone, #each_node, #each_node_deep, #each_ref_deep, #eql?, #explicit_types, #extract_selects_to!, #fix_scope_refnames!, #hash, #immutable?, #initialize, #leftvalue?, #map_nodes!, #replace_expressions!, #replace_names!, #rightvalue?, #set_type!, #signal2subs!, #statement, #to_c, #to_c_expr, #to_hdr, #to_high, #to_vhdl, #to_viz_names, #use_name?
Methods included from Low::Low2Symbol
Methods included from Low::Hparent
#absolute_ref, #hierarchy, #no_parent!, #scope
Constructor Details
This class inherits a constructor from HDLRuby::Low::RefConcat
Instance Method Details
#assign(mode, value) ⇒ Object
Assigns +value+ the the reference.
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1229 def assign(mode,value) # puts "self.type=#{self.type}" # Flatten the value type. value.type = [value.type.width].to_type pos = 0 width = 0 # Recurse on the children. @refs.reverse_each do |ref| # puts "ref.type=#{ref.type}" width = ref.type.width # puts "pos=#{pos} width=#{width}, pos+width-1=#{pos+width-1}" # puts "value.content=#{value.content}" # puts "value[(pos+width-1).to_expr..pos.to_expr].content=#{value[(pos+width-1).to_expr..pos.to_expr].content}" ref.assign(mode,value[(pos+width-1).to_expr..pos.to_expr]) # Prepare for the next reference. pos += width end end |
#assign_at(mode, value, index) ⇒ Object
Assigns +value+ at +index+ (integer or range).
1249 1250 1251 1252 1253 1254 1255 1256 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1249 def assign_at(mode,value,index) # Get the refered value. refv = self.execute(mode,value) # Assign to it. refv.assign_at(mode,value,index) # Update the reference. self.assign(mode,refv) end |
#execute(mode) ⇒ Object
Execute the expression.
1221 1222 1223 1224 1225 1226 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1221 def execute(mode) # Recurse on the children. tmpe = self.each_ref.map { |ref| ref.execute(mode) } # Concatenate the result. return tmpe.reduce(:concat) end |
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
1216 1217 1218 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1216 def init_sim(systemT) self.each_ref { |ref| ref.init_sim(systemT) } end |
#to_low ⇒ Object
Converts the concat reference to HDLRuby::Low.
3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 |
# File 'lib/HDLRuby/hruby_high.rb', line 3642 def to_low # return HDLRuby::Low::RefConcat.new(self.type.to_low, # self.each_ref.map do |ref| # ref.to_low # end # ) refConcatL = HDLRuby::Low::RefConcat.new(self.type.to_low, self.each_ref.map do |ref| ref.to_low end ) # # For debugging: set the source high object # refConcatL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = refConcatL return refConcatL end |
#to_rcsim ⇒ Object
Generate the C description of the reference concat.
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 1040 def to_rcsim # Create the reference concat C object. rcref = RCSim.rcsim_make_refConcat(self.type.to_rcsim, self.type.direction) # Add the concatenated expressions. */ if self.each_ref.any? then RCSim.rcsim_add_refConcat_refs(rcref,self.each_ref.map(&:to_rcsim)) end return rcref end |