Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20677 Discussions

wait statement inside process

Altera_Forum
Honored Contributor II
2,094 Views

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 much
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
379 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
379 Views

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.

0 Kudos
Altera_Forum
Honored Contributor II
379 Views

Have you included the std_logic_1164 library because that is where the rising_edge function is declared. 

 

use ieee.std_logic_1164.all;
0 Kudos
Altera_Forum
Honored Contributor II
379 Views

yup... i included that...  

 

library ieee; 

use ieee.std_logic_1164.all; 

 

was trying to figure this out for the past 2 days...
0 Kudos
Altera_Forum
Honored Contributor II
379 Views

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.

0 Kudos
Altera_Forum
Honored Contributor II
379 Views

thank you so much for yr help mate. good luck :)

0 Kudos
Altera_Forum
Honored Contributor II
379 Views

 

--- 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.
0 Kudos
Reply