A difference between VHDL sources working

T

toomuch

Hi

Can someone tell me if there is a defference between the following two VHDL
sources working:
1.
process

begin

wait until C'event and C='1';

if B='0' then

Q<=B;

else

Q<= A;

end if;

end process;



2.

process

begin

if B='0' then

wait until C'event and C='1';

Q<=B;

else

wait until C'event and C='1';

Q<=A;

end if;

end process;


Simulation of this two processes gives different results. Does anybody know
why? Is there a specification discussing those cases?

Thanks for any help
 
M

Marcin

Hi,

1. You wait for rising edge on C, then sample the B signal and decide
whether to assign A or B to Q.
2. The value of B is examined at the beginning of process execution
and you choose one of the if-else branch immediately. After that you
only wait for rising edge on C to assign a value to Q.


The first will synthesize to simple flip-flop with synchronous reset
the second will synthesize to something more complex which probably is
not what you want.

Marcin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top