Module: BaseFunc

Included in:
Axi4, AxiLite, AxiStream, CommonCFGReg, DataInf, DataInf_C, TrackInf, VideoInf
Defined in:
lib/tdl/basefunc.rb

Instance Method Summary collapse

Instance Method Details

#check_same(m, *a) ⇒ Object



242
243
244
245
246
247
248
249
250
251
252
# File 'lib/tdl/basefunc.rb', line 242

def check_same(m,*a)
    return nil unless a

    tmp = a[0].send(m)

    a.each do |e|
        if tmp != e.send(m)
            raise TdlError.new("#{e.signal} m.to_s ERROR")
        end
    end
end

#check_same_class(cl, *c) ⇒ Object

Raises:



255
256
257
258
# File 'lib/tdl/basefunc.rb', line 255

def check_same_class(cl,*c)
    raise TdlError.new("#{c[0].signal} Wrong Class") unless c[0].is_a?  cl
    check_same(:class,c)
end

#check_same_clock(*c) ⇒ Object



230
231
232
233
234
235
236
237
238
239
240
# File 'lib/tdl/basefunc.rb', line 230

def check_same_clock(*c)
    return nil unless c

    clock = c[0].clock

    c.each do |e|
        if clock != e.clock
            raise TdlError.new("#{e.signal} clock ERROR")
        end
    end
end

#check_same_dsize(*a) ⇒ Object

def to_s

signal

end

def length

signal.length

end



218
219
220
221
222
223
224
225
226
227
228
# File 'lib/tdl/basefunc.rb', line 218

def check_same_dsize(*a)
    return nil unless a

    dsize = a[0].dsize

    a.each do |e|
        if dsize != e.dsize
            raise TdlError.new("#{e.signal} DSIZE ERROR")
        end
    end
end