Forum Discussion
Altera_Forum
Honored Contributor
16 years agoproblem
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 help13 Replies
- Altera_Forum
Honored 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; - Altera_Forum
Honored 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:
--- Quote End --- but how can i do addition with enables ?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; - Altera_Forum
Honored 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
Honored Contributor
The derrived clock wont arrive at each register at the same time.
- Altera_Forum
Honored Contributor
what should i understand for "large skews"
- Altera_Forum
Honored Contributor
Using normal FPGA logic to create clock signals (ie,clock dividers and clock gates) creates timming problems because those clocks signals often end up with large skews.
- Altera_Forum
Honored Contributor
why i can not use derived clock ?
- Altera_Forum
Honored Contributor
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; - Altera_Forum
Honored Contributor
so you tell me that i have a single clock ? how can i reach this ?
when 1 min goes the eneable of the counter to 10 min should be on for 1 pulse of the shared single clock ? i am not sure that is your idea ... the fpga module takes 50 mhz clock input - is this the shared clock that i should use or devided clock with T with 1 sec is it good idea to use frequency devidor to reach 1 second T or i shoud use enable ? - Altera_Forum
Honored Contributor
Here is your big problem - you are generating a load of clocks in logic. Dont do that. Generate enable signals instead and run ALL registers from the system clock "clk".
also, your derived clocks look at falling edge, and other clocks look for rising edge. Convention is to have all clocks work on the rising edge. For a clock deisgn, you seem to have made it very complicated.