VHDL Programming

(C. Jardin) #1

Predefined Attributes 169


attribute is another of the attributes that creates a signal where it is
used. Attribute ’TRANSACTIONcreates a signal of type BITthat toggles
from ‘ 1 ’or ‘ 0 ’for every transaction of the signal that it is attached to.
This attribute is useful for invoking processes when transactions occur
on signals.
In the preceding example, the interrupt handler process needs to be
executed whenever a transaction occurs on signal int. This is true because
the same interrupt could happen twice or more in sequence. If this occurred,
a transaction, not an event would be generated on signal int. Without
the attribute ’TRANSACTION,WAITstatements are sensitive to events. By
using the attribute ’TRANSACTION, the value of int’TRANSACTIONtog-
gles for every transaction causing an event to occur, thus activating the
WAITstatement.

Type Kind Attributes


Type attributes return values of kind type. There is only one type
attribute, and it must be used with another value or function type attribute.
The only type attribute available in VHDL is the attribute t’BASE.
This attribute returns the base type of a type or subtype. This attribute
can only be used as the prefix of another attribute, as shown in the
following example:

do_nothing : PROCESS(x)
TYPE color IS (red, blue, green, yellow, brown, black);
SUBTYPE color_gun IS color RANGE red TO green;

VARIABLE a : color;
BEGIN
a := color_gun’BASE’RIGHT; -- a = black
a := color’BASE’LEFT; -- a = red

-- a = yellow
a := color_gun’BASE’SUCC(green);

END PROCESS do_nothing;

In the first assignment to variable a,color_gun’BASEreturns type
color, the base type of color_gun. The statement color’RIGHTthen
returns the value black. In the second assignment statement, the base
Free download pdf