Class: CLKInfElm

Inherits:
InfElm show all
Defined in:
lib/tdl/elements/originclass.rb,
lib/tdl/elements/originclass.rb

Overview

clock_reset_taps

Direct Known Subclasses

TrackInf, VideoInf

Instance Attribute Summary collapse

Attributes inherited from InfElm

#dimension

Attributes inherited from BaseElm

#belong_to_module, #name

Instance Method Summary collapse

Methods inherited from InfElm

#[], #dimension_num, #draw, inherited, #inst_port, parse_ports, #port_length, same_name_socket, #signal, subclass

Methods inherited from BaseElm

#matrix, #name_copy, #path_refs, recfg_nc, #s, #signal

Methods included from TdlSpace::ExCreateTP

#root_ref

Methods included from AxiTdl::TestUnitTrack

#tracked_by_dve

Constructor Details

#initialize(clock: nil, reset: nil, dimension: [], freqM: nil) ⇒ CLKInfElm

Returns a new instance of CLKInfElm.



585
586
587
588
589
590
591
592
593
# File 'lib/tdl/elements/originclass.rb', line 585

def initialize(clock:nil,reset:nil,dimension:[],freqM:nil)
    # super(dimension:dimension,clock:clock,reset:reset,freqM:freqM)
    super(dimension:dimension)
    @clock = clock
    @reset = reset
    @origin_freqM = freqM
    check_freqM

end

Instance Attribute Details

#clockObject

Returns the value of attribute clock.



584
585
586
# File 'lib/tdl/elements/originclass.rb', line 584

def clock
  @clock
end

#origin_freqMObject

Returns the value of attribute origin_freqM.



584
585
586
# File 'lib/tdl/elements/originclass.rb', line 584

def origin_freqM
  @origin_freqM
end

#resetObject

Returns the value of attribute reset.



584
585
586
# File 'lib/tdl/elements/originclass.rb', line 584

def reset
  @reset
end

Instance Method Details

#check_freqMObject



628
629
630
631
632
633
634
# File 'lib/tdl/elements/originclass.rb', line 628

def check_freqM
    if @origin_freqM && @clock.is_a?(Clock)
        if @origin_freqM != @clock.freqM
            raise TdlError.new("Interface origin clock freqM[#{@origin_freqM}Mhz] dont eql CLOCK freqM[#{@clock.freqM}Mhz]")
        end
    end
end

#clock_reset_taps(def_clock_name, def_reset_name, self_clock, self_reset) ⇒ Object



652
653
654
655
656
657
658
659
660
661
662
# File 'lib/tdl/elements/originclass.rb', line 652

def clock_reset_taps(def_clock_name,def_reset_name,self_clock,self_reset)

    new_clk = belong_to_module.logic.clock(self.FreqM) - def_clock_name
    new_reset = belong_to_module.logic.reset('low') - def_reset_name

    belong_to_module.Assign do 
        new_clk <= self_clock 
        new_reset <= self_reset
    end 
    [new_clk,new_reset]
end

#freq_align_signalObject



615
616
617
618
619
620
621
622
# File 'lib/tdl/elements/originclass.rb', line 615

def freq_align_signal
    data = freqM
    if data
        align_signal(data)
    else
        align_signal( 1.11 )
    end
end

#freqMObject



595
596
597
598
599
600
601
602
603
# File 'lib/tdl/elements/originclass.rb', line 595

def freqM
    if @clock.is_a?(Clock)
        @clock.freqM
    elsif @origin_freqM
        @origin_freqM
    else
        nil
    end
end

#FreqMObject



624
625
626
# File 'lib/tdl/elements/originclass.rb', line 624

def FreqM()
    "#{@name}.FreqM".to_nq
end

#intf_def_freqMObject



605
606
607
608
609
610
611
612
613
# File 'lib/tdl/elements/originclass.rb', line 605

def intf_def_freqM
    if @clock.is_a?(Clock)
        @clock.freqM
    elsif @origin_freqM
        @origin_freqM
    else
        1.11
    end
end

#use_which_freq_when_copy(argv_clock, argv_origin) ⇒ Object



636
637
638
639
640
641
642
643
644
645
646
# File 'lib/tdl/elements/originclass.rb', line 636

def use_which_freq_when_copy(argv_clock,argv_origin)
    if argv_clock == @clock && @clock
        @origin_freqM
    elsif argv_clock != @clock && argv_clock.is_a?(Clock)
        argv_clock.freqM
    elsif !(argv_clock.is_a?(Clock)) && argv_origin
        argv_origin
    else
        nil
    end
end