Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- Wrong, I am afraid. choose counter of 26 bits (to cover 50 million) and I will add extra bit for overflow protection. I prefer to use variable here so that the count is corrected before it is too late.
process(clk)
variable count : unsigned(26 downto 0) := (others => '0');
begin
if rising_edge(clk) then
if count > 50000000-1 then
count := count - 50000000;
else
count := count + 3579545;
end if;
my_clk <= std_logic(count(25));
end if;
end process;
--- Quote End --- goooooooooooooooooood