Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Vinay Sharma
vinay@ni2designs.com
ni logic Pvt. Ltd., Pune
1
Agenda
World of Electronics
Introduction to Programmable Logic
CPLD
Working principle, Architecture, I/O Block, Macrocell, programming, features, examples.
FPGA
Working principle, Architecture, I/O Block, CLB, embedded memory, clock management,
DSP capability, programming, features, examples.
World of Electronics
Communication Interface
Serial, parallel, high speed, USB, irDA, PCI
Digital Logic
FPGAs/CPLDs
Master
Microprocessor/Microcontroller
Memory
SRAM, FLASH, DRAM
Power Electronics
SCRs, optical isolators,
relays, IGBT
Analog Circuitry
Sensors, Buffers,
amplifiers, ADC, DAC
An Electronic System
Displays
LCDs,LEDs
3
Semi-Custom
ASICs
User
Programmable
PLD
CPLD
PAL
PLA
Controllers
FPGA
Programmable Logic
Since the invent of PLD from 1980s with few gate count, they have grown into
million gates, so as there usage in different applications.
Advantages like programmability and reconfiguration of PLDs has given ideas and
shape to many applications.
Todays PLDs like FPGAs can compete with ASICs in terms of performance and
gate counts.
From the time their use has increased in all sectors, like defense, consumer, multi
media, communications, DSP, etc.
What is Available?
CPLD (Complex Programmable Logic Device)
consists of multiple PLA blocks that are
interconnected to realize larger digital systems.
FPGA (Field Programmable Gate Array) has
narrower logic choices and more memory
elements. LUT (Lookup Table) may replace actual
logic gates.
C
Programmable switch or fuse
f1 = A B C + A B C
f2 = A B + A B C
AND plane
What is an CPLD ?
Integration of several PLD blocks with a programmable interconnect on
a single chip
PLD
PLD
Block
Block
I/O Block
Block
I/O
PLD
PLD
Block
Block
I/O Block
Block
I/O
I/O Block
Block
I/O
Interconnection
Interconnection Matrix
Matrix
I/O Block
Block
I/O
PLD
PLD
Block
Block
PLD
PLD
Block
Block
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
1
0
1
1
1
0
0
0
Truth-table
A
B
C
D
LUT
LUT
LUT implementation
A
B
Z
C
D
Gate implementation
What is an FPGA ?
FPGA building blocks:
Programmable logic blocks
Implement combinatorial and
sequential logic
I/O
I/O
Interconnection switches
I/O
Programmable interconnect
Wires to connect inputs and
outputs to logic blocks
Logic block
I/O
10
CPLD
Architecture and Examples
11
C
Programmable switch or fuse
f1 = A B C + A B C
f2 = A B + A B C
AND plane
12
CPLD Structure
Integration of several PLD blocks with a programmable interconnect on
a single chip
PLD
PLD
Block
Block
I/O Block
Block
I/O
PLD
PLD
Block
Block
I/O Block
Block
I/O
I/O Block
Block
I/O
Interconnection
Interconnection Matrix
Matrix
I/O Block
Block
I/O
PLD
PLD
Block
Block
PLD
PLD
Block
Block
13
JTAG
controller
14
Architecture Description
Each XC9500 device is a subsystem consisting of multiple
Function Blocks (FBs)
Provides programmable logic capability with 36 inputs and 18 outputs.
I/O Blocks(IOBs)
The IOBs provide buffering for device inputs and outputs.
FastConnect switch matrix.
Connects all FB outputs and inputs signals to the FB inputs.
15
Function Block
Global
Set/Reset
Global
Clocks
16
PLD - Macrocell
Select
Enable
f
1
Flip-flop
MUX
D
Clock
AND plane
17
Macrocell
Set control
Programmable
inversion or XOR
product term
Up to 5 product terms
Global clock or product-term
clock
Reset control
OE control
18
I/O Block
19
I/O Block
Interfaces between internal Logic and I/O Pins.
IOB consists of an
Input Buffer
Compatible with standard 5V volt CMOS, 5VTTL and 3.3 V signal
levels.
Output Driver
Capable of supplying 24 mA output drive.
Output enable selection multiplexer
Can be generated from, A product term signal, Any of the global OE
signals
User programmable ground control
To reduce system noise generated from large number of
simultaneous switching outputs.
20
Technology Used
CPLDs are non-volatile devices, I.e retain the program after Power-off.
The EPROM, EEPROM, FastFlash are the non-volatile type of memory.
The FastFlash technology is used because of its advantage over the EEPROM.
High Performance Logic Device.
High Memory cell density
Electrical erasable
High reliability and endurance
Fast device programming times
22
1.8V core
1.5V - 3.3V I/O
SSTL, HSTL, LVCMOS,
LVTTL
Lower power
DataGATE
Clocking features
Clock Divide
CoolCLOCK
DualEDGE
3.3V core
2.7V - 5V I/O
LVCMOS, LVTTL
Low power
23
24
FPGA
Architecture and Examples
25
What is an FPGA?
Configurable
Logic
Blocks
Block RAMs
Block RAMs
I/O
Blocks
Block
RAMs
26
27
28
Select
Out
A
B
C
D
LUT
LUT
Clock
29
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
1
0
1
1
1
0
0
0
Truth-table
A
B
C
D
LUT
LUT
LUT implementation
A
B
Z
C
D
Gate implementation
30
LUT Implementation
Example: 3-input LUT
Based on multiplexers (pass
transistors)
LUT entries stored in configuration
memory cells
X1
X2
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
Configuration memory
cells
0/1
0/1
X3
31
COUT
TBUF
TBUF
Slice S3
X1Y1
Switch
Matrix
Slice S2
X1Y0
SHIFT
Slice S1
X0Y1
Slice S0
X0Y0
CIN
Fast Connects
CIN
32
Block RAM
Spartan-III
True Dual-Port
Block RAM
Port B
Port A
Block RAM
33
34
Data_A
(18 bits)
18 x 18
Multiplier
Data_B
(18 bits)
Output
(36 bits)
4x4 signed
~255 MHz
8x8 signed
~210 MHz
12x12 signed
~170 MHz
18x18 signed
~140 MHz
18 x 18 signed multiplier
Fully combinatorial
Optional registers with CE & RST (pipeline)
Independent from adjacent block RAM
35
36
37
38
Three-State
FF Enable
Clock
SR
Three-State
Control
Set/Reset
D Q
EC
Output
FF Enable
SR
Output Path
Direct Input
FF Enable
Registered
Input
D
EC
Input Path
SR
What more?
39
40
Output Path
41
Input Path
42
Programmable Interconnect
Interconnect hierarchy
Fast local interconnect
Horizontal and vertical lines of various lengths
LL
EE
LL
EE
Switch
Matrix
LL
EE
LL
EE
Switch
Matrix
LL
EE
LL
EE
43
After Programming
45
FPGA Programming/Configuration
Configuration is process of loading design and device specific bit-stream into one
or more FPGAs.
Volatile nature of FPGA makes the configuration considerations important because
the configuration is required on each power-on.
FPGAs can be programmed from PC via programming cable or the programming
file(BIT file) can be stored in a PROM.
Take care of other system modules during FPGA configuration.
46
FPGA Programming/Configuration
47
48
Actel
Anti-fuse based FPGAs
Radiation tolerant
Flash-based FPGAs
Lattice
Flash-based FPGAs
CPLDs (EEPROM)
QuickLogic
ViaLink-based FPGAs
49
50
51
52
CPLD Vs FPGA
Interconnect structure.
In-system performance.
Logic Utilization.
Applications.
53
Interconnect Structure
CPLD uses a Continuous interconnect structure :
Consists of metal lines of uniform length traverse the entire length and width of
the device.
Since the resistances and capacitances of all interconnect paths is fixed,
delays between any two logic cells can be predictable.
This minimizes the logic skew.
FPGA uses a segmented interconnect structure.
Consists of matrix of metal interconnects that run throughout the device.
Switch matrices or Antifuses join the ends of these segments allowing signals
to travel between logic cells.
Number of segments required to interconnect signals is neither constant nor
predictable, so delays are not fixed or specified until place and route is
completed.
54
Logic Utilization
Logic cells in most FPGA architecture have fine granularity, therefore more logic
cells are required to implement a function in FPGA than in a CPLD.
Logic cells in FPGA can contain only small portion of a design, so a heavy burden
is placed on its segmented interconnect structure.
As design complexity increases, the probability of routing conflicts also increases
leading to lower FPGA device utilization.
Logic density in FPGA is less due to only 9 variables, where as CPLD has 36
variables available.
55
Applications - FPGAs
FPGAs
Basically register intensive applications.
Data paths.
Hardware Emulation.
Image controller.
Battery powered applications.
Field-test equipments.
Gate-array prototyping.
56
Applications - CPLDs
CPLDs
Basically combinatorial functions.
Bus interfacings.
Comparators.
High-speed wide decoders.
Large fast state micro controllers.
High speed GLUE Logic.
System video controller.
PAL integration.
57
58
VHDL Language
Hardware Description Language (HDL)
High-level language for to model, simulate, and synthesize digital circuits
and systems.
History
1980: US Department of Defense Very High Speed Integrated Circuit program
(VHSIC)
1987: Institute of Electrical and Electronics Engineers ratifies IEEE Standard
1076 (VHDL87)
1993: VHDL language was revised and updated
Verilog is the other major HDL
Syntax similar to C language
Many tools accept both Verilog and VHDL
59
Terminology
Behavioral modeling
Describes the functionality of a component/system
For the purpose of simulation and synthesis
Structural modeling
A component is described by the interconnection of lower level
components/primitives
For the purpose of synthesis and simulation
Synthesis:
Translating the HDL code into a circuit, which is then optimized
Register Transfer Level (RTL):
Type of behavioral model used for instance for synthesis
60
61
C
D
AND
E
NOR
62
4-to-1 Multiplexer
Libraries
library
libraryIEEE;
IEEE;
use
IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_1164.ALL;
entity
entitymux
muxisis
port
port( (
a,a,b,
b,c,c,d:
d:ininstd_logic;
std_logic;
s:s:inin std_logic_vector(1
std_logic_vector(1downto
downto0);
0);
y:y:out
std_logic);
out std_logic);
end
entity
end entitymux;
mux;
architecture
architecturemux1
mux1of
ofmux
muxisis
begin
begin
process
process(a,
(a,b,
b,c,c,d,
d,s)s)
begin
begin
case
casessisis
when
when"00
"00=>
=>yy<=
<=a;a;
when
when"01"
"01"=>
=>yy<=
<=b;
b;
when
"10"
=>
y
<=
c;
when "10" => y <= c;
when
when"11"
"11"=>
=>yy<=
<=d;
d;
end
case;
end case;
end
endprocess;
process;
end
architecture
end architecturemux1;
mux1;
a
b
c
d
63
architecture
architecture rtl
rtl of
of D_FF
D_FF is
is
begin
begin
process
process (Clock,
(Clock, Reset)
Reset) is
is
begin
begin
if
if Reset
Reset == 1
1 then
then
QQ <=
0;
<= 0;
if
if rising_edge(Clock)
rising_edge(Clock) then
then
QQ <=
D;
<= D;
end
if;
end if;
end
end process;
process;
end
architecture
end architecture rtl;
rtl;
Flip-flop
D
Clock
Reset
64
Binary Counter
entity
entity counter
counter is
is
generic
(n
:
integer
generic (n : integer :=
:= 4);
4);
port
(
port (
clk
clk :: in
in std_logic;
std_logic;
reset:
in
std_logic;
reset: in std_logic;
count:
count: out
out std_logic_vector(n-1
std_logic_vector(n-1
downto
0)
downto 0)
);
);
end
use
end entity
entity counter;
counter;
use ieee.numeric_std.all;
ieee.numeric_std.all;
architecture
architecture binary
binary of
of counter
counter is
is
Signal
cnt
:
std_logic_vector(n-1
downto
Signal cnt : std_logic_vector(n-1 downto0);
0);
begin
begin
process
process (clk,
(clk, reset)
reset)
begin
begin
if
if reset
reset == '1'
'1' then
then --- async
async
reset
reset
cnt
cnt <=
<= (others
(others =>
=> '0');
'0');
elsif
rising_edge(clk)
elsif rising_edge(clk) then
then
cnt
<=
cnt
+
1;
cnt <= cnt + 1;
end
end if;
if;
end
process;
end process;
Count
<=
Count
<= cnt;
cnt;
end
architecture
end architecture binary;
binary;
65
State Machine
If a trigger signal is received, will stretch it to 2 cycles and wait for accept signal
entity
entity trigger
trigger is
is
port
(
port (
clk,
in
clk, reset:
reset:
in
std_logic;
std_logic;
trigger,
trigger, accept
accept :: in
in
std_logic;
std_logic;
active:
out
active:
out
std_logic);
std_logic);
end
end entity
entity trigger;
trigger;
curr_state
trigger
architecture
architecture rtl
rtl of
of trigger
trigger is
is
type
state_type
is
(s0,
s1,
type state_type is (s0, s1, s2);
s2);
signal
cur_state,
signal cur_state,
next_state:
next_state: state_type;
state_type;
begin
begin
registers:
registers: process
process (clk,
(clk, reset)
reset)
begin
begin
if
if (reset='1')
(reset='1') then
then
cur_state
<=
s0;
cur_state <= s0;
elsif
elsif rising_edge(clk)
rising_edge(clk) then
then
cur_state
<=
next_state;
cur_state <= next_state;
end
end if;
if;
end
process;
end process;
clk
State
State
Transition
Transition
Logic
Logic
Output
Output
Logic
Logic
accept
reset
66
S0
accept
trigger
S1
S2
clk
curr_state
State
State
Transition
Transition
Logic
Logic
Output
Output
Logic
Logic
R
67
68
RTL Simulation
Functional Simulation
Verify Logic Model & Data Flow
(No Timing Delays)
LE
MEM
Synthesis
I/O
Timing Analysis
- Verify Performance Specifications Were Met
- Static Timing Analysis
70
Design Flow
Specifications
Test Bench
Functional
Simulation
Design Entry
Pre-Layout
Simulation
Logic Synthesis
Static Timing Analysis
Post-Layout
Simulation
System partitioning
and Floor-planning
Placement and Routing
Static Timing Analysis
Programming
Production
71
72
73
Timing Issues
Basic Questions
Does my design meet a given timing requirement, or
How fast I can run the design?
Are there any chances of failures?
We know about nominal delay simulation; why not use it..?
Requires too many patterns.
Increases exponentially with the number of design inputs.
Even worse if we consider sequences needed to initialize latches.
So what we do instead..??
Separate function from time,
Determine when transitions occur without worrying about how.
74
Timing Issues
The basic idea of Static Timing Analysis is,
To find that the data is transferred through the system safely.
Instead of considering an infinitely long simulation sequence, fold all possible
transitions back into a single clock cycle.
If the design is working extremes, we can guarantee it always will.
Static part just means we arent doing simulation (dynamic).
A
B
D
Data rate?
Clock rate?
75
FPGAs - Fmax
All in MHz
76
Synchronous or Asynchronous
Synchronous designs have a clock that determines when signals should be
sampled. The signals are either sampled at the rising edge or at the falling edge of
the clock.
Unit of Time is Fixed
Asynchronous designs do not operate with a clock. Relies on handshaking
between logic. Sensitive to glitches and ordering of signals.
Unit of Time is NOT Fixed
77
Why Synchronous?
Signals are sampled at well- defined time intervals.
Interfacing two synchronous blocks is simple. Interfacing asynchronous blocks is
not simple.
Synthesis and other tools does not handle asynchronous logic very well.
FPGAs are NOT good for Asynchronous designs.
78
Timing Issues
n
k-bit
Present State
Value
Combinational
Logic
Circuit
K
DFF
Q D
k-bit
Next State
Value
k
clk
79
80
81
Fight of Titans
82
Altera Stratix-II
90nm process
Up to 1170 I/Os
1,79,000 logic elements
9.6Mb embedded RAM
96 DSP blocks: 380 18x18 multipliers
12 PLLs
Serial I/O up to 1Gb/s
No hard processor cores
84
85
86
Handshaking
FPGA
Timing
Voltage Levels
Protocols, Speed
Advantages of PLDs
88
89
Prototyping Solutions
90
Prototyping Solutions
A system model to test and develop the
product before its final implementation.
Prototyping is like headache to designers
Ease of prototyping is necessity
Flexibility is must
Individual eval boards or kits available
Need for universal platform integration
Modular approach
Up gradation and addition of modules at regular interval.
91
Prototyping Boards
Multi-vendor
device support for
Xilinx and Altera
PLDs.
All FPGA I/Os
accessible
through headers.
92
Prototyping Boards
A universal platform for various
technologies
An excellent prototyping and
system development platform
Modular approach
Modules can be integrated
according to needs
Flexible and easy up gradation
93
Prog. Port
One Platform
Keypad Interface
Box Osc.
Configuable I/Os
7 Seg Disp,
LCD interface
FPGA
FPGA
SRAM
89c51
PIC uC
Modules
ADC/DAC
..more
94
Conclusion
PLDs are
Cheaper
Faster
Bigger
More versatile
and easier to use
And obviously best choice for the system designer.
96
Thank You..!
97