Forum Discussion
Altera_Forum
Honored Contributor
17 years agowait statement inside process
Hi all,
I faced some problem when I trying to compile my following code. The error replied was only one wait statement is allowed in the process. I have tried putting IF statement but it took 10,000 iterations. May I know how can i change my code? Main : process variable counter : counter_type := 0; begin -- HWY green, SRD red wait on (CLOCK until CLOCK = '1' and SRDcar = '1'); if (HWYcar = '1') then Counter := 0; loop wait until CLOCK = '1'; exit when (HWYcar = '0' or Counter = long_cycle); Counter := Counter + 1; end loop; end if ; Thank you so much7 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I'm very very new this software. --- Quote End --- You might benefit from references suggested at http://www.alteraforum.com/forum/showthread.php?t=1025. Start with the coding style guidelines in the Quartus handbook and the examples in the Quartus text editor templates. - Altera_Forum
Honored Contributor
thank you so much for yr help mate. good luck :)
- Altera_Forum
Honored Contributor
You can replace "if rising_edge(CLOCK) then" with "if CLOCK'event and CLOCK = '1' then" or you open the std_logic_1164 library and check that the rising_edge function is in there.
- Altera_Forum
Honored Contributor
yup... i included that...
library ieee; use ieee.std_logic_1164.all; was trying to figure this out for the past 2 days... - Altera_Forum
Honored Contributor
Have you included the std_logic_1164 library because that is where the rising_edge function is declared.
use ieee.std_logic_1164.all; - Altera_Forum
Honored Contributor
thank you ben. but the error return now is rising_edge is used but not declared. sorry for bothering. I'm very very new this software.
- Altera_Forum
Honored Contributor
Main : process
variable counter : counter_type := 0; begin if rising_edge(CLOCK) then if SRDcar = '1' then if HWYcar = '1' then counter := 0; elsif counter = long_cycle then null; else counter := counter + 1; end if; end if; end if; end process; I think this should be something like what you want. Ben