FPGA Center



AGGREGATE

It is the process of assigning one or more values to elements of the records and arrays. Assignment is done using a comma between the elements in parentheses.

NOTE: Others expression should be at the end of the aggregate definition.

EXAMPLE 1:

variable Z: STD_LOGIC_VECTOR (3 downto 0) := ('0','1','0','1'); --positional assignment
-- Z (3)= ‘0’, Data1 (2)=’1’, Data1 (1)= ‘0’, Data1 (0)=’1’;
-- It means Z= “0101”.

EXAMPLE 2:

variable Y  : BIT_VECTOR (0 downto 3) := (1=>'1',0=>'0',3=>'1',2=>'0'); -- mixed assignment
-- Y  (3)= ‘1’, Data2  (2)=’0’, Data2  (1)= ‘1’, Data2  (0)=’0’;
-- It means Y=”1010”.

EXAMPLE 3:

signal X : Bit_Vector (15 downto 0);
X<= (15 downto 7 => '0', 6 downto 0 => '1');
0 is assigned to X, from bit-15 to bit-8, and 1 is assigned from bit-7 to bit-0.

http://www.fpganedir.com/VHDL/RES%C4%B0M/AGGREGATE_clip_image002.jpg

It means that X=”0000000011111111”.

EXAMPLE 4:

type Status_Record is record
     Code : Integer;
     Name : String (1 to 4);
end record;
variable Status_Var:=(23,"FPGA"); -- 23 is assigned to Code, and FPGA is assigned to Name.

EXAMPLE 5:

Signal Data: Std_Logic_Vector (15 downto 0);
. . .
Data <= (15 downto 10 => '0', others => '1');

http://www.fpganedir.com/VHDL/RES%C4%B0M/AGGREGATE_clip_image004.jpg

It means that Data=”0000001111111111”.

EXAMPLE 6:

Data <= (others => 'Z');

http://www.fpganedir.com/VHDL/RES%C4%B0M/AGGREGATE_clip_image006.jpg

It means that Data=”ZZZZZZZZZZZZZZZZ”.

EXAMPLE 7:


Data <= (12 | 5 downto 3 => '1',  others => '0');

http://www.fpganedir.com/VHDL/RES%C4%B0M/AGGREGATE_clip_image008.jpg

It means that Data="0001000000111000".

                                                                                                   

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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