Professional Documents
Culture Documents
Introduction To VHDL
Introduction To VHDL
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R Each slice has two
identical
F5IN logic cells (LC)
BY
SR
CLK
CE
XB
X
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C A Configurable
g Logic
g Block
G1 I1 R
(CLB) has two
identical slices
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and A logic cell has a
O CK
G2 I2 Control 4i
4‐inputt function
f ti generator,t
Logic EC
G1 I1 R carry logic and an
storage element.
F5IN
BY The output from the
SR function generator
CLK
CE drives the CLB output
and the D input of
XB
X
the flip‐flop.
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C A CLB also contains logic to
G1 I1 R
combine function generators
to provide functions of five
or six inputs.
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R The storage element
can be configured as:
F5IN • edge‐triggered
edge triggered D flip‐flop
flip flop
BY • level‐sensitive latch.
SR
CLK
CE
XB
X
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C
G1 I1 R
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R The D input can be driven
by the function generator
F5IN or directly from the slice
BY inputs.
SR
CLK
CE
XB
X
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C
G1 I1 R
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R The D input can be driven
by the function generator
F5IN or directly from the slice
BY inputs.
SR
CLK
CE
XB
X
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C
G1 I1 R
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R
The FF receive the same
F5IN clock signal.
signal
BY
SR
CLK
CE
XB
X
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C
G1 I1 R
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R
Each slice has synchronous
set and reset signals
F5IN
BY
SR
CLK
SR forces a storage
CE element into
the initialization state
XB
X specified for it
in the configuration
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C
G1 I1 R
BX
CIN
Spartan‐II CLB Slice
COUT
YB
Y
G4 I4 Look‐Up Carry D S Q YQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
G1 I1 R
Each slice has synchronous
set and reset signals
F5IN
BY
SR
CLK
SR forces a storage
CE element into
the initialization state
XB
X specified for it
in the configuration
G4 I4 Look‐Up Carry D S Q XQ
G3 I3 Table and
O CK
G2 I2 Control
Logic EC
C BY forces it
G1 I1 R
into the opposite
state.
BX
CIN
Spartan‐II CLB Slice
SR and BY can be configured to work asynchronously.
IO Block
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
IOB Registers may be:
• edge‐triggered D‐type flip‐flops
• level‐sensitive
level sensitive latches
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
The three registers share a The SR input can be • synchronous Set
Set/Reset (SR) line. independently configured • synchronous Reset
in each register as: • asynchronous Preset
• asynchronous Clear
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR • • Bi &
Bias P k
Package Pi
Pin
ESD Network
O • D
SR
Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q • Package Pin
Programmable
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Input Path: The IOB routes an input signal either directly
or through an optional input flip‐flop.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Input Path: The IOB routes an input signal either directly
or through an optional input flip‐flop.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Input Path: The optional delay eliminates pad‐to‐pad hold time.
The delay matches the internal clock distribution delay of the FPGA,
assuringg that the pad‐to‐pad
p p hold time is zero.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR • • Bi &
Bias P k
Package Pi
Pin
ESD Network
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Output path: a three‐state output buffer drives the signal onto the pad.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR • • Bi &
Bias P k
Package Pi
Pin
ESD Network
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q • Package Pin
Programmable
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Output path: the output signal can be routed directly to the buffer
or through an optional IOB output flip‐flop.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Output path: the output signal can be routed directly to the buffer
or through an optional IOB output flip‐flop.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Output path: the three‐state control of the output
can also be routed directly to the buffer
or through an optional IOB output flip‐flop.
flip flop
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
Output path: the three‐state control of the output
can also be routed directly to the buffer
or through an optional IOB output flip‐flop.
flip flop
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
All pads are protected against damage from electrostatic discharge (ESD)
and from over‐voltage transients.
T •
•
SR Package
D Q
Pin
CLK • CK
TCE EC VCC
TFF
Programmable
SR
• • Bi &
Bias
ESD Network
P k
Package Pi
Pin
•
SR
O D Q Programmable
• CK ff
Output Buffer Internal
Reference
OCE EC
OFF
Programmable
IQ Delay
I • D
SR
Q
Programmable • Package Pin
CK I
Input
t Buffer
B ff
ICE EC
IFF
To Next I/O
To Other
External VREF Inputs
Spartan‐II Input/Output Block (IOB) of Bank
IO Block
Agenda
Technology
• 1‐FPGA
1 FPGA Overview
• 2‐VHDL Overview
• 3
3‐Timing
Timing Optimization
• 4‐Area Optimization
• 5
5‐Architecting
Architecting Power
• 6‐High Level Design
• 7
7‐Clock
Clock Domains
omains
• 8‐Sythesis Optimization
• 9‐Static Timingg Analysis
y
VHDL Overview
Design Flow
Design Units
Design
g units
• Libraries
– The libraries with the tool need to convert words to codes
known as the word std_logic the library will but the truth table
suitable for this word
LIBRARIRY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
• Ports
– Contains the inputs and the output of the system
ENTITY PROJ_NAME IS
PORT (A,B :IN std_logic; D:OUT std_logic);
END PROJ_NAME;
• Architecture
– The core of the program
ARTHITECTURE TYP_NAME OF PROJ_NAME IS
BEGIN
END;
Entityy
• Note VHDL not case sensitive
Entity‐(cont’d)
y( )
Architecture
Package declaration
Package body
Using Package
Configuration Declaration
Configuration Declaration (cont
(cont’d)
d)
Entity Name
keyword Configuration Name
a <= ”0000”;
b <= ”1111”;
c <= a & b; -- c = ”00001111”
n <=
< ‘1’ & ‘1’ & ‘0’ & ‘0’ & ‘1’ & ‘1’ &
‘1’ & ‘1’;
-- e <= ”11001111”
Data types
yp
• Std_logic_1164
Data types‐(cont’d)
yp ( )
• Attributes
Data Type
Type‐(cont
(cont’d)
d)
Enumerated Type Definition
• You can define
d fi your own enumerated
d data
d
types
– Handy when defining states and transitions
– Form is:
TYPE type
yp _name IS ((value list);
);
• Once declared
declared, the data type is used to define
new signals of that type
Enumerated Type Example
type state_type
state type is (reset,
(reset sync
sync, load
load, out);
signal pstate: state_type;
when sync
y => ….
etc.
end if;
end process;
Operators
p
• Std_logic_arith
Operators‐(cont’d)
p ( )
Operators‐(cont’d)
p ( )
Operators‐(cont’d)
p ( )
Operators‐(cont’d)
p ( )
Operators‐(cont’d)
p ( )
Wait statement
Delta Delay
Transport versus inertial delay
Design Levels
entity adder is
Port (a, b : in unsigned(7 downto 0);
d : out unsigned(7 downto 0));
end adder;
ENTITY alu IS
‐‐ Declarations
port(a,b: in std_logic_vector(7 downto 0);
sel: in std_logic_vector(3 downto 0);
cin: in std_logic;
y:out std_logic_vector(7 downto 0));
END alu ;
‐‐ hds interface_end
ARCHITECTURE alu OF alu IS
signal arith,logic: std_logic_vector(7 downto 0);
BEGIN
with sel(2 downto 0) select
arith<= a when "000",
a+1 when "001",
a‐1 when"010",
b when "011",
b+1 when "100",
Examples
p 7‐(cont’d)
( )
b‐1 when "101",
a+b
b when
h "110",
"110"
a+b+cin when others;
with
ith sel(2 downto
do nto 0) select
logic<= not a when "000",
not b when "001",
a and b when "010"
010 ,
a or b when "011",
a nand b when "100",
a nor b when "101"
101 ,
a xor b when "110",
not (a xor b) when others;
ENTITY unsigned_mult
d l IS
PORT (
a: IN STD_LOGIC_VECTOR (7 DOWNTO 0);
b
b: IN STD LOGIC VECTOR (7 DOWNTO 0);
STD_LOGIC_VECTOR 0)
clk: IN STD_LOGIC;
aclr: IN STD_LOGIC;
result:OUT STD LOGIC VECTOR (15 DOWNTO 0)
STD_LOGIC_VECTOR
);
END unsigned_mult;
ARCHITECTURE rtl OF unsigned_mult
unsigned mult IS
SIGNAL a_reg, b_reg: std_logic_vector (7 DOWNTO 0);
Examples
p 8‐(cont’d)
( )
BEGIN
PROCESS (clk, aclr)
BEGIN
IF (aclr ='1') THEN
a_reg <= (OTHERS => '0');
b
b_reg <= (OTHERS
( => '0');
' ')
result <= (OTHERS => '0');
ELSIF ((clk'event
lk' t AND clk
lk = '1') THEN
a_reg <= a;
b_reg <= b;
END rtl;