VHDL Programming

(C. Jardin) #1

148 Chapter Six


CONSTANT andsd : t_4valX2 :=
((’x’, -- xx
’ 0 ’, -- x0
’x’, -- x1 (Notice this is an
’x’), -- xz array of arrays.)
(’ 0 ’, -- 0x
’ 0 ’, -- 00
’ 0 ’, -- 01
’ 0 ’), -- 0z
(’x’, -- 1x
’ 0 ’, -- 10
’ 1 ’, -- 11
’x’), -- 1z
(’x’, -- zx
’ 0 ’, -- z0
’x’, -- z1
’x’)); -- zz

CONSTANT andmd : t_4valmd :=
((’x’, -- xx
’ 0 ’, -- x0
’x’, -- x1
’x’), -- xz (Notice this example
(’ 0 ’, -- 0x is a multidimensional
’ 0 ’, -- 00 array.)
’ 0 ’, -- 01
’ 0 ’), -- 0z
(’x’, -- 1x
’ 0 ’, -- 10
’ 1 ’, -- 11
’x’), -- 1z
(’x’, -- zx
’ 0 ’, -- z0
’x’, -- z1
’x’)); -- zz
END p_4val;

The two composite type constants,andsdand andmd, provide a lookup
table for an ANDfunction of type t_4val. The first constant andsduses an
array of array values, while the second constant andmduses a multi-
dimensional array to store the values. The initialization of both constants
is specified by the same syntax. If the ’LENGTHattribute is applied to these
types as shown in the following, the results shown in the VHDL comments
are obtained:

PROCESS(a)
VARIABLE len1, len2, len3, len4 : INTEGER;
BEGIN
len1 := t_4valX1’LENGTH; -- returns 4
len2 := t_4valX2’LENGTH; -- returns 4
Free download pdf