class TdlSpace::DefEleBaseArrayChain

只能用于接口,dimension 和 DSIZE 并不共享空间

Attributes

modport_type[RW]

DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset

tclass[RW]

DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset

Public Class Methods

new(hash) click to toggle source
Calls superclass method
# File lib/tdl/rebuild_ele/ele_base.rb, line 697
def initialize(hash)
    super(hash[:belong_to_module])
    # @dsize = dsize
    # @freqM = freqM
    # @clock = clock
    # @reset = reset
    @origin_hash = hash
    if hash[:dsize] && hash[:dsize].instance_of?(String)
        raise TdlError.new("DSIZE<#{hash[:dsize]}> Cant be String")
    end
end

Public Instance Methods

-(xname) click to toggle source
# File lib/tdl/rebuild_ele/ele_base.rb, line 724
def - (xname)
    unless xname.is_a? Symbol
        name = to_inp(xname)
    else 
        name = to_inp(xname.to_s)
    end
    # belong_to_module.Def.datainf_c(name: name ,clock: clock||@clock,reset: reset||@reset ,dsize: dsize||@dsize ,dimension: @chain,freqM:freqM||@freqM)
    if @chain.length > 0
        dimension = @chain[0,@chain.length]
        @origin_hash[:dimension] = dimension
    end
    
    int = tclass.new(@origin_hash[:belong_to_module])
    int.inst_name = name
    int.dimension = @chian 
    if modport_type
        int.modport_type = modport_type
    end
    @origin_hash.each do |k,v| 
        ##
        if int.respond_to? k 
            int.public_send("#{k}=",v)
        end
    end

    if @belong_to_module.respond_to?(name) 
        raise   TdlError.new("Cant redefine #{name} !!! ")
    end

    if name.to_s.strip.empty? 
        raise   TdlError.new("Name Cant empty !!! ")
    end

    ## 给sdlmodule添加直接调用 方法
    @belong_to_module.define_singleton_method(name) { int }

    StringBandItegration.add_method_to_itgt(name,int)
    return int

end
[](*a) click to toggle source
# File lib/tdl/rebuild_ele/ele_base.rb, line 709
def [](*a)
    if a[0].is_a? Range
        a = a.to_a 
    end

    if a.empty?
        raise TdlError.new("参数不能为空")
    end
    new_dla = self.class.new(@origin_hash)
    new_dla.chain = @chain + a
    new_dla.tclass = self.tclass
    new_dla.modport_type = modport_type
    new_dla
end