VHDL Programming

(C. Jardin) #1

Sequential Processing 69


have a sensitivity list. A sensitivity list implies that execution starts from
the beginning of the procedure, while a WAITstatement allows suspending
a process at a particular point. The two are mutually exclusive.
Because the process can no longer have a sensitivity list, a WAITstate-
ment has been added to the end of the process that exactly imitates the
behavior of the sensitivity list. This is the following statement:

WAIT ON A, B, I0, I1, I2, I3;

The WAITstatement proceeds whenever any of the signals on the right
side of the keyword ONhave an event upon them.
This method of solving the sequential signal assignment problem causes
the process to work, but a better solution is to use an internal variable in-
stead of the internal signal, as shown here:

ARCHITECTURE mux_fix2 OF mux IS
BEGIN
PROCESS(A, B, I0, I1, I2, I3)
VARIABLE sel : INTEGER RANGE 0 TO 3;
BEGIN
sel := 0;
IF (A = ‘ 1 ’) THEN sel := sel + 1; END IF;
IF (B = ‘ 1 ’) THEN sel := sel + 2; END IF;

CASE sel IS
WHEN 0 =>
Q <= I0;
WHEN 1 =>
Q <= I1;
WHEN 2 =>
Q <= I2;
WHEN 3 =>
Q <= I3;
END CASE;
END PROCESS;
END mux_fix2;

The signal selfrom the preceding example has been converted from
an internal signal to an internal variable. This was accomplished by
moving the declaration from the architecture declaration section to the
process declaration section. Variables can only be declared in the process
or subprogram declaration section.
Also, the signal assignments to selhave been changed to variable
assignment statements. Now, when the first assignment to selis exe-
cuted, the value is updated immediately. Each successive assignment is
also executed immediately so that the correct value of selis available in
each statement of the process.
Free download pdf