Вы находитесь на странице: 1из 6

Data type in VHDL

VHDL has a set of standard data types (predefined / built-in). It is also


possible to have user defined data types and subtypes.

Some of the predefined data types in VHDL are: BIT, BOOLEAN and
INTEGER.
Cont…
• The STD_LOGIC and STD_LOGIC_VECTOR data types are not
built-in VHDL data types, but are defined in the standard logic
1164 package of the IEEE library.
• We therefore need to include this library in our VHDL code
and specify that the STD_LOGIC_1164 package must be used
in order to use the STD_LOGIC data type:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
ENTITY andgate IS
PORT ( a : IN std_logic; b : IN std _ logic; c : OUT std _ logic );
END andgate;
Cont…..
Enumerated Types:
– BIT ('0','1')
– BOOLEAN (false, true)
– STD_LOGIC ('U','X','0','1','Z','W','L','H','-') where:

• 'U' means uninitialized


• 'X' means unknown
• '0' means low
• '1' means high
• 'Z' means high impedance
• 'W' means weak unknown
• 'L' means weak low
• 'H' means weak high
• '-' means don't care
• For XST synthesis, the '0' and 'L' values are treated identically, as are '1' and
'H'. The 'X', and '-' values are treated as don't care. The 'U' and 'W' values are not
accepted by XST. The 'Z' value is treated as high impedance.
– User defined enumerated type:
• type COLOR is (RED,GREEN,YELLOW);
Cont….
Bit Vector Types:
– BIT_VECTOR
– STD_LOGIC_VECTOR
• Unconstrained types (types whose length is not defined)
are not accepted

Integer Type: INTEGER


• The following types are VHDL predefined types:
• BIT
• BOOLEAN
• BIT_VECTOR
• INTEGER
• The following types are declared in the
STD_LOGIC_1164 IEEE package.
STD_LOGIC
STD_LOGIC_VECTOR
• This package is compiled in the IEEE library. In order
to use one of these types, the following two lines
must be added to the VHDL specification:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
• Overloaded Data Types
The following basic types can be overloaded.
• Enumerated Types:
– STD_ULOGIC: contains the same nine values as the STD_LOGIC type, but does not contain
predefined resolution functions.
– X01: subtype of STD_ULOGIC containing the 'X', '0' and '1' values
– X01Z: subtype of STD_ULOGIC containing the 'X', '0', '1' and 'Z' values
– UX01: subtype of STD_ULOGIC containing the 'U', 'X', '0' and '1' values
– UX01Z: subtype of STD_ULOGIC containing the 'U', 'X', '0','1' and 'Z' values
• Bit Vector Types:
– STD_ULOGIC_VECTOR
– UNSIGNED
– SIGNED
• Unconstrained types (types whose length is not defined) are not accepted.
• Integer Types:
– NATURAL
– POSITIVE

Вам также может понравиться