Forum Discussion

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

problem

hello

i do a clock to 24 hours in vhdl. i am using cyclone 2. I do vhdl files, test them with model sim, after that the comipations goes on with warnings, but it do not work on the fpga ? why ? i can not understand

please help

13 Replies

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

    i do this design

    counter to 2 <- coutner to 10 <- counter to 6 <- counter to 10

    i want to make counter to 24 hours

    the counter to 24 works fine

    the counter to 60 works fine

    whne i connect the two counters it start to work not properly

    whne it reach 9 it jumps to 12 ... when it goest to 19 it jumps in 22

    when reach 29 i jump to 32

    can it be from derived clockes or it is somethin else

    how can i solve this problem ?

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

    --- Quote Start ---

    Use the 50Mhz clock. Never use derived clocks (unless you use a PLL)

    The template you should use for enabled registers is this:

    
    process(clk_50MHz, reset)
    begin
      if reset = '1' then
        --reset D
      elsif rising_edge(clk_50MHz) then
        if enable = '1' then --this can be things like "enable minute" or something
          q <= d;
        end if;
      end if;
    end process;
    

    --- Quote End ---

    but how can i do addition with enables ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    
    process(clk_50MHz, reset)
    begin
      if reset = '1' then
        --reset D
      elsif rising_edge(clk_50MHz) then
        if enable = '1' then --this can be things like "enable minute" or something
          q <= q + 1;
        end if;
      end if;
    end process;