Professional Documents
Culture Documents
F3.1 VHDL Data Types
F3.1 VHDL Data Types
Module F3.1
VHDL Data Types
Scalar
Integer
Enumerated
Real (floating point)*
Physical*
Composite
Array
Record
Access (pointers)*
* Not supported by synthesis tools
VHDL Data Objects
Constant
Variable
Signal
File*
Characters
‘A’, ‘0’, ‘1’, ‘$’, ’x’, ‘*’
Strings
“string of characters”
“00101101”
“0X110ZZ1”
Characters and Strings
Bit Strings
B”011111010110”
O”3726”
X”7D6”
Integer Data Type
Integer
Minimum range for any implementation as defined by
standard: - 2,147,483,647 to 2,147,483,647
Example assignments to a variable of type integer :
UNITS
ohm; -- ohm
Kohm = 1000 ohm; -- i.e. 1 K
Mohm = 1000 kohm; -- i.e. 1 M
END UNITS;
Booleans
type boolean is (false, true);
variable A,B,C: boolean;
C := not A
C := A and B
C := A or B
C := A nand B
C := A nor B
C := A xor B
C := A xnor B
Bits
type bit is (‘0’, ‘1’);
signal x,y,z: bit;
x <= ‘0’;
y <= ‘1’;
z <= x and y;
Standard Logic
library IEEE;
use IEEE.std_logic_1164.all;
type std_ulogic is ( ‘U’, -- Uninitialized
‘X’ -- Forcing unknown
‘0’ -- Forcing zero
‘1’ -- Forcing one
‘Z’ -- High impedance
‘W’ -- Weak unknown
‘L’ -- Weak zero
‘H’ -- Weak one
‘-’); -- Don’t care
Standard Logic
type std_ulogic is unresolved.
0 ...element indices... 31
0 ...array values... 1
VARIABLE X : data_bus;
VARIABLE Y : BIT;
DOWNTO keyword must be used if leftmost index is greater than rightmost index
‘Big-endian’ bit ordering, for example
15 ...element indices... 0
0 ...array values... 1
VARIABLE X : reg_type;
VARIABLE Y : BIT;