4-VHDL - Tipos de Datos
4-VHDL - Tipos de Datos
4-VHDL - Tipos de Datos
x <= '1'; -- Single quotes (' ') are used for a single bit.
y <= "0111"; -- MSB='0'. Double quotes (" ") are used for vectors.
w <= "01110001"; -- MSB='1'.
Tipos de datos: STD_LOGIC (y STD_LOGIC_VECTOR)
No sintetizables:
- ‘W’ Weak unknown
- ‘L’ Weak low
- ‘H’ Weak high
- ‘–’ Don’t care
Tipos de datos: STD_LOGIC (y STD_LOGIC_VECTOR)
● Ejemplos:
SIGNAL x: STD_LOGIC;
-- x is one-digit (scalar) signal of type STD_LOGIC.
● STD_ULOGIC (STD_ULOGIC_VECTOR): Niveles lógicos ‘U’, ‘X’, ‘0’, ‘1’, ‘Z’, ‘W’,
‘L’, ‘H’, ‘–’. Contiene al sistema STD_LOGIC y agrega el valor ‘U’, que
significa no-resuelto.
● BOOLEAN: Verdadero, Falso.
● INTEGER: Enteros de 32 bits (de -2147483647 a +2147483647).
● NATURAL: Enteros no negativos (de 0 a +2147483647).
● REAL: Números reales de -1.0E38 a +1.0E38. No sintetizable.
● Physical literals: Para cantidades físicas (tiempo, voltaje, etc.). No
sintetizable.
● Character literals: Caracter o cadena de caracteres ASCII. No sintetizable.
● SIGNED and UNSIGNED: tienen la apariencia de STD_LOGIC_VECTOR, pero
permiten operaciones aritméticas.
Tipos de datos: Ejemplos
● Tipo integer:
TYPE integer IS RANGE -2147483647 TO +2147483647;
-- This is indeed the pre-defined type INTEGER.
TYPE my_integer IS RANGE -32 TO 32;
-- A user-defined subset of integers.
● Tipo enumerated:
TYPE my_logic IS ('0', '1', 'Z');
-- A user-defined subset of std_logic.
● Inicialización:
... :="0001"; -- for 1D array
... :=('0','0','0','1') -- for 1D array
... :=(('0','1','1','1'), ('1','1','1','0')); -- for 1Dx1D or 2D
array
Arrays: asignaciones