2022 06 15 FPGA Lecture HS
2022 06 15 FPGA Lecture HS
Field Programmable
Gate Arrays
Hannes Sakulin
CERN / EP-CMD
3
Digital electronics
4
The building blocks: logic gates
Truth table C equivalent
OR gate q = a || b;
Exclusive OR gate A
Q q = a != b;
XOR gate B
…
5
Combinatorial logic (asynchronous)
Outputs are determined
by Inputs, only
A B Cin S Cout
0 0 0 0 0
1 0 0 1 0
0 1 0 1 0 Combinatorial logic may
1 1 0 0 1 be implemented using
Look-Up Tables (LUTs)
0 0 1 1 0
1 0 1 0 1
0 1 1 0 1
1 1 1 1 1 LUT = small memory 6
(Synchronous) sequential logic
set
D Flip-flop:
samples the data at the rising
data Output (or falling) edge of the clock
clock Inverted output The output will be equal to
the last sampled input until the
reset next rising (or falling) clock edge
+ =
9
Long long time ago …
10
Simple Programmable Logic Devices (sPLDs)
a) Programmable Read Only Memory (PROMs)
Late 60’s
and flip-flops
Coarse grained
100’s of blocks, restrictive structure
(EE)PROM based 14
FPGAs …
15
FPGAs
(extremely flexible)
17
Typical LUT-based Logic Cell
Clock trees guarantee that the clock arrives at the same time at all flip-flops
19
Clock Managers
Daughter clocks
may have multiple
or fraction
of the frequency
20
Embedded RAM blocks
22
Digital Signal Processor (DSP)
23
Soft and Hard Processor Cores
Soft core
Design implemented with
the programmable
resources (logic cells) in
the chip
Hard core
Processor core that is
available in addition to the
programmable resources
E.g.: Power PC, ARM
24
General-Purpose Input/Output (GPIO)
26
Components in a modern FPGA
27
Programming techniques
28
Fusible Links (not used in FPGAs)
29
Antifuse Technology
30
EPROM Technology
Erasable Programmable Read Only Memory
Intel, 1971
31
EEPROM and FLASH Technology
Electrically Erasable Programmable Read Only Memory
34
Summary of Technologies
Rad-tolerant
secure
Rad-tolerant
(e.g. Alice)
Used in most
FPGAs
35
Design Considerations (SRAM Config.)
36
Configuration at power-up
stores
Flash single or
PROM multiple
designs
JTAG
Flash connector
PROM
FPGA
( SRAM based )
...
Flash
PROM FPGA PCI, VME
JTAG bus
FPGA
( SRAM based )
...
Lattice Semiconductor
SRAM based with integrated Flash PROM
low power 40
Trends
41
Ever-decreasing feature size
Higher capacity
Higher speed
Lower power
consumption
Xlinix Zynq
45
FPGA development
46
Design entry
Schematics Hardware description language
VHDL, Verilog
entity DelayLine is
generic (
n_halfcycles : integer := 2);
port (
x : in std_logic_vector;
x_delayed : out std_logic_vector;
clk : in std_logic);
48
Hardware Description Language
Looks similar to a programming language
BUT be aware of the difference
Programming Language => translated into machine
instructions that are executed by a CPU
HDL => translated into gateware (logic gates & flip-flops)
Common HDLs
VHDL
Verilog
Newer trends
High Level Synthesis (HLS) from C/C++
Other C-like languages (handle-C, System C)
Labview
49
Example: VHDL
Asynchronous logic Looks like a
All signals in sensitivity list
programming
language
All statements
Synchronous logic
Only clock (and reset) in sensitivity list
executed in
parallel, except
inside
processes
50
Schematics & HDL combined
51
C/C++
Design flow High Level
Synthesis
Commercial
State IP Integrator Intellectual Property
constraints Schematics VHDL / Verilog
Machines cores
Pins Processors
Counters Interfaces
Timing
FIFOs Controllers
Area
… …
…
Behavioral
Simulation
Synthesis
Timing
Simulation
Programming file 52
Floorplan (Xlinx Virtex 2)
53
Manual Floor planning
55
Embedded Logic Analyzers
57
First-Level Trigger at Collider
Timing: beam crossings
LHC: 25 ns
detector
Coarse grain data
Full data
(fine grain)
Delay First Level Trigger Fixed Latency
FIFO (= processing time
Pipelined of the first
Logic level trigger)
N beam crossings
Trigger decision YES / NO
(for every beam crossing )
De-
randomizer Latency should be short
FIFO
In order to limit the length
of the delay FIFOS 58
Pipelined Logic
Processing Processing Processing Trigger
data from data from data from decision
beam beam beam for beam
crossing crossing crossing crossing
4 3 2 1
...
Combinatorial logic
Flip flop
Clocked with same clock as collider
59
Pipelined Logic – a clock cycle later
Processing Processing Processing Trigger
data from data from data from decision
beam beam beam for beam
crossing crossing crossing crossing
5 4 3 2
...
Combinatorial logic
Flip flop
Clocked with same clock as collider
60
Why are FPGAs ideal for First-Level Triggers ?
Many inputs
Data from many parts of the detector
has to be combined
64
Micro-TCA board for Run 2&3
CMS trigger based on Virtex 7
360 Gb/s
36 x
10 Gb/s
Rx
Tx
Rx
Tx
Serenity, UK APX, US
Few types of generic boards, ATCA standard
Xilinx Virtex/Kintex Ultrascale+ FPGAs
25-28 Gb/s optical links
SoC FPGAs used for board control (on some boards)
Advanced firmware algorithms
Vertex finding
Particle flow
Neural network classifiers 66
Neural Networks in Trigger
One or many hidden layers
Principle
Node is assigned a value based
on the weighted sum of nodes in
the previous layer
Maps well to DSP resources in
FPGA (multiplier + adder)
Applications:
Jet classification
Assignment of transverse
momentum based on many
measurements
By Glosser.ca - Own work, Derivative of File:Artificial neural network.svg, CC
…
BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=24913461
Tools
Many commercial tools
hls4ml (optimized for latency)
Firmware generation from
high-level model using Vivado
HLS 67
FPGAs in Data Acquisition
Frontend & Backend Electronics
Pedestal subtraction
Zero suppression
Compression
…
SLINK (ATLAS)
DDL (ALICE)
Custom
data
Commercial Myrinet Network link out
Interface Card on internal PCI bus
Custom data
link in
SLINK-64 input
LVDS / copper
Clock,
control
73
J.P. Cachemiche, ACES 2018
CMS DTH (DAQ and Timing Hub) for HL-LHC
DAQ FPGA
Custom data Zynq SoC FPGA
link in for control
Commercial
data link
(TCP/IP) out
Rear
transition
module DTH prototype 2
Clock & control Main board Clock & control distribution
uplink via backplane
You are going to design the digital electronics inside this FPGA !
76
Lab Session 13: System-on-a-chip FPGA
PYNQ-Z2 board
Xilinx Zynq w. dual-core ARM
78
Acknowledgement
Parts of this lecture are based on material by Clive Maxfield, author
of several books on FPGAs. Many thanks for his kind permission to
use his material!
Re-use
Re-use of the material is permitted only with the written
authorization of both Hannes Sakulin ([email protected])
and Clive Maxfield.
79