vhdl_reference_93:attribute_declarations

Attribute declarations

attribute identifier : type_mark ;

Attributes can be used to poll the characteristics of objects (e.g. signals). In many cases this allows a shorter and more elegant VHDL description to be created. The most important attributes are predefined ones.

In order to be able to use one`s own attributes one has to write a corresponding function which then provides the

attribute`s value at any given time. For further information go to: Attribute specification.

  • entity_declarative_part
  • architecture_declarative_part
  • package
  • block_declarative_part
  • function_declarative_part
  • procedure_declarative_part
  • process_declarative_part

type _name

subtype _name

capacitance_value is declared as an attribute of the type capacitance .

ATTRIBUTE capacitance_value :
      capacitance ;

The attribute pin_number declared here is of the subtype pin_natural .

SUBTYPE pin_natural IS natural
      RANGE 1 TO 24 ;
ATTRIBUTE pin_number : pin_natural ;

Two different attributes are declared.

location is of the type coordinate which is a Record type.

pin_no is of the type positive which is a subtype of integer .

TYPE coordinate IS
   RECORD
      x, y : integer ;
   END RECORD ;
   TYPE positive IS integer
         RANGE 1 TO integer'high ;
   ATTRIBUTE location : coordinate ;
   ATTRIBUTE pin_no : positive ; 

By using predefined attributes the loop-instruction can be written in a different way as well:

FOR i IN a1'LOW TO a1'HIGH
 
FOR i IN a1'RIGHT TO a1'LEFT
 
FOR i IN a1'REVERSE_RANGE
 
FOR i IN a1'RANGE
SIGNAL a1: bit_vector(3 DOWNTO 0) ;
...
PROCESS (a)
   BEGIN
   z<= "0000";
   FOR i in 0 TO 3 LOOP
      IF (a = i) THEN
         z(i) <= '1' ;
      END IF ;
   END LOOP ;
END PROCESS ;
...