Package with Bus Resolution Function(Package Body)
PACKAGE BODY resources IS
FUNCTION wired_x (input : level_vector) RETURN level IS
VARIABLE has_driver : BOOLEAN := FALSE;
VARIABLE result : level := 'Z';
L1 : FOR i IN input’RANGE LOOP
ELSE -- has more than one driver
Notes:
This is the package body showing the implementation of the wired_x function. Notice that the loop index spans input’RANGE which ensures that the BRF function can examine all the elements in the unconstrained array of signal drivers (i.e. the actual number of signal drivers may not be known apriori).
Basically, the function returns ‘Z’ if all drivers are ‘Z’, the value of any single non-‘Z’ driver if there is one, and an ‘X’ if there is more than one active driver..