Altera_Forum
Honored Contributor
11 years agoClocked process triggered by pulse signal (VHDL question)
What I would like to do is to execute a clocked process whenever the rising edge of a pulse arrives. Here is my code:
process (pulse, clk)
variable newTrigger: std_logic:='0';
variable cnt: integer range -1 to 32;
begin
if rising_edge(pulse) then
newTrigger:='1';
end if;
if newTrigger='1' then
newTrigger:='0';
cnt:=32;
elsif rising_edge(clk) then
if cnt<0 then
blahblah
else
cnt:=cnt-1;
blahblah
end if;
end process;
I heard that there should be only one clock for one process, but my code seemed to have two clocks. Is my above code OK to work in hardware? If no, is there any other method to achieve what I need? Thanks guys.