Class: HDLRuby::High::Cast
- Inherits:
-
Low::Cast
- Object
- Low::Expression
- Low::Cast
- HDLRuby::High::Cast
- Includes:
- HExpression
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb
Overview
Describes a cast.
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::Cast
Attributes inherited from Low::Expression
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#execute(mode) ⇒ Object
Executes the expression.
-
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
-
#to_expr ⇒ Object
Converts to a new expression.
-
#to_low ⇒ Object
Converts the unary expression to HDLRuby::Low.
-
#to_rcsim ⇒ Object
Generate the C description of the cast.
Methods included from HExpression
#<=>, #[], #as, #coerce, #constant?, #inout, #input, #ljust, #lr, #ls, #match_type, #mux, orig_operator, #orig_operator, #output, #rjust, #rr, #rs, #sdownto, #seach, #sext, #stimes, #supto, #to_bit, #to_signed, #to_unsigned, #to_value, #to_value?, #zext
Methods inherited from Low::Cast
#boolean_in_assign2select, #casts_without_expression!, #clone, #each_deep, #each_node, #each_node_deep, #each_ref_deep, #eql?, #explicit_types, #hash, #immutable?, #initialize, #to_c, #to_hdr, #to_high, #to_verilog, #to_vhdl, #to_viz_node, #use_name?
Methods included from Low::OneChildMutable
#map_nodes!, #replace_expressions!, #set_child!
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::Cast
Instance Method Details
#execute(mode) ⇒ Object
Executes the expression.
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1063 def execute(mode) # puts "child=#{self.child}" # puts "child object=#{self.child.object}(#{self.child.object.name})" if self.child.is_a?(RefObject) # Shall we reverse the content of a concat. if self.child.is_a?(Concat) && self.type.direction != self.child.type.direction then # Yes, do it. res = self.child.execute(mode,:reverse) else res = self.child.execute(mode) end # puts "res=#{res}" # Cast it. res = res.cast(self.type,true) # Returns the result. return res end |
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
1057 1058 1059 1060 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1057 def init_sim(systemT) # Recurse on the child. self.child.init_sim(systemT) end |
#to_expr ⇒ Object
Converts to a new expression.
3276 3277 3278 |
# File 'lib/HDLRuby/hruby_high.rb', line 3276 def to_expr return Cast.new(self.type,self.child.to_expr) end |
#to_low ⇒ Object
Converts the unary expression to HDLRuby::Low.
3281 3282 3283 3284 3285 3286 3287 |
# File 'lib/HDLRuby/hruby_high.rb', line 3281 def to_low castL =HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low) # # For debugging: set the source high object # castL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = castL return castL end |
#to_rcsim ⇒ Object
Generate the C description of the cast.
933 934 935 936 937 938 939 940 941 942 943 944 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 933 def to_rcsim # puts "Cast to width=#{self.type.width} and child=#{self.child}" # Shall we reverse when casting? if self.type.direction != self.child.type.direction then # Yes, reverse the direction of the child. if self.child.type.respond_to?(:direction=) then self.child.type.direction = self.type.direction end end # Create the cast C object. return RCSim.rcsim_make_cast(self.type.to_rcsim,self.child.to_rcsim) end |