Class: BaseElm

Inherits:
AxiTdl::SdlModuleActiveBaseElm show all
Includes:
TdlSpace::ExCreateTP
Defined in:
lib/tdl/exlib/test_point.rb,
lib/tdl/elements/originclass.rb,
lib/tdl/class_hdl/hdl_redefine_opertor.rb

Direct Known Subclasses

CommCfgReg, InfElm, MailBox, Parameter, SignalElm

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TdlSpace::ExCreateTP

#root_ref

Methods included from AxiTdl::TestUnitTrack

#tracked_by_dve

Instance Attribute Details

#belong_to_moduleObject

attr_accessor :belong_module



80
81
82
# File 'lib/tdl/elements/originclass.rb', line 80

def belong_to_module
  @belong_to_module
end

#nameObject

Returns the value of attribute name.



81
82
83
# File 'lib/tdl/elements/originclass.rb', line 81

def name
  @name
end

Class Method Details

.recfg_nc(new_nc) ⇒ Object

def signal

@name.to_s

end



118
119
120
121
122
123
124
# File 'lib/tdl/elements/originclass.rb', line 118

def self.recfg_nc(new_nc)
    new_nc.instance_variable_set("@_id",0)
    new_nc.define_singleton_method(:signal) do
        id = new_nc.instance_variable_get("@_id")
        new_nc.instance_variable_set("@_id",id+1).to_s
    end
end

Instance Method Details

#matrix(*indexs) ⇒ Object



105
106
107
108
109
110
111
112
# File 'lib/tdl/elements/originclass.rb', line 105

def matrix(*indexs)
    with_new_align(0) do
        str = indexs.map do |i|
            "[#{align_signal(i,q_mark=false)}]"
        end.join("")
        NqString.new("#{@name.to_s}#{str}")
    end
end

#name_copy(nstr) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/tdl/elements/originclass.rb', line 126

def name_copy(nstr)
    if nstr.is_a?(StringBandItegration) && true
        return nstr
    else
        if nstr.to_s.eql?(@name.to_s)
            @copy_id ||= 0
            str = "#{nstr.to_s}_copy_#{@copy_id}"
            @copy_id += 1
            str
        else
            nstr.to_s
        end
    end
end

#path_refs(&block) ⇒ Object

获取信号的绝对路径



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/tdl/exlib/test_point.rb', line 141

def path_refs(&block)
    collects = []
    if @belong_to_module != TopModule.current.techbench
        @belong_to_module.parents_inst_tree do |tree|
            ll = ["$root"]
            rt = tree.reverse
            rt.each_index do |index|
                if rt[index].respond_to? :module_name
                    ll << rt[index].module_name 
                else 
                    ll << rt[index].inst_name
                end
            end
            ll << @name
            new_name = ll.join('.').to_nq
            if block_given?
                if yield(new_name)
                    collects << new_name
                end 
            else
                collects << new_name
            end
        end
    else
        collects = ["$root.#{@belong_to_module.module_name}.#{@name}".to_nq]
    end
    collects
end

#s(index = nil) ⇒ Object

def initialize

@belong_module =


85
86
87
# File 'lib/tdl/elements/originclass.rb', line 85

def s(index=nil)
    signal
end

#signal(index = nil) ⇒ Object

重覆盖掉



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/tdl/class_hdl/hdl_redefine_opertor.rb', line 552

def signal(index=nil)
    RedefOpertor.with_normal_operators do
        with_new_align(0) do
            unless index
                NqString.new(@name.to_s)
            else
                unless index.is_a? String
                    NqString.new("#{@name.to_s}[#{align_signal(index)}]")
                else
                    NqString.new("#{@name.to_s}[#{index.strip}]")
                end
            end
        end
    end
end