Class: HDLRuby::High::Select

Inherits:
Low::Select show all
Includes:
HExpression
Defined in:
lib/HDLRuby/hruby_high.rb

Overview

Describes a section operation (generalization of the ternary operator).

NOTE: choice is using the value of +select+ as an index.

Constant Summary

Constants included from Low::Low2Symbol

Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable

Instance Attribute Summary

Attributes included from HExpression

#systemT, #type

Attributes inherited from Low::Select

#select

Attributes inherited from Low::Operation

#operator

Attributes inherited from Low::Expression

#type

Attributes included from Low::Hparent

#parent

Instance Method Summary collapse

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

#to_sym

Methods included from Low::Hparent

#hierarchy, #scope

Constructor Details

This class inherits a constructor from HDLRuby::Low::Select

Instance Method Details

#to_exprObject

Converts to a new expression.



2872
2873
2874
2875
2876
2877
# File 'lib/HDLRuby/hruby_high.rb', line 2872

def to_expr
    return Select.new(self.type,"?",self.select.to_expr,
    *self.each_choice.map do |choice|
        choice.to_expr
    end)
end

#to_lowObject

Converts the selection expression to HDLRuby::Low.



2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
# File 'lib/HDLRuby/hruby_high.rb', line 2880

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