Forum Discussion
Altera_Forum
Honored Contributor
16 years ago --- Quote Start --- Thank you very much that very quick reply FvM. So only the first CASE statement that 'matches' will be excuted and the assignenments will happen after the process? Is this only for signals or variables also? What is I compare the state of a variable (is it possible?), instead of a signal.. in that case I think the value will be updates instantly.. so does it mean the CASE statements will be executed one after other in a signal clock? Thank you. --- Quote End --- The important point with case is that only 1 case ever matches because each case has to be mutually exclusive. Whether it's a variable or signal is irrelavent. The important point is that the process is sensitive to clk only, so the whole process (and hence the case statement) is only executed on a rising edge of the clock, never between clock edges, so the case statement is only executed once. The signals are updated when the process ends and the variables are updated immediatly. If on the other hand the process was sensitive to state, you'd get yourself in an infinite loop:
process(state)
begin
case state is
when state_a =>
state <= state_b;
when state_b =>
state <= state_a;
end case;
end process;
With this process, because the process is triggered every time state changes, you're going to be swapping state once per delta cycle, and a simulator would halt after it hits it's iteration limit.