vhdl_reference_93:resolution_function

Resolution function

A resolution function determines a signal`s value if this signal receives assignments from more than one source at a time. This is necessary if the following concurrent assignments to the unresolved signal Z exist.

Examples:

Z <= A;
Z <= B;

If there is no resolution function for Z it is not clear which value Z receives if A='0' and B='1'. In the signal declaration signal and resolution function are linked. It is also possible to declare a subtype which links a type to a resolution function.

A resolution function is declared which resolves multiple signal assignments according to the principle of the wired_or .

The constant floatvalue is declared as Bit and initialized with '0'. If there is no source driving a signal ( inputs' length =0) the value of floatvalue , i.e. '0' is transferred

If one of the inputs drives a '1' the value `1` and otherwise the value `0` is transferred.

FUNCTION wired_or ( inputs : Bit_vector )
      RETURN Bit IS
CONSTANT floatvalue : Bit := '0' ;
BEGIN
   IF inputs'Length = 0 THEN
      RETURN floatvalue ;
   ELSE
      FOR i IN inputs'Range LOOP
         IF inputs(i) = '1' THEN
            RETURN '1' ;
         END IF ;
      END LOOP ;
      RETURN '0' ;
   END IF ;
END ;