Formal Definition
A value, function, type, range, signal, or constant that may be associated with one or more named entities in a description.
Simplified Syntax
object'attribute_name
Description
Attributes allow retrieving information about named entities: types, objects, subprograms etc. VHDL standard defines a set of predefined attributes. Additionally, users can define new attributes, and then assign them to named entities by specifying the entity and the attribute values for it. See attributes (user-defined) for details.
Predefined attributes denote values, functions, types, and ranges that characterize various VHDL entities. Separate sets of attributes are predefined for types, array objects or their aliases, signals and named entities.
Each type or subtype T has a basic attribute called T'Base, which indicates the base type for type T (Table 1). It should be noted that this attribute could be used only as a prefix for other attributes.
Table 1. Attributes available for all types
Attribute | Result |
T'Base | base type of T |
Scalar types have attributes, which are described in the Table 2. Letter T indicates the scalar type.
Table 2. Scalar type attributes
Attribute | Result type | Result |
T'Left | same as T | leftmost value of T |
T'Right | same as T | rightmost value of T |
T'Low | same as T | least value in T |
T'High | same as T | greatest value in T |
T'Ascending | boolean | true if T is an ascending range, false otherwise |
T'Image(x) | string | a textual representation of the value x of type T |
T'Value(s) | base type of T | value in T represented by the string s |
Discrete or physical types and subtypes additionally have attributes, which are described in Table 3. The discrete or physical types are marked with letter T before their names.
Table 3. Attributes of discrete or physical types and subtypes
Attribute | Result type | Result |
T'Pos(s) | universal integer | position number of s in T |
T'Val(x) | base type of T | value at position x in T (x is integer) |
T'Succ(s) | base type of T | value at position one greater than s in T |
T'Pred(s) | base type of T | value at position one less than s in T |
T'Leftof(s) | base type of T | value at position one to the left of s in T |
T'Rightof(s) | base type of T | value at position one to the right of s in T |
Array types or objects of the array types have attributes, which are listed in the Table .4. Aliases of the array type objects have the same attributes. Letter A denotes the array type or array objects below.
Table 4. Attributes of the array type or objects of the array type
Attribute | Result |
A'Left(n) | leftmost value in index range of dimension n |
A'Right(n) | rightmost value in index range of dimension n |
A'Low(n) | lower bound of index range of dimension n |
A'High(n) | upper bound of index range of dimension n |
A'Range(n) | index range of dimension n |
A'Reverse_range(n) | reversed index range of dimension n |
A'Length (n) | number of values in the n-th index range |
A'Ascending(n) | True if index range of dimension n is ascending, False otherwise |
Signal attributes are listed in Table 5. Letter S indicates the signal names.
Table 5. Signals attributes
Attribute | Result |
S'Delayed(t) | implicit signal, equivalent to signal S, but delayed t units of time |
S'Stable(t) | implicit signal that has the value True when no event has occurred on S for t time units, False otherwise |
S'Quiet(t) | implicit signal that has the value True when no transaction has occurred on S for t time units, False otherwise |
S'Transaction | implicit signal of type Bit whose value is changed in each simulation cycle in which a transaction occurs on S (signal S becomes active) |
S'Event | True if an event has occurred on S in the current simulation cycle, False otherwise |
S'Active | True if a transaction has occurred on S in the current simulation cycle, False otherwise |
S'Last_event | the amount of time since last event occurred on S, if no event has yet occurred it returns Time'High |
S'Last_active | the amount of time since last transaction occurred on S, if no event has yet occurred it returns Time'High |
S'Last_value | the previous value of S before last event occurred on it |
S'Driving | True if the process is driving S or every element of a composite S, or False if the current value of the driver for S or any element of S in the process is determined by the null transaction |
S'Driving_value | the current value of the driver for S in the process containing the assignment statement to S |
The named entities have attributes described in Table 6. Letter E denotes the named entities.
Table 6. Attributes of named entities
Attribute | Result |
E'Simple_name | a string representing the simple name, character literal or operator symbol defined in the declaration of the item E |
E'Path_name | a string describing the path through the design hierarchy, from the root entity or package to the item E |
E'Instance_name | a string describing the path through the design hierarchy, from the root entity or package to the item E, but including the names of the entity and architecture bound to each component instance in the path |
Paths which can be written using E'Path_name and E'Instance_name are used for reporting and assertion statements. They allow specifying precisely where warnings or errors are generated. E'Simple_name attribute refers to all named entities, E'Path_name and E'Instance_name can refer to all named entities apart from the local ports and generic parameters in the component declaration.
There is one more predefined attribute: 'Foreign' that allows the user to transfer additional information to the simulator. The information contains the instruction for special treatment of a given named entity. The exact interpretation of this attribute, however, depends on its implementation in particular simulator.
Examples
Example 1
type Table is array (1 to 8) of Bit;
variable Array_1 : Table := "10001111";
Array_1'Left, the leftmost value in index range of Table array, is equal to 1.
Example 2
type Table is array (Positive range <>) of Bit;
subtype Table_New is Table (1 to 4);
Table_New'Base, the base type of the Table_New subtype is Table.
Example 3
type New_Range is range 1 to 10;
New_Range'Ascending is TRUE (the New_Range type is of ascending range).
Example 4
type New_Values is (Low, High, Middle);
New_Values'Pred(High) will bring the 'Low' value.
Example 5
type Table is array (1 to 8) of Bit;
Table'Range(1) is the range of the first index of Table type and returns '1 to 8'; Table'Range will have the same interpretation for one dimensional array.
Important Notes
- Not all predefined attributes are supported by synthesis tools; most tools support 'high, 'low, 'left, 'right, range, 'reverse_range, 'length and 'event. Some also support'last_value and 'stable.
No comments:
Post a Comment
Please provide valuable comments and suggestions for our motivation. Feel free to write down any query if you have regarding this post.