Tutorial 01 FPGA Basics
Tutorial 01 FPGA Basics
Tutorial 1
Michal Kubíček
Department of Radio Electronics, FEEC BUT Brno
Vytvořeno za podpory projektu OP VVV Moderní a otevřené studium techniky CZ.02.2.69/0.0/0.0/16_015/0002430.
Agenda
page 2 [email protected]
Contact
Michal Kubíček
[email protected]
Consulting hours:
Try any day from 7 to 14, but write me an email in advance!
Department of Radio Electronics, Technická 12
office: SD6.94, 5 4114 6578
page 3 [email protected]
MPx-PLD Course
Tutorials
page 4 [email protected]
MPx-PLD Course
page 5 [email protected]
MPx-PLD Course
PC labs
❑ MPC-PLD: 13 labs, 39 points (19 minimum)
❑ MPA-PLD: 9 labs, 36 points (18 minimum)
❑ MANDATORY!
Missing? ➔ email ➔ individual task
❑ All materials on the E-learning
page 6 [email protected]
MPx-PLD Course
Points
❑ PC lab: MPC-PLD 39p / MPA-PLD 36p
minimum 50 % (19p / 18p)
❑ Final exam MPC-PLD 61p / MPA-PLD 64p
minimum 50 % from each part (30p / 32p)
▪ Written part (theory from tutorials) max. 16p / 15p, min. 8p / 7p
▪ Practical part (PC) max. 30p / 34p, min. 15p / 17p
▪ Oral part (theory from tutorials) max. 15p / 15p, min. 7b / 7p
page 7 [email protected]
MPx-PLD Course
Final Exam
❑ „Must-go“ questions ("Don't know? Come next time!")
• Set of basic questions from MPx-PLD
Examples:
What is a sensitivity list of process in VHDL?
What is a LATCH?
What is a LUT in FPGA?
What is an RTL schematic?
...
page 8 [email protected]
MPx-PLD Course
Study materials
❑ E-learning
❑ Online materials
▪ YouTube, Google
❑ Books:
▪ Clive Maxfield: The Design Warrior‘s Guide to FPGAs
▪ Bob Zeidman: Introduction to CPLD and FPGA Design
▪ Johnson, Graham: High-Speed Digital Design – A Handbook of Black Magic
▪ ...
page 9 [email protected]
MPx-PLD Course
page 10 [email protected]
MPx-PLD Course
page 11 [email protected]
MPx-PLD: what (not) to expect?
strana 12 [email protected]
MPx-PLD: what (not) to expect?
strana 13 [email protected]
My offer
strana 14 [email protected]
My offer
strana 15 [email protected]
My offer
VF Černá Hora / MU FI
❑ Proportional counters digital interface
❑ Gama / Neutron particle detection and separation
strana 16 [email protected]
My offer
strana 17 [email protected]
MPx-PLD Course
❑ http://www.openhw.eu/
❑ Registration until 28.2.2022
❑ Participants may apply to the Xilinx University Program for a
donation of a hardware platform.
The donation request must be made by the project supervisor.
page 18 [email protected]
How to start with FPGAs?
Design kits
$1499 / $399
page 19 [email protected] € 15
How to start with FPGAs?
Design kits
€59
$144
$29
$149
€39
$45 / $75
Design kits
$?? ???
$15 995
page 21 [email protected]
How to start with FPGAs?
Programming tools
€ 24 / € 34 € 240
€ 50
page 22 [email protected]
How to start with FPGAs?
RedPitaya
ARM 9 dual core + Artix-7 = SoC
Integrated fast AD and DA
converters => SDR, DAQ, radar...
page 24 [email protected]
Programmable Logic Devices
Introduction
Basics of digital logic
(... that you should already know)
page 25 [email protected]
Programmable Logic Devices
page 26 [email protected]
Basics of digital logic circuits
❑ Combinatorial
AND, OR, XOR, NOT gates and their derivatives
❑ Sequential
registers, the most important one is the edge triggered D type (flip-flop)
page 27 [email protected]
Basics of digital logic circuits
BUFFER
A Y Y=A
INVERTOR
A Y Y = !A
page 28 [email protected]
Basics of digital logic circuits
AND
A B Y=A·B Y=!(A·B)
A Y Y=A·B
B
0 0 0 1
0 1 0 1
1 0 0 1
NAND 1 1 1 0
A Y Y = ! (A · B)
B
page 29 [email protected]
Basics of digital logic circuits
AND
page 30 [email protected]
Basics of digital logic circuits
OR
A B Y=A+B Y=!(A+B)
A Y=A+B
Y
B
0 0 0 1
0 1 1 0
1 0 1 0
NOR 1 1 1 0
A Y Y = ! (A + B)
B
page 31 [email protected]
Basics of digital logic circuits
OR
page 32 [email protected]
Basics of digital logic circuits
XOR
A B Y=A + B Y=!(A + B)
A Y=A+B
Y
B
0 0 0 1
0 1 1 0
1 0 1 0
XNOR 1 1 0 1
A Y Y = ! (A + B)
B
page 33 [email protected]
Basics of digital logic circuits
page 34 [email protected]
Basics of digital logic circuits
CLK D Q Q
D Q
1 0 0 1
1 1 1 0
CLK Q
0 X QPREV QPREV
page 35 [email protected]
Basics of digital logic circuits
LATCH
❑ LATCH = statically driven (level sensitive) register
❑ When triggered (CLK is at H level), signal from its input is forwarded to
its output - including any glitches!!!
❑ Before CLK inactivation (HIGH to LOW transition) D must be stable for
a certain time.
CLK D Q
D CLK
page 36 [email protected]
Basics of digital logic circuits
page 37 [email protected]
Basics of digital logic circuits
Flip-flop
❑ Dynamically (edge) driven register (edge sensitive FlipFlop)
❑ Signal from input is transferred to the output at each active edge of CLK signal
❑ The input signal must be stable certain time before and after the active clock
edge (setup/hold time violation) => Much easier to control and verify
using CAD tools, enables unified design methodology
CLK D Q
D CLK
page 38 [email protected]
Basics of digital logic circuits
page 39 [email protected]
Integrated Circuits
...101110110111...
...010010100010...
...100101001001...
page 40 [email protected]
What is an integrated circuit?
page 41 [email protected]
What is a DIGITAL integrated circuit?
Analog
Digital
page 42 [email protected]
What is a DIGITAL integrated circuit?
Combinatorial logic A Y
B
IF A = 1 AND B = 1 THEN Y = 1
ELSE Y = 0
A B Y=A·B
0 0 0
0 1 0
1 0 0
1 1 1
page 43 [email protected]
What is a DIGITAL integrated circuit?
Combinatorial logic
A Y
B
page 44 [email protected]
What is a DIGITAL integrated circuit?
page 45 [email protected]
ASIC and ASSP
ASIC
Application Specific Integrated Circuit
❑ Very simple as well as the most complex devices, both analog
and digital (mixed signal)
❑ The best solution regarding power consumption, overal
performance and chip area
❑ Very long and expensive development (high NRE costs) ➔
suitable only for large series
❑ Very difficult to modify (debugging, innovation)
❑ Not generally available
page 46 [email protected]
ASIC and ASSP
ASSP
Application Specific Standard Part
page 47 [email protected]
Integrated circuits
page 48 [email protected]
Integrated circuits
Chip manufacturing
Masks, Chips, Testing, Packaging
page 49 [email protected]
Integrated circuits
page 50 [email protected]
Implementation of digital
circuits
(in case no suitable ASSP is
available)
page 51 [email protected]
Integrated Circuits
Integrated Circuits 74xx, CMOS 4000, ASSP Microcontrollers,
(low density integration) Microcomputers
• Microcontrollers, Microcomputers
• Custom Chips
• 74xx
CMOS 4000
• Microcontroller
• FPGA, CPLD
• ASIC 10 ks
106 ks
page 54 [email protected]
Origin of SPLD/CPLD
...101110110111...
...010010100010...
...100101001001...
page 55 [email protected]
Origin of SPLD/CPLD
page 56 [email protected]
Origin of SPLD/CPLD
74xx174 / CMOS40174
74xx00 / CMOS4000 6 x D Flip-Flop
4 x 2-input NAND
page 57 [email protected]
Origin of SPLD/CPLD
PROM structure
AND stage OR stage
decoder
Full
OR array
(summation)
OR array inputs
amplifier
(minterms)
Output
page 59 [email protected]
Origin of SPLD/CPLD
page 60 [email protected]
Origin of SPLD/CPLD
Term Minterms
1 1 0 0 1 /a·/b·c·d
1 1 0 1 1 a·/b·c·d
1 1 1 0 0 /a·b·c·d
1 1 1 1 0 a·b·c·d Sum Of Products
page 61 [email protected]
Origin of SPLD/CPLD
a b
d c b a y
0 0 0 0 0 0 1 0 1
0 0 0 1 1 c
1 0 1 0 Function XOR (XNOR)
0 0 1 0 0
0 0 1 1 1 d 0 1 0 1 4 inputs = 8 terms
0 1 0 0 0
0 1 0 1 1 1 0 1 0
0 1 1 0 0
0 1 1 1 1
1 0 0 0 0 XOR cannot be minimized ➔
1 0 0 1 1
1 0 1 0 0 high implementation demands ➔
1 0 1 1 1 ideally suitable for PROM structure
1 1 0 0 0
1 1 0 1 1
1 1 1 0 0
For simple functions the PROM structure is
1 1 1 1 1 not so efficient
page 62 [email protected]
Origin of SPLD/CPLD
page 63 [email protected]
Origin of SPLD/CPLD
SPLD structure
inputs AND product terms OR outputs
stage stage
PROGRAMMABLE FIXED
page 64 [email protected]
Origin of SPLD/CPLD
❑ PAL
• Programmable AND stage, fixed OR stage
• First commercially successful PLDs (GAL16V8, 20V8, 22V10)
❑ PLA
• Both AND and OR stages are programmable
• Slower, more expensive
• Not successful, but later the structure was reused in some CPLDs
PROGRAMMABLE FIXED
(PROGRAMMABLE)
page 65 [email protected]
Origin of SPLD/CPLD
PAL structure
PAL structure with 5 inputs and two macrocells featuring 4 terms each.
Macrocell
page 66 [email protected]
Origin of SPLD/CPLD
PAL structure
Example of combinatorial function implemented in PAL structure
d
c y
b
a
a b
0 0 0 0
c
0 0 0 1
d 1 1 0 0
1 1 0 0
page 67 [email protected]
Origin of SPLD/CPLD
PAL structure
XOR (XNOR) function: number of required terms = 2(n-1), where n is number of inputs.
3 inputs => 4 terms
a b
0 1 0 1
c
1 0 1 0
page 68 [email protected]
Origin of SPLD/CPLD
page 69 [email protected]
SPLD – PAL 16L8
OutputMacrocell
Logic Macrocell
SPLD – PAL 16R4
Origin of SPLD/CPLD
page 72 [email protected]
22V10 SPLD
Origin of SPLD/CPLD
SPLD in 80‘:
❑ Lower number of parts on board
❑ Can be used for non-standard functions
❑ Easier to change function (system modifications, debug)
page 74 [email protected]
Origin of SPLD/CPLD
page 75 [email protected]
Origin of SPLD/CPLD
page 76 [email protected]
Origin of SPLD/CPLD
SPLD today
❑ Low density of integration
❑ High power consumption
❑ Only for special application (vintage...)
http://dangerousprototypes.com/2012/10/19/7400-competition-entry-rf74xxid-a-passive-rfid-
tag-from-7400-discrete-logic/
page 77 [email protected]
Origin of SPLD/CPLD
page 78 [email protected]
Origin of SPLD/CPLD
CPLD structure
Interconnection is not complete (cannot connect anything-to-anything,
all-to-all) ➔ not so flexible, but higher performance
page 79 [email protected]
Origin of SPLD/CPLD
page 80
Origin of SPLD/CPLD
XC9500XL
❑ 36, 72, 144 or 288 macrocells
❑ 5-6 ns macrocell delay
❑ 34 to 192 user IO
❑ Non-volatile, ISP programming
❑ Core power supply 3.3V, IOs 3.3V or 2.5V
❑ IO 5V tolerant
❑ Still available (stocked), price from 1 EUR
page 81 [email protected]
Origin of SPLD/CPLD
XC9500XL
❑ IO 5V tolerant
page 82 [email protected]
Origin of SPLD/CPLD
CPLD – CoolRunner II
page 83 [email protected]
Origin of SPLD/CPLD
CoolRunner II – macrocell
page 84
Origin of SPLD/CPLD
CoolRunner II
❑ 32 až 512 macrocells
❑ Macrocell delay 3.8 to 7.6 ns (frequency 323 až 179 MHz)
❑ 33 to 270 user IO
❑ Current consumption at 50 MHz 2.5 to 55 mA (depends on size)
❑ VCCIO 1.5V, 1.8V, 2.5V and 3.3V
❑ VCC 1.8V (180 nm CMOS)
page 85 [email protected]
Origin of SPLD/CPLD
page 86 [email protected]
Origin of SPLD/CPLD
page 87 [email protected]
Origin of SPLD/CPLD
page 88 [email protected]
Origin of SPLD/CPLD
CPLD today
Traditional CPLDs are no longer developed
(the last "new" Xilinx CoolRunner2 @ 2002).
page 89 [email protected]
Origin of FPGAs
...101110110111...
...010010100010...
...100101001001...
page 90 [email protected]
Origin of FPGA
page 91 [email protected]
Origin of FPGA
Result:
Careful design is much more
expensive than
manufacturing ➔ it is better
to design faster and slightly
less efficiently
page 92 [email protected]
Origin of FPGA
Another problem:
It is not possible to verify, that a new design is
free of bugs
➔ only limited amount of testing (simulations),
try to cover only the "real-life" or most critical
aspects
➔ there are often many bugs in manufactured
chips (sometimes fixed in next revisions of the
chip)
page 93
Origin of FPGA
Advantages
❑ The basic chip is manufactured in large series for many different customers ➔ it is cheap
❑ Only small part of the design is unique ➔ faster and cheaper development
❑ Only small part of the design is unique ➔ faster and cheaper verification
page 94 [email protected]
Origin of FPGA
The idea
Basic chip with customizable layer
page 95 [email protected]
Origin of FPGA
Metalizace definovaná
uživatelem
page 96 [email protected]
Origin of FPGA
Basic chip
Transistor array
Configured chip
page 97
Origin of FPGA
Basic chip
Gate Arrays (end of 70‘s, commercially available from mid 80‘s):
Basic chip is composed of cells, which contain several transistors and resistors. The function
of the cell as well as cell interconnection is defined by user and implemented using metal
layers (in FAB). One time programmable, unsuccessful.
page 98 [email protected]
Origin of FPGA
Basic chip
Structured ASIC (beginning of 90‘, than again after 2001)
Array of prefabricated configurable cells, that are programmed using user- defined metal
layers ➔ "programming" in FAB, one time programmable.
Today used in some cases when FPGA design is mature and ready for production: there is no
need for FPGA reprogrammability, so the design (configuration) is "frozen" to metal layers.
page 99 [email protected]
Origin of FPGA
FPGA CPLD
Inputs
Function
generator
Inputs
Function Flip-
generator Flop
Synthesis
volba: IN STD_LOGIC_VECTOR(1 DOWNTO 0);
y: OUT STD_LOGIC);
END prepinac;
ARCHITECTURE Behavioral OF prepinac IS BEGIN
y <= a WHEN volba = "00" ELSE
b WHEN volba = "01" OR volba = "10" ELSE
c;
END Behavioral;
$$
$
$ $$
$ $
$
$
Synthesis
volba: IN STD_LOGIC_VECTOR(1 DOWNTO 0);
y: OUT STD_LOGIC);
END prepinac;
ARCHITECTURE Behavioral OF prepinac IS BEGIN
y <= a WHEN volba = "00" ELSE
b WHEN volba = "01" OR volba = "10" ELSE
c;
END Behavioral;
page 114
Implementation (FPGA)
Constraints
FREQ "clk" = 80 MHz
LOC "clk" = 193
LOC "Tx_data" = 87
...
page 117
Implementation (FPGA)
page 120
PAR result (Virtex-5 70FXT, 60%)
LUT + flip-flops
Global (long)
interconnection
Local (short)
interconnection
Switching matrix
Dedicated arithmetic
interconnection
FPGA - applications
• Digital signal processing (DSP)
• Software Defined Radio (SDR)
• Radar, military, aerospace
• Security, ciphering
FPGA - applications
• Data transmission – Ethernet Switches (CISCO…), SONET
• Video processing, machine vision, encoders, decoders (DVB-x…)
• Embedded applications, SoC, handheld devices
Data Centers
Data Centers