chensx2012
Newbie level 3
- Joined
- Apr 16, 2015
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 25
What I would like to do is to execute a clocked process whenever the rising edge of a pulse arrives. Here is my code:
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.
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.