ATTRIBUTE (USER DEFINED)
The user can define his/her own attribute or can use a previously defined (predefined) attribute. With a user-defined atribute; it is possible to collect additional information of any object in the design.
attribute attribute_name: type; Â Â Â Â Â -- attribute declaration
attribute attribute_name of item : item_class is expression; -- attribute definition
package Attribute_PCKG is --You can see there are a lot of attribute declared in the Attribute_ PCKG package.
attribute Pin : Positive;
attribute Comp_symbol : String;
attribute Max_delay: Time;
type Dot is record
x, y: Real;
attribute Pin : Dot;
end package Attribute_PCKG;
package Declarations is -- All the attributes declared in Attribute_PCKG areÂ used in here.
use Work. Attribute_PCKG.Comp_symbol,
constant Con1: Positive := 14;
signal S1: Bit_vector (0 to 15);
component Comp1 is
port ( ... );
attribute Comp_ symbol of Comp1: component is "Counter 2 ";
attribute location of Comp1: component is (0.0, 19.3);
attribute Pin of S1: signal is 24;
attribute Max_delay of Con1: constant is 100 ns;
end package Declarations;
package TestPac is
attribute PacAttrib : String;
attribute PacAttrib of TestPac:
package is "Training Package ";
end package TestPac;
PaketAttrib which is a part of TestPaket package is identified where it has been declared.
procedure lower_limit (a, b : in Integer; result: out Integer);
procedure lower_limit (a, b : in Bit_vector; result: out Bit_vector);
procedure Definition : String;
attribute Definition of lower_limit [Integer, Integer, Integer] : procedure is "Integer_ lower_limits ";
attribute Definition of lower_limit [Bit_vector, Bit_vector, Bit_vector] : procedure is "Bit_vector_ lower_limits";
You can see a overloading above because its been used âlower_limitâ name at two different places. In order not to cause an overloading, a parameter list should be given in brackets while doing attribute declaration. This helps to distinguish which attribute belongs to which procedure.
function "*" (x,y : new_type) return new_type;
attribute Characteristic : String;
attribute Characteristic Â of "*" [new_type, new_type return new_type]: function is " new_type_operator ";
Since the â*â operator is overloaded here, the function parameters are written in brackets while declaring the attributes.
procedure P1 (FIFO : inout Fifo_type; ELEMAN: in Elemant_type) is
attribute Number of FIFO: variable is 67; -- Itâs defined in Procedure
attribute Watch of ELEMAN: constant is " Integer / decimal "; -- Itâs defined in Procedure
end procedure P1;
architecture Struct of ALU is
component C1 is
attribute Location of Â TA: label is (0.1, 1.4);
TA : C1 port map ( ... );
end architecture Struct;
You can see a component labeled âTAâ is used above. Declaration of the atribute which is linked to that component is done at outside the place where the component is used. So it is declared in the Struct architecture.
type level_3 is (Low, High, Idle);
type level_4 is (Low, High, Idle, Uninitialized);
attribute Hex_value : string (0 to 1);
attribute Hex_ value of Low [return level_4_logic]: literal is "EE";
attribute Hex_ value of High [return level_4_logic]: literal is "F0";
attribute Hex_ value of Idle [return level_4_logic]: literal is "A8";
attribute Hex_ value of Uninitialized: literal is "1F";
There is an overloding above since the Low, High ve Idle literals are used twice each. There is no need to use a signature while declaring Hex_value attribute. Because uninitialized literal is not overloaded here.