The error message appears to be complaining that you are using the output of the cnt
counter as a clock.
Instead you could use it as a toggle enable and clk
as the clock:
--process (clock, btn)
process (clk, btn)
begin
-- if btn = '0' then
if btn = '1' then -- reset led
led <= '0'; -- or '1' which ever turns it off
-- if clock'event and clock = '1' then
elsif clock = '1' and rising_edge(clk) then -- clock as enable
-- led <= '1';
led <= not led;
-- else
-- led <= '0';
end if;
-- end if;
end process;
The state of btn
made a convenient reset to provide an initial value for led
to be able to use not led
. This either requires the port signal led
be made mode inout
or you need a proxy variable or signal which is assigned to led so the not led
works (so led
can be read). A default value for cnt
would also help simulation.
I cheated and made your counter cnt
shorter and set the clock to 4 MHz to illustrate:
The simulation was done using ghdl and gtkwave.