- Joined
- Oct 2, 2009
- Messages
- 19
- Reaction score
- 0
Hi,
im trying to create counter where it counts the number of cycles upon receiving the first signal, stops the count on receiving the second one, stores the counts between the two signals and resets the counter immediately after the second sig'event.
i have something like this and i know for sure that it's not the right code:
process (clk, reset, sig)
begin
wait on sig'event and sig = '1';
if (reset = '1') then
count(15 downto 0) <= "0000000000000000";
elsif (clk'event and clk = '1') then
count <= count + 1;
end if;
end process;
process (sig, t)
begin
for i in 1 to 8 loop
if sig’event and sig = ‘1’ then
t(i) <= sig'last_event; reset = '1';
end if;
end loop;
end process;
what bugs me is the 'last_event attribute. so if t = 0, and t1 = n, sig'last_event is n? how does this differ from 'last_active?
i know how to set the counter going, but i have no idea how to stop it. any hints/ideas? thanks!
im trying to create counter where it counts the number of cycles upon receiving the first signal, stops the count on receiving the second one, stores the counts between the two signals and resets the counter immediately after the second sig'event.
i have something like this and i know for sure that it's not the right code:
process (clk, reset, sig)
begin
wait on sig'event and sig = '1';
if (reset = '1') then
count(15 downto 0) <= "0000000000000000";
elsif (clk'event and clk = '1') then
count <= count + 1;
end if;
end process;
process (sig, t)
begin
for i in 1 to 8 loop
if sig’event and sig = ‘1’ then
t(i) <= sig'last_event; reset = '1';
end if;
end loop;
end process;
what bugs me is the 'last_event attribute. so if t = 0, and t1 = n, sig'last_event is n? how does this differ from 'last_active?
i know how to set the counter going, but i have no idea how to stop it. any hints/ideas? thanks!