Class: HDLRuby::High::Select
- Inherits:
-
Low::Select
- Object
- Base::Expression
- Low::Expression
- Low::Operation
- Low::Select
- HDLRuby::High::Select
- Includes:
- HExpression
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb
Overview
Extends the Select 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 included from HExpression
Attributes inherited from Low::Select
Attributes inherited from Low::Operation
Attributes inherited from Low::Expression
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#execute(mode) ⇒ Object
Execute the expression.
-
#to_expr ⇒ Object
Converts to a new expression.
-
#to_low ⇒ Object
Converts the selection expression to HDLRuby::Low.
-
#to_rcsim ⇒ Object
Generate the C description of the select operation.
Methods included from HExpression
#[], #as, #coerce, #constant?, #inout, #input, #ljust, #lr, #ls, #match_type, #mux, orig_operator, #orig_operator, #output, #rjust, #rr, #rs, #sext, #to_bit, #to_unsigned, #to_value, #to_value?, #zext
Methods inherited from Low::Select
#add_choice, #boolean?, #boolean_in_assign2select, #casts_without_expression!, #clone, #delete_choice!, #each_choice, #each_deep, #each_node, #each_node_deep, #each_ref_deep, #eql?, #explicit_types, #get_choice, #hash, #immutable?, #initialize, #map_choices!, #map_nodes!, #replace_expressions!, #set_select!, #to_c, #to_hdr, #to_high, #to_verilog, #to_vhdl, #use_name?
Methods inherited from Low::Operation
#eql?, #explicit_types, #hash, #initialize, #set_operator!, #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::Select
Instance Method Details
#execute(mode) ⇒ Object
Execute the expression.
899 900 901 902 903 904 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 899 def execute(mode) # Recurse on the select. tmps = self.select.execute(mode) # Recurse on the selection result. return @choices[tmps.to_i].execute(mode) end |
#to_expr ⇒ Object
Converts to a new expression.
3163 3164 3165 3166 3167 3168 |
# File 'lib/HDLRuby/hruby_high.rb', line 3163 def to_expr return Select.new(self.type,"?",self.select.to_expr, *self.each_choice.map do |choice| choice.to_expr end) end |
#to_low ⇒ Object
Converts the selection expression to HDLRuby::Low.
3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 |
# File 'lib/HDLRuby/hruby_high.rb', line 3171 def to_low # return HDLRuby::Low::Select.new(self.type.to_low,"?", # self.select.to_low, # *self.each_choice.map do |choice| # choice.to_low # end) selectL = HDLRuby::Low::Select.new(self.type.to_low,"?", self.select.to_low, *self.each_choice.map do |choice| choice.to_low end) # # For debugging: set the source high object # selectL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = selectL return selectL end |
#to_rcsim ⇒ Object
Generate the C description of the select operation.
837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 837 def to_rcsim # Create the select C object. rcexpression = RCSim.rcsim_make_select(self.type.to_rcsim, self.select.to_rcsim) # Add the choice expressions. */ # self.each_choice do |choice| # rcsim_add_select_choice(rcexpression,choice.to_rcsim) # end RCSim.rcsim_add_select_choices(rcexpression, self.each_choice.map(&:to_rcsim)) return rcexpression end |