Arrays in VHDL
Arrays in VHDL
http://www.ics.uci.edu/~jmoorkan/vhdlref/arrays.html
Text-only version
Arrays
Package
Entity
Architecture
Declaration ---- used in ---->
Process
Procedure
Function
Syntax
type type_name is array (range) of
element_type;
See LRM section 3.2.1
Rules and Examples
An arraycontains multiple elements of the same type. When an array object
is declared, an existing array type must be used.
type NIBBLE is array (3 downto 0) of std_ulogic;
type RAM is array (0 to 31) of integer range 0 to 255;
signal A_BUS : NIBBLE;
signal RAM_0 : RAM;
An array type
definition
can be unconstrained,
of undefined
Arrays
with character
elements such i.e.
as string,
bit_vector
length. String,
bit_vector
and
std_logic_vector
are
defined
in this
and std_logic_vector may be assigned a literal value
using
way. An object
(signal,
variable
or constant) of an unconstrained
double
quotes
(see literals):
array type must have it's index type range defined when it is
declared. CONSTANT MSG_o: string := "Test 1 Completed";
...
<= "0000";
type INT_ARRAY A_BUS
is array
(integer range <>) of integer;
LOC_BUS
<= "10101010";
variable INT_TABLE: INT_ARRAY(0
to 9);
variable LOC_BUS : std_ulogic_vector(7 downto 0);
1 of 2
02/12/2013 09:29 PM
http://www.ics.uci.edu/~jmoorkan/vhdlref/arrays.html
Synthesis Issues
Most logic synthesis tools accept one-dimensional arrays of other supported
types. 1-D arrays of 1-D arrays are often supported. Some tols also allow true
2-D arrays, but not more dimensions.
Note that arrays are usually implemented using gates and flip-flops, not ROM's
and RAM's.
Whats New in '93
Array types have not changed in VHDL-93.
2 of 2
02/12/2013 09:29 PM