FPGA Center



ALLOCATOR

They are the processes that create variables and anonymous objects to be accessed later.

new subtype_indication
new identifier_expression

NOTE:

EXAMPLE 1:

type T1 is array (0 to7) of Natural;
type T_access is access T1;
variable z : T_access;
...
z := new T1; -- T1 is reseted to (0, 0, 0, 0, 0, 0, 0, 0).
A new object which has an initial value of  (0, 0, 0, 0, 0, 0, 0, 0) is created by using allocator.

EXAMPLE 2:

z := new BIT_VECTOR (1 to 3);  -- A new object of bit_vector type is created by allocator as the initial value of this object is ('1','1','0').

EXAMPLE 3:
 

 You can assign initial values to objects as seen in the example. The allocator of X is used the aggregate method and the Y allocator is used a direct assignment method in order to assign values to X and Y respectively. These two different objects are actually identical objects.

EXAMPLE 4:
 

 A new object called┬á Pointer1 is created then Pointer2 is directed to this object. So a new object was created by this way.

DETAILED EXPLANATION


An object and a pointer which is used to access that object is created whenever an allocator used. The type of the object can be defiend with subtype (Example 1 and Example 2) or identifier (Example 3 and Example 4).

If an alocator will create an object of type array, that array must be constrained. This can be achieved by using a constrained subtype or a constrained index. (Exmaple 2)

Copying the value of an allocated object to another variable does not actually mean creating a new object. In this case, both variables refer to the same object. (Example 5)

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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