Dividing a clock

S

Steve

Hi,

I want to divide a clock by 24. To be exact I want to generate a 4MHz clock
from a 96MHZ clock.

To do this I've used the following code. My question is, is this the best
way of doing it?

divide : process(RESET, CLK_96)
variable edge_count : integer range 0 to 11;
begin
if RESET = '0' then
clk_4 <= '1';
edge_count := 0;
elsif CLK_96'event and CLK_96 = '1' then
if edge_count = 11 then
clk_4 <= not clk_4;
edge_count := 0;
else
edge_count := edge_count + 1;
end if;
end if;
end process divide;

Thanks for any advice,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top