Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wait for statement inside a process

Status
Not open for further replies.

carbon9

Technical User
May 19, 2008
1
TR
Hi all,

I've trying to simulate a simple state machine with VHDL code below:

Code:
library ieee;
use ieee.std_logic_1164.all;

entity p82 is

	port(a, c, clk, rst: in std_logic;
		 x: out std_logic);
end p82;

architecture behavior of p82 is
		
type state is (stateA, stateB);
signal pr_state, nx_state: state;

begin

-----Lower Section--------

	process(rst, clk)
	begin
		if(rst='1') then
			pr_state<=stateA;
		elsif(clk'event and clk='1') then
			pr_state<=nx_state;
		end if;
	end process;

---Upper Section----------

	process(a, c, pr_state)
	begin
		
		case pr_state is
			
			when stateA =>
				x<=a;
				wait for 10ns;-->ERROR
				x<=c;
				nx_state<=stateB;
							
			when stateB =>
				x<=c;
				wait for 10ns;--->ERROR
				x<=a;
				nx_state<=stateA;
		
		end case;
	
	end process;

end behavior;

But, the compiler gives error: "A wait statement is illegal for a process with a sensitivity list." But I need to make delays on those points. How can I solve this problem?

Regards
 
Hi,
You can't use the "wait for" in state machine design.
For making delays, you can define the new states. The number of new states depend on your clock frequency. For example, if your frequency is 10ns , you need one new state for delay 10ns.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top