Class: HDLRuby::High::Type

Inherits:
Low::Type
  • Object
show all
Includes:
Htype
Defined in:
lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rcsim.rb

Overview

Extends the Type class for hybrid Ruby-C simulation.

Direct Known Subclasses

TypeGen

Constant Summary collapse

High =
HDLRuby::High

Constants included from Low::Low2Symbol

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

Instance Attribute Summary collapse

Attributes inherited from Low::Type

#name

Attributes included from Low::Hparent

#parent

Instance Method Summary collapse

Methods included from Htype

#[], #binary, #comp_operator, #constant, #define_operator, #each_overload, #htype?, included, #inner, #inout, #input, #left, #name=, #output, #register, #right, #to_type, #typedef, #unary

Methods included from Tprocess

#&, #*, #+, #+@, #-@, #/, #<<, #==, #abs, #lr, #make, #resolve, #slice, #~

Methods inherited from Low::Type

#base, #base?, #boolean?, #break_types!, #direction, #each_type_deep, #eql?, #equivalent?, #fixed?, #float?, #hash, #hierarchical?, #leaf?, #max, #min, #range, #range?, #regular?, #set_name!, #signed?, #struct?, #to_c, #to_hdr, #to_high, #to_vector, #to_verilog, #to_vhdl, #types?, #unsigned?, #vector?, #width

Methods included from Low::Low2Symbol

#to_sym

Methods included from Low::Hparent

#hierarchy, #no_parent!, #scope

Methods included from Low::Ltype

included, #ltype?

Constructor Details

#initialize(name) ⇒ Type

Creates a new type named +name+.



1742
1743
1744
1745
# File 'lib/HDLRuby/hruby_high.rb', line 1742

def initialize(name)
    # Initialize the type structure.
    super(name)
end

Instance Attribute Details

#rctypeObject (readonly)

The access to the C version of the scope.



234
235
236
# File 'lib/HDLRuby/hruby_rcsim.rb', line 234

def rctype
  @rctype
end

Instance Method Details

#to_low(name = self.name) ⇒ Object

Converts the type to HDLRuby::Low and set its +name+.

NOTE: should be overridden by other type classes.



1750
1751
1752
1753
1754
1755
1756
1757
# File 'lib/HDLRuby/hruby_high.rb', line 1750

def to_low(name = self.name)
    # return HDLRuby::Low::Type.new(name)
    typeL = HDLRuby::Low::Type.new(name)
    # # For debugging: set the source high object 
    # typeL.properties[:low2high] = self.hdr_id
    # self.properties[:high2low] = typeL
    return typeL
end

#to_rcsimObject

Generate the C description of the type comming from object whose C description is +rcowner+. NOTE: +rcowner+ is not used here.



239
240
241
242
243
244
245
246
247
248
249
# File 'lib/HDLRuby/hruby_rcsim.rb', line 239

def to_rcsim
    # Create the type C object.
    if self.name == :bit || self.name == :unsigned then
        @rctype = RCSim.rcsim_get_type_bit()
    elsif self.name == :signed then
        @rctype = RCSim.rcsim_get_type_signed()
    else
        raise "Unknown type: #{self.name}"
    end
    return @rctype
end