Walk through the activations of the process following a change in
S from 0 to 1. Compare with the flow of signals in time through the logic diagram.y <= (not(s) and A) or (S and B); is far more compact. However, as we proceed we’ll gradually approach situations where we can see the superiority of concurrent process models.architecture gatelevel of mux2to1 is
signal asn, bs: std_logic; -- intermediate nets
begin
process(A, B, S, asn, bs)
begin
asn <= not(S) and A; -- 1
bs <= S and B; -- 2
y <= asn or bs; -- 3
end process;
end gatelevel;
A port changes value. The following cascade of events and process activations ensues:A activates the process. The three statements are evaluated, in order, using the values that are in effect at the time of activation. In Statement 1, a new value for asn is scheduled, but not assigned. In Statement 2, the scheduled value of bs is unchanged, because neither S nor B changed. In Statement 3, the scheduled value of y is also unchanged, because the new value of asn has not yet been assigned, only scheduled. Statement 3 is still working with the old values.asn receives its new value. The process then suspends, pending a new event.asn changed, there is an event, and the process activates. The three statements are evaluated, in order, using the current values. This time, y will receive a new scheduled value.y is updated with the new value of A. If you compare this with the logic diagram, Figure 5.3.3, you will see that it matches the way one gate drives another.S from 0 to 1. Compare with the flow of signals in time through the logic diagram.y = a;
y = b;
y change twice. First, y would take the value of a, then it would take the value of b. In VHDL, if you wrote an architecture like this:architecture gatelevel of foo is
begin
y <= a;
y <= b;
end gatelevel;
y would concurrently be assigned a and b. This is a “multiple driver error”, like wiring two gate outputs to the same gate input. On the other hand, if these statements are placed inside a process,architecture gatelevel of foo is
begin
process(a,b)
begin
y <= a; -- 1
y <= b; -- 2
end process;
end gatelevel;
y is scheduled to be the value of a, but as usual, it is not to be assigned until the process suspends.y is now scheduled to be the value of b, overriding the previously scheduled assignment.y is assigned its new value, and the process suspends pending further events.y is only assigned once. This feature permits more sophisticated logic to be placed inside processes.