FPGA Center



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


EXAMPLE 1:


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;
    end record;

   attribute Pin : Dot;
    ........
end package Attribute_PCKG;

EXAMPLE 2:

package Declarations is     -- All the attributes declared in Attribute_PCKG are  used in here.
  use Work. Attribute_PCKG.Comp_symbol,
     Work. Attribute_PCKG.location,
     Work. Attribute_PCKG.Pin,
     Work. Attribute_PCKG.Max_delay;

  constant Con1: Positive := 14;
  signal S1: Bit_vector (0 to 15);
  component Comp1 is
        port ( ... );
  end component;
  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;

EXAMPLE 3:

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.

EXAMPLE 4:

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.

EXAMPLE 5:


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.

EXAMPLE 6:


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;

 EXAMPLE 7:

architecture Struct of ALU is

    component C1 is
        port (...)
   end component;

   attribute Location of  TA: label is (0.1, 1.4);

begin
     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.

EXAMPLE 8:

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.


DETAILED EXPLANATION:

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

Home | Fpga | VHDL | VHDL Dictionary | Digital Design | Simulation | PCB | Examples | Contact Us
Copyright © 2010 - 2013 FPGAcenter. All Rights Reserved.