Forum Discussion
Altera_Forum
Honored Contributor
11 years agoThere are a few changes I would recommend.
First - I highly suggest you do not use the button as a clock. It will be very bouncy and generate a lot of edges, as well as having timing issues. You need to synchronise the button press into the clock domain and then detect the edge (using an edge detector, not a rising edge VHDL statement). Secondly, your process in the delay_jen entity is not a clocked process. Just including the clock in the sensitivity list does not make it a clocked process. You need to follow the template. I also suggest you forget about variables for now - they will only get you in to trouble. Use signals instead.
signal count : integer;
process(clk)
begin
if rising_edge(clk) then
if (en) then
flag<='1';
count <= count+1;
if (count=delay) then
count:=0;
flag<='0';
end if;
end if;
end if
end process;