Class: HDLRuby::High::Concat
- Inherits:
-
Low::Concat
- Object
- Low::Expression
- Low::Concat
- HDLRuby::High::Concat
- Includes:
- HExpression
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb
Overview
Describes a concatenation expression.
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::Expression
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#execute(mode, reverse = false) ⇒ Object
Execute 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 concatenation expression to HDLRuby::Low.
-
#to_rcsim ⇒ Object
Generate the C description of the concat operation.
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::Concat
#add_expression, #boolean_in_assign2select, #casts_without_expression!, #clone, #delete_expression!, #each_deep, #each_expression, #each_node_deep, #eql?, #explicit_types, #hash, #immutable?, #initialize, #map_expressions!, #to_c, #to_hdr, #to_high, #to_verilog, #to_vhdl, #use_name?
Methods included from Low::MutableConcat
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, #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::Concat
Instance Method Details
#execute(mode, reverse = false) ⇒ Object
Execute the expression.
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1174 def execute(mode, reverse=false) # Recurse on the children. tmpe = self.each_expression.map { |expr| expr.execute(mode) } # Ensure the order of the elements matches the type. if (self.type.direction == :little && !reverse) || (self.type.direction == :big && reverse) then tmpe.reverse! end # puts "concat result=#{Vprocess.concat(*tmpe).to_bstr}" # Concatenate the result. return Vprocess.concat(*tmpe) end |
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
1168 1169 1170 1171 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 1168 def init_sim(systemT) # Recurse on the children. self.each_expression { |expr| expr.init_sim(systemT) } end |
#to_expr ⇒ Object
Converts to a new expression.
3321 3322 3323 3324 3325 3326 3327 |
# File 'lib/HDLRuby/hruby_high.rb', line 3321 def to_expr return Concat.new(self.type, self.each_expression.map do |expr| expr.to_expr end ) end |
#to_low ⇒ Object
Converts the concatenation expression to HDLRuby::Low.
3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 |
# File 'lib/HDLRuby/hruby_high.rb', line 3330 def to_low # return HDLRuby::Low::Concat.new(self.type.to_low, # self.each_expression.map do |expr| # expr.to_low # end # ) i = 0 concatL = HDLRuby::Low::Concat.new(self.type.to_low, self.each_expression.map do |expr| expr.to_low end ) # # For debugging: set the source high object # concatL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = concatL return concatL end |
#to_rcsim ⇒ Object
Generate the C description of the concat operation.
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 1005 def to_rcsim # Create the concat C object. rcexpression = RCSim.rcsim_make_concat(self.type.to_rcsim, self.type.direction) # Add the concatenated expressions. */ if self.each_expression.any? then RCSim.rcsim_add_concat_expressions(rcexpression, self.each_expression.map(&:to_rcsim)) end return rcexpression end |