Example From UVA ADEPTUVA Package Body
FUNCTION Protocol (Input : Token_Vector) RETURN Token IS
VARIABLE Source_Token : Token := Def_Source_Token;
VARIABLE Sink_Token : Token := Def_Sink_Token;
-- First, determine status of input tokens
IF (Input(I).Status = Present) THEN Source_Token := Input(I);
ELSIF (Input(I).Status = Acked) THEN Sink_Token := Input(I);
END IF; -- else use default assignments from variable declarations
-- Resolve based on status of tokens identified
IF (Source_Token.Status=Present) THEN
IF (Sink_Token.Status=Acked) THEN RETURN Sink_Token;
ELSE RETURN Source_Token;
ELSIF (Sink_Token.Status=Acked) THEN RETURN Source_Token;
-- Package body continued on next slide
Notes:
The body of the package used in the example is shown here. The complete VHDL file, which spans several slides, includes the implementation of the various functions and procedures declared in the declarative section of the package.
The implementation of the Bus Resolution Function protocol is shown in this particular slide. The first section of the function searches through the input token_vector to find an sink token of status Acked and/or a source token status Present to select a single source token and a single sink token between which to arbitrate. If no appropriate source or sink token is found for either of these, default status conditions of Released and Removed are used for the source and sink tokens, respectively. The function then picks the appropriate token from between the two tokens selected in the first section via the arbitration priority that was described earlier.