Method: HDLRuby::High::RefName#to_rcsim

Defined in:
lib/HDLRuby/hruby_rcsim.rb

#to_rcsimObject

Generate the C description of the reference range (not ref name!).



1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
# File 'lib/HDLRuby/hruby_rcsim.rb', line 1090

def to_rcsim
    # Convert the base to a bit vector.
    type_base = Bit[self.ref.type.width]
    # self.ref.parent = nil
    # bit_base = Cast.new(type_base,self.ref)
    bit_base = RCSim.rcsim_make_cast(type_base.to_rcsim,self.ref.to_rcsim)
    # Compute range in bits of the field.
    last = 0
    self.ref.type.each.detect do |name,typ|
        last += typ.width
        name == self.name
    end
    first = last-self.type.width
    last -= 1
    # puts "name=#{self.name} first=#{first} last=#{last}"
    type_int = Bit[type_base.width.width]
    return RCSim.rcsim_make_refRange(self.type.to_rcsim,
                                     Value.new(type_int,last).to_rcsim,
                                     Value.new(type_int,first).to_rcsim,
                                     bit_base)
end