Forum: FPGA, VHDL & Verilog Clock port and any other port of a register should not be driven by the same signal source

von Robert (Guest)

Rate this post
0 useful
not useful

I get this Warning from Altera Design Assistant for the below:

Clock port and any other port of a register should not be driven by the 
same signal source

Critical Warning (308012): Node 

I previously made some changes to this to meet Timing requirements. I 
tried driving just a '1' instead of driving the sys_clk to v_clk. But 
the timing requirements do not meet when I do so. Any suggestions?
USE IEEE.numeric_std.all;
USE IEEE.std_logic_1164.all;

ENTITY i_Soll_Skal IS

    ADC_Res       : INTEGER:=  4095; 
    ADC_Res_I    : INTEGER:= 9840;       

    sys_clk,reset   : IN STD_LOGIC;
    i_Sample_Clock  : IN STD_LOGIC;
    i_sollwert     : IN STD_LOGIC_VECTOR(13 downto 0);   -- Input Sollwert
    i_istwert    : IN STD_LOGIC_VECTOR(11 downto 0);    -- Input Istwert (IFact)    
    o_sollwert    : OUT STD_LOGIC_VECTOR(15 downto 0);   -- Scaled Sollwert 
    o_istwert    : OUT STD_LOGIC_VECTOR(15 downto 0);   -- Scaled Istwert 
    o_new_data     : OUT STD_LOGIC;                       -- Trigger to PID for new data

END ENTITY i_Soll_Skal;

ARCHITECTURE behaviour OF i_Soll_Skal IS

  --Typ: lpm_divide, 24/12 Bit (unsigned)
  COMPONENT lpm_divide_44_24_pip
    clock    : IN STD_LOGIC ;
    denom    : IN STD_LOGIC_VECTOR (23 DOWNTO 0);
    numer    : IN STD_LOGIC_VECTOR (43 DOWNTO 0);
    quotient  : OUT STD_LOGIC_VECTOR (43 DOWNTO 0)

  -- Signals  
  signal s_Div_N      : STD_LOGIC_VECTOR(43 DOWNTO 0);
  signal s_Div_D      : STD_LOGIC_VECTOR(23 DOWNTO 0);
  signal s_Div_Q      : STD_LOGIC_VECTOR(43 DOWNTO 0);
  signal s_clk      : STD_LOGIC;

div : lpm_divide_44_24_pip
     clock    => s_clk,
    denom    => s_Div_D,
    numer    => s_Div_N,
    quotient  => s_Div_Q
calc_wert : PROCESS(reset, sys_clk)
  variable v_Sample_Clock      : std_logic;
  variable v_sollwert        : unsigned(13 downto 0);
  variable v_actVal          : std_logic_vector(11 downto 0);
  variable v_numer          : unsigned(43 downto 0);
  variable v_denom          : unsigned(23 downto 0);
  variable v_startNewCalc      : std_logic;
  variable v_calc    : unsigned(1 DOWNTO 0);
  variable v_div_result      : std_logic_vector(35 downto 0);
  variable v_updateVal        : std_logic;
  variable v_clk                : std_logic;
  IF reset = '0' THEN
    -- Asynchronous reset
    v_Sample_Clock      := '0';
    v_actVal          := (others => '0');
    v_numer          := (others => '0');
    v_denom          := (others => '0');
    v_startNewCalc      := '0';
    v_calc    := (others => '0');
    v_div_result      := (others => '0');
    v_updateVal        := '0';
  ELSIF rising_edge(sys_clk) THEN    
    -- Update Istwert/IFact
    o_new_data      <= '0';
    IF i_Sample_Clock = '1' AND v_Sample_Clock = '0' THEN
        v_actVal        := i_istwert; 
        v_numer         := v_sollwert * (to_unsigned(ADC_Res,30));
        v_denom         := to_unsigned(ADC_Res_I,24);
        v_startNewCalc    := '1';
          v_clk             := sys_clk; -- '1';
    END IF;
    v_Sample_Clock  := i_Sample_Clock;
    IF v_updateVal = '1' THEN
      o_sollwert  <= "0000" & v_div_result(11 downto 0); 
      o_istwert  <= "0000" & v_actVal;            
      o_new_data  <= '1';                           
      v_updateVal  := '0';
    END IF;
    CASE v_calc IS 
       WHEN "01" =>  s_Div_D        <= std_logic_vector(v_denom);
                s_Div_N        <= std_logic_vector(v_numer);
                  s_clk             <= v_clk;    
      WHEN "10" =>  v_div_result    := s_Div_Q(35 downto 0);
                v_updateVal      := '1';
                v_calc  := "00";
                s_clk             <= v_clk;  
    IF v_startNewCalc = '1' OR v_calc /= "00" THEN
      v_calc  := v_calc + 1;
    END IF;
    v_startNewCalc  := '0';  
END PROCESS calc_wert;


von Achim S. (Guest)

Rate this post
0 useful
not useful
inside the FPGA a signal is either a standard logic signal or it is a 
clock. Compared to standard logic signals clocks run on own, separate 
CLK-lines in the FPGA and are driven by own, separate buffers. And 
clocks have a different function: they "trigger" a flip flop, while 
standard logic signals run through logic gates to deliver e.g. the 
data-input for the flip-flop.

Do not try, to derive clocks from logic signals - it won't work. If a 
signal should work as clock, it has to stem from a clock source (a 
clk-input or a PLL or ...), it must not stem from standard logic gates.

In your actual design you assign sys_clk to v_clk, then you assign v_clk 
to s_clk, and then you use s_clk to drive the clock-input of your 
divider. Skip the whole assignment chain: use sys_clk to drive the 
clock-input of your divider directly.

If your intention is, that the divider is only active in some cycles of 
sys_clk and is stall in other cycles of sys_clk, then redesign your 
divider so that it uses a Clock-Enable input and set it Clock Enable 
active only in the desired cycles of sys_clk.

von lcsdesigner (Guest)

Rate this post
0 useful
not useful
As said you are driving two destinations without a required clock Buffet

von Robert (Guest)

Rate this post
0 useful
not useful
Thank you. I altered the design directly assigning to the divider clock. 
It did not meet the timing requirements. But solved it finally.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.