Subprograms and Packages 127
a stronger strength value than variable resultcauses variable resultto
be updated with the stronger value,R0.
Another example shows how the constant x_tabis used to predict the
correct value for conflicting inputs. The driver values are shown in the
array in Figure 5-5.
In this example, variable resultis initialized to F0. The first iteration
of the loop does nothing because the first driver and the result-
initialization value are the same value. The next iteration starts with
variable resultcontaining the value F0, and the next driver value as R0.
Because the value in variable resultis greater in strength than the value
of the new driver, no action is implemented, except to advance the loop to
the next driver.
The last driver contains the value F1. The strength of the value contained
in variable resultand the new driver value are the same. Therefore, the
IFstatement checking this condition is executed and succeeds. The next
IFstatement checks to see if the logical values are the same for both vari-
able resultand the new driver. Variable resultcontains an F0, and the
new driver value contains an F1. The values are not the same, and the
x_tabtable is used to return the correct unknown value for the strength
of the driver values. The x_tabtable returns the value FX, which is returned
as the resolved value.
A more efficient method to implement the loop would be to skip the
first iteration where the first driver is compared to itself, because the
value in variable resultis initialized to the first driver value. It is left
as an exercise to the reader to write this new loop iteration mechanism.
Driver Values
Initial
Value
F0 F0 R0 F1
F0
F0
FX Resultant Value
Figure 5-5
Nine State Resolution
with Three Values.