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

#create_tp, #root_ref

Constructor Details

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

Returns a new instance of CLKInfElm.



610
611
612
613
614
615
616
617
618
# File 'lib/tdl/elements/originclass.rb', line 610

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.



609
610
611
# File 'lib/tdl/elements/originclass.rb', line 609

def clock
  @clock
end

#origin_freqMObject

Returns the value of attribute origin_freqM.



609
610
611
# File 'lib/tdl/elements/originclass.rb', line 609

def origin_freqM
  @origin_freqM
end

#resetObject

Returns the value of attribute reset.



609
610
611
# File 'lib/tdl/elements/originclass.rb', line 609

def reset
  @reset
end

Instance Method Details

#check_freqMObject



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

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



677
678
679
680
681
682
683
684
685
686
687
# File 'lib/tdl/elements/originclass.rb', line 677

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



640
641
642
643
644
645
646
647
# File 'lib/tdl/elements/originclass.rb', line 640

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

#freqMObject



620
621
622
623
624
625
626
627
628
# File 'lib/tdl/elements/originclass.rb', line 620

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

#FreqMObject



649
650
651
# File 'lib/tdl/elements/originclass.rb', line 649

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

#intf_def_freqMObject



630
631
632
633
634
635
636
637
638
# File 'lib/tdl/elements/originclass.rb', line 630

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



661
662
663
664
665
666
667
668
669
670
671
# File 'lib/tdl/elements/originclass.rb', line 661

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