S
Steve
Guest
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,
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,