122 Chapter Five
Driver Values
Initial
Value
Z ZH
Z
H Resultant Value
Figure 5-2
Four State Resolution
with Two Values.
NULL;
END CASE;
WHEN X =>
result := X;
END CASE;
END LOOP;
RETURN result;
END resolve;
END fourpack;
The input argument is an unconstrained array of the driver-base
type,fourval. The resolution function examines all of the values of the
drivers passed in argument sone at a time and returns a single value
of fourvaltype to be scheduled as the signal value.
Variable resultis initialized to a Zvalue to take care of the case of zero
drivers for the signal. In this case, the loop is never executed, and the
result value returned is the initialization value. It is also a good idea to
initialize the result value to the weakest value of the value system to allow
overwriting by stronger values.
If a nonzero number of drivers exists for the signal being resolved, then
the loop is executed once for each driver value passed in argument s. Each
driver value is compared with the current value stored in variable result.
If the new value is stronger according to the rules outlined earlier, then
the current result is updated with the new value.
Let’s look at some example driver values to see how this works. Assuming
that argument scontained the driver values shown in Figure 5-2, what
would the result be?