Class: HDLRuby::High::RefRange
- Inherits:
-
Low::RefRange
- Object
- Base::Expression
- Low::Expression
- Low::Ref
- Low::RefRange
- HDLRuby::High::RefRange
- Includes:
- HRef
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb
Overview
Extends the RefRange class for hybrid Ruby-C simulation.
Constant Summary
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary
Attributes inherited from Low::RefRange
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 range reference to HDLRuby::Low.
-
#to_rcsim ⇒ Object
Generate the C description of the reference range.
-
#to_ref ⇒ Object
Converts to a new reference.
Methods included from HRef
Methods inherited from Low::RefRange
#boolean_in_assign2select, #casts_without_expression!, #clone, #each_deep, #each_node, #each_node_deep, #eql?, #explicit_types, #from_systemI?, #hash, #immutable?, #initialize, #map_nodes!, #path_each, #replace_expressions!, #resolve, #set_range!, #set_ref!, #to_c, #to_c_signal, #to_hdr, #to_high, #to_verilog, #to_vhdl, #use_name?
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!, #hash, #immutable?, #initialize, #leftvalue?, #map_nodes!, #replace_expressions!, #replace_names!, #rightvalue?, #set_type!, #statement, #to_c, #to_c_expr, #to_hdr, #to_high, #to_vhdl, #use_name?
Methods included from Low::Low2Symbol
Methods included from Low::Hparent
#hierarchy, #no_parent!, #scope
Constructor Details
This class inherits a constructor from HDLRuby::Low::RefRange
Instance Method Details
#assign(mode, value) ⇒ Object
Assigns +value+ the the reference.
1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1055 def assign(mode,value) # Compute the index range. rng = (self.range.first.execute(mode).to_i).. (self.range.last.execute(mode).to_i) # Assigns. self.ref.assign_at(mode,value,rng) end |
#assign_at(mode, value, index) ⇒ Object
Assigns +value+ at +index+ (integer or range).
1064 1065 1066 1067 1068 1069 1070 1071 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1064 def assign_at(mode,value,index) # Get the refered value. refv = self.execute(mode) # Assign to it. refv = refv.assign_at(mode,value,index) # Update the refered value. self.assign(mode,refv) end |
#execute(mode) ⇒ Object
Execute the expression.
1045 1046 1047 1048 1049 1050 1051 1052 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1045 def execute(mode) # Recurse on the children. tmpr = self.ref.execute(mode) rng = (self.range.first.execute(mode)).. (self.range.last.execute(mode)) # puts "tmpr=#{tmpr} rng=#{rng} tmpr[rng]=#{tmpr[rng]}" return tmpr[rng] end |
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
1040 1041 1042 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1040 def init_sim(systemT) self.ref.init_sim(systemT) end |
#to_low ⇒ Object
Converts the range reference to HDLRuby::Low.
3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 |
# File 'lib/HDLRuby/hruby_high.rb', line 3459 def to_low # return HDLRuby::Low::RefRange.new(self.type.to_low, # self.ref.to_low,self.range.to_low) refRangeL = HDLRuby::Low::RefRange.new(self.type.to_low, self.ref.to_low,self.range.to_low) # # For debugging: set the source high object # refRangeL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = refRangeL return refRangeL end |
#to_rcsim ⇒ Object
Generate the C description of the reference range.
931 932 933 934 935 936 937 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 931 def to_rcsim # Create the reference range C object. return RCSim.rcsim_make_refRange(self.type.to_rcsim, self.range.first.to_rcsim, self.range.last.to_rcsim, self.ref.to_rcsim) end |