Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Frequency Divider Timing Req. Never Met

I am trying to make a freq. divider and tried many VHDL solutions on the web. Most of them worked but TimeQuest always tells timing requirements did not met. Here is one code that worked with a worst case setup slack of -5.547:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
--
entity freq_div is
    port(     clkin : in std_logic;
            reset : in std_logic;
            clkout: out std_logic);
end entity;
--
architecture main of freq_div is
--
--
signal cnt0 : unsigned(4 downto 0);
--
begin
    --
    process(clkin,reset)
    --
    begin
        if reset='0' then
            cnt0 <= "00000";
        elsif clkin'event and clkin='1' then
            if cnt0 = "10000" then
                cnt0 <= "00000";
            else 
                cnt0 <= cnt0 + 1;
            end if;        
        end if;
    end process;
    --
    --
    --
    clkout <= cnt0(4);
    --
end architecture;
Could you tell me what am I missing? By the way clkin is output of a PLL with ratio of 1/5000. I need this extra divider to reach lower frequencies PLL doesn't allow.

13 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Do you see the timing violation inside the clock divider? I would rather expect it in domain crossing assignment from clkin to clkout.

    If so, it won't show a problem of the clock divider itself rather than of how to use divided clocks in a design.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Why doesn't it fail? When you launch TimeQuest and right click on the failing domain and do report_timing with detail set to full_path, what does it look like? What's the setup relationship?

    You're clock rate is probably already really slow. This circuit should run really fast. So it should work, but something in the constraints, layout, etc. is not correct. You need to debug the timing report since it gives all of that information.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Forgot to mention setup slack of -5.547 belongs to cnt0(4).