Académique Documents
Professionnel Documents
Culture Documents
Suresh Balpande
www.sbalpande.webs.com
www.sbalpande.webs.com
www.sbalpande.webs.com
Composite
Array
Record
Access (pointers)*
* Not supported by synthesis tools
www.sbalpande.webs.com
bit (0 or 1)
bit_vector (array of bits)
integer
real
time (physical data type)
www.sbalpande.webs.com
Boolean:
TRUE,
FALSE
Data
types
Float:
0.124
Integer:
13234,23
Bit:
0,1
Character
a,b
String:
text
www.sbalpande.webs.com
www.sbalpande.webs.com
Identifiers
May contain A-Z, a-z, 0-9, _
Must start with letter
May not end with _
May not include two consecutive _
VHDL is case insensitive
Sel sel and SEL refer to same object
www.sbalpande.webs.com
Identifier Examples
A2G
valid
8bit_counter
invalid -- starts with number
_NewValue
invalid -- starts with _
first#
invalid -- illegal character
www.sbalpande.webs.com
Strings
string of characters
00101101
0X110ZZ1
www.sbalpande.webs.com
www.sbalpande.webs.com
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 :
ARCHITECTURE test_int OF test IS
BEGIN
PROCESS (X)
VARIABLE a: INTEGER;
BEGIN
a := 1; -- OK
a := -1; -- OK
a := 1.0; -- illegal
END PROCESS;
END test_int;
www.sbalpande.webs.com
www.sbalpande.webs.com
www.sbalpande.webs.com
Enumeration types:
An enumeration type is defined by listing
(enumerating) all possible values
Examples:
type COLOR is (BLUE, GREEN,
YELLOW, RED);
type MY_LOGIC is (0, 1, U, Z);
-- then MY_LOGIC can be one of the 4
values
www.sbalpande.webs.com
www.sbalpande.webs.com
Exercises
Example of the enumeration type of the menu of a restaurant:
type food is (hotdog, tea, sandwich, cake, chick_wing);
(a) Declare the enumeration type of the traffic light.
Answer: _______________________________________
(b) Declare the enumeration type of the outcomes of rolling a
dice.
Answer: _______________________________________
(c) Declare the enumeration type of the 7 notes of music.
Answer: _______________________________________
www.sbalpande.webs.com
Physical
Physical
Can be user defined range
Physical type example
www.sbalpande.webs.com
Physical
Physical
Can be user defined range
Physical type example
www.sbalpande.webs.com
www.sbalpande.webs.com
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
www.sbalpande.webs.com
Bits
type bit is (0, 1);
signal x,y,z: bit;
x <= 0;
y <= 1;
z <= x and y;
www.sbalpande.webs.com
Standard Logic
library IEEE;
use IEEE.std_logic_1164.all;
Standard Logic
type std_ulogic is unresolved.
Resolved signals provide a mechanism
for handling the problem of multiple
output signals connected to one signal.
subtype std_logic is resolved std_ulogic;
www.sbalpande.webs.com
C1
??
C2
www.sbalpande.webs.com
c1
www.sbalpande.webs.com
b1
??
illegal
C1
b1
??
C2
www.sbalpande.webs.com
www.sbalpande.webs.com
0 ...element indices... 31
0 ...array values...
1
VARIABLE X : data_bus;
VARIABLE Y : BIT;
Y := X(12);
15 ...element indices... 0
0 ...array values...
1
VARIABLE X : reg_type;
VARIABLE Y : BIT;
Y := X(4);