Class: TdlSpace::DefPortEleBaseArrayChain

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/rebuild_ele/ele_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(ele_class, sdlmodule) ⇒ DefPortEleBaseArrayChain

Returns a new instance of DefPortEleBaseArrayChain.



793
794
795
796
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 793

def initialize(ele_class,sdlmodule)
    @ele_class = ele_class
    @sdlmodule = sdlmodule
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 798

def method_missing(name,*args,&block)
    ## 检查有没有 modports
    modports = @ele_class.get_class_var('interface_modports') || []
    if !( modports.include?(name.to_sym) || modports.map{ |e| e.to_s }.include?(name.to_s) )
        raise TdlError.new("#{@ele_class.get_class_var('hdl_name')} dont have modport #{name}")
    end

    hash = args[0] || {}
    hash[:belong_to_module] = @sdlmodule
    rel = TdlSpace::DefEleBaseArrayChain.new(hash)
    rel.tclass = @ele_class
    rel.modport_type = name
    return rel

end