process( Clk_50MHz)
variable Count20: integer range 0 to 20000000;
begin
if Rising_edge( Clk_50MHz) then
if Count20>1 then
Clk_2p5Hz <= '0';
Count20 := Count20-1;
else
Clk_2p5Hz <= '1';
Count20 := 20000000;
end if;
end if;
end process;
variable Count20: integer range 0 to 20000000;
if Count20>1 then
Clk_2p5Hz <= '0';
Count20 := Count20-1;
else
Clk_2p5Hz <= '1';
Count20 := 20000000;
end if;
entity clock is
port
(
clk: in std_logic;
clok_o: buffer std_logic
);
end clock;
architecture Desc of clock is
begin
process(clk)
variable count: integer range 0 to 20000000;
begin
if (clk'event and clk='1') then
count:=count+1;
if(count>=20000000) then
clk_o<=not clk_o;
count:=0;
end if;
end if;
end process;
end Desc;
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.