Class: HDLRuby::High::TypeStruct

Inherits:
Low::TypeStruct show all
Includes:
Htype
Defined in:
lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb

Overview

Extends the TypeStruct class for hybrid Ruby-C simulation.

Constant Summary collapse

High =
HDLRuby::High

Constants included from Low::Low2Symbol

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

Instance Attribute Summary

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::TypeStruct

#break_types!, #delete_type!, #each, #each_name, #each_type, #each_type_deep, #eql?, #equivalent?, #get_all_types, #get_type, #hash, #initialize, #map_types!, #struct?, #to_c, #to_hdr, #to_high, #to_vhdl, #types?, #width

Methods included from Low::Ltype

included, #ltype?

Methods inherited from Low::Type

#base, #base?, #boolean?, #break_types!, #direction, #each_type_deep, #eql?, #equivalent?, #fixed?, #float?, #hash, #hierarchical?, #initialize, #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

Constructor Details

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

Instance Method Details

#direction=(dir) ⇒ Object

Add the possibility to change the direction.



358
359
360
# File 'lib/HDLRuby/hruby_rsim.rb', line 358

def direction=(dir)
    @direction = dir == :little ? :little : :big
end

#to_low(name = self.name) ⇒ Object

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



2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
# File 'lib/HDLRuby/hruby_high.rb', line 2074

def to_low(name = self.name)
    # return HDLRuby::Low::TypeStruct.new(name,self.direction,
    #                     @types.map { |name,type| [name,type.to_low] } )
    typeStructL = HDLRuby::Low::TypeStruct.new(name,self.direction,
                        @types.map { |name,type| [name,type.to_low] } )
    # # For debugging: set the source high object 
    # typeStructL.properties[:low2high] = self.hdr_id
    # self.properties[:high2low] = typeStructL
    return typeStructL
end

#to_rcsimObject

Generate the C description of the type.



307
308
309
310
311
# File 'lib/HDLRuby/hruby_rcsim.rb', line 307

def to_rcsim
    # @rctype = self.to_vector.to_rcsim
    @rctype = RCSim.rcsim_get_type_vector(Bit.to_rcsim,self.width)
    return @rctype
end