class ClassHDL::ImplicitInstModule

Public Class Methods

new(name,sdlm) click to toggle source
# File lib/tdl/class_hdl/hdl_module_def.rb, line 70
def initialize(name,sdlm)
    @name = name
    @sdlm = sdlm
    unless SdlModule.exist_module?(@name)
        raise TdlError.new("Cant find module `#{name}` !!!")
    end
end

Public Instance Methods

inst(dname,&block) click to toggle source
# File lib/tdl/class_hdl/hdl_module_def.rb, line 78
def inst(dname,&block)
    if dname !~ /\w+/
        raise TdlError.new("#{@name} cont instance name #{dname}")
    end

    ## 有必要加一级封装代理
    if $_implicit_curr_itgt_.slast 
        @sdlm.Itgt_Instance(@name,dname.to_s.to_inp,&block)
    else 
        @sdlm.Instance(@name,dname.to_s,&block)
    end
end
method_missing(dname,*args,&block) click to toggle source
# File lib/tdl/class_hdl/hdl_module_def.rb, line 91
def method_missing(dname,*args,&block)
    # if dname !~ /\w+/
    #     raise TDLError.new("#{@name} cont instance name #{dname}")
    # end

    # if $_implicit_curr_itgt_.last
    #     @sdlm.Itgt_Instance(@name,dname.to_s.to_inp,&block)
    # else
    #     @sdlm.Instance(@name,dname.to_s,&block)
    # end
    rel = nil
    AssignDefOpertor.with_rollback_opertors(:old) do 
        if block_given?
            rel = inst(dname,&block)
        else
            ## 当没有block 判断 sdlm是否相应方法
            # if @sdlm.has_signal?(dname)
            # if SdlModule.call_module(@name).has_signal?(dname)
            if SdlModule.call_module(@name).respond_to?(dname)
                rel =  SdlModule.call_module(@name).signal(dname)
            else 
                # super
                raise TdlError.new( "Cant find signal `#{dname}` in module `#{@name}` path: #{SdlModule.call_module(@name).real_sv_path } !!!" )
            end
        end
    end
    return rel
end