Tutorial 07 FPGA Clock Signals
Tutorial 07 FPGA Clock Signals
Tutorial 7
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.
Tutorial 7
page 2 [email protected]
Clock signals in FPGA
page 3 [email protected]
Clock signals in FPGA
Clocking infrastructure
On FPGA there are many components related to the clock signal distribution and
management. Together they are called CLOCK RESOURCES.
❑ Dedicated network for clock signal distribution – clock tree (low-skew, high-
fanout). Large FPGAs feature several levels of clock distribution system (regional /
global).
❑ Buffers and multiplexers for clock signal inputs, signal conditioning, switching...
❑ Blocks for clock signal modification - Clock Management; based on PLL or DLL.
page 4 [email protected]
Clock signals in FPGA
Clock tree
• Low skew, Low propagation delay: same (low) delay from a source buffer
(BUFG, BUFH...) to all destination nodes
• Primarily for clock distribution but can be used for other high fanout signals, like
CLOCK ENABLE, SET/RESET....
KČ3
page 5 [email protected]
Clock signals in FPGA
Example:
Spartan-3E
page 6
Clock signals in FPGA
Example:
Virtex-7
page 7
Clock signals in FPGA
page 8
Clock signals in FPGA
page 9
Clock signals in FPGA
page 10 [email protected]
How to use the clock resources
page 11 [email protected]
Clock signals in FPGA
page 12 [email protected]
Clock signals in FPGA
Not reliable!!!
page 13 [email protected]
Clock signals in FPGA
Not reliable!!!
page 14 [email protected]
Clock signals in FPGA
Manual instantiation
Library UNISIM;
use UNISIM.vcomponents.all;
...
BUFGCE_inst : BUFGCE
port map (
O => O, -- Clock buffer output
CE => CE, -- Clock enable input
I => I); -- Clock buffer input
page 15 [email protected]
Clock signals in FPGA
Manual instantiation
Library UNISIM;
use UNISIM.vcomponents.all;
...
BUFGMUX_inst : BUFGMUX
port map (
O => O, -- Clock MUX output
I0 => I0, -- Clock0 input
I1 => I1, -- Clock1 input
S => S); -- Clock select input
page 16 [email protected]
Clock signals in FPGA
page 17 [email protected]
Clock signals in FPGA
page 18 [email protected]
Clock signals in FPGA
Library UNISIM;
use UNISIM.vcomponents.all;
clk_50_PIN clk_50
page 20 [email protected]
Clock signals in FPGA
page 21 [email protected]
Clock signals in FPGA
Clock Management
Blocks for clock signal
conditioning
CMT, DCM, PLL, DLL, MMCM...
page 22 [email protected]
Clock signals in FPGA
page 23 [email protected]
Clock signals in FPGA
page 24
Clock signals in FPGA
page 25 [email protected]
Clock signals in FPGA
page 26 [email protected]
Clock signals in FPGA
page 27 [email protected]
Clock signals in FPGA
page 28 [email protected]
Clock signals in FPGA
page 29 [email protected]
Clock signals in FPGA
page 30 [email protected]
Clock signals in FPGA
page 31 [email protected]
Clock signals in FPGA
DCM clk_100M
clk_250M
reset Locked
page 32 [email protected]
Clock signals in FPGA
DCM clk_100M
clk_250M
reset Locked
page 33 [email protected]
Clock signals in FPGA
clk_50M
clk_100M
In this case the clk_50M a clk_100M clock domains are synchronous ➔ there is no need to
use synchronizers on these clock domain boundaries to transfer data or control signals. Static
timing analysis tool can correctly analyze all the necessary timing parameters.
page 34 [email protected]
Clock signals in FPGA
clk_100M T=10 ns
clk_120M T=8.33 ns
1.66 ns
In this case the clk_100M and clk_120M domains are also synchronous but because of specific
frequency difference there are situations where the timing budget is very tight (1.66 ns in this
case). This effectively requires usage of synchronizers in between these clock domains (they
must be treated as asynchronous).
The STA is considering all the possible edge delay combinations and requires the design to meet
the most strict one (worst case) to meet SETUP and HOLD requirements.
page 35 [email protected]
Clock signals in FPGA
VIVADO example
page 36 [email protected]
Slow clock signals
page 37 [email protected]
Slow clock signals
clk_slow
clk_fast
page 38 [email protected]
Slow clock signals
clk
Ideal
clk_div
Real
clk_div
page 39 [email protected]
Slow clock signals
clk
Ideální
clk_div
Skutečné
clk_div
page 40 [email protected]
Slow clock signals
D Q clk_div
clk
page 41 [email protected]
Slow clock signals
page 42 [email protected]
Slow clock signals
clk_div clk_div_BUFGOUT
page 43 [email protected]
Slow clock signals
BUFG_inst : BUFG
PORT MAP (
O => clk_div_BUFGOUT,
I => clk_div );
!!!
clk_div BUFG clk_div_BUFGOUT
Slow clock signals
The delay between primary an derived clock domain may cause SETUP / HOLD timing problems on
signals crossing clock domain boundary ➔ synchronizers are a must!
There is no problem with a large logic load (large fan-out) of the clock net as the global clock
tree is designed for that.
page 45 [email protected]
Slow clock signals
A better solution?
❑ Clock enabling – any lower frequency can be used (with a resolution of
primary clock period).
page 46 [email protected]
Clock Enabling
page 47 [email protected]
Slow clock signals
Clock Enabling D Q
All the Flip-Flops in the design (even those that should run on a slow CE
clk
CE
page 48 [email protected]
Slow clock signals
Clock Enabling
0
D 1 D Q D D Q
Clock Enable CE
Clock Enable clk
clk
page 49 [email protected]
Slow clock signals
clk_EN
1:5 => 1/5 * 125 MHz = 25 MHz
page 50 [email protected]
Slow clock signals
Clock Enabling
clk
Main (system) clock signal 125 MHz
EN_1
1:1 => 1/2 * 125 MHz = 62.5 MHz
EN_2
1:3 => 1/4 * 125 MHz = 31,25 MHz
EN_3
1:4 => 1/5 * 125 MHz = 25 MHz
page 51 [email protected]
Slow clock signals
clk_EN
Not for FPGAs!
clk_in D Q
0 clk_sys
page 52 [email protected]
Slow clock signals
Allowed usage of CE
For Clock Gating it is necessary to use a dedicated glitch-free clock buffer with
enable input (not available in all FPGAs).
Library UNISIM;
use UNISIM.vcomponents.all;
...
BUFGCE_inst : BUFGCE
port map (
O => clk_sys, -- Clock buffer output
CE => clk_EN, -- Clock enable input
I => clk_in); -- Clock buffer input
page 53 [email protected]
Slow clock signals
❑ Instead of generating very slow signals it is often much more efficient to use a
small microcontroller (a soft IP core) that can run on a relatively high clock
frequency (as the rest of the design).
❑ Any slow actions (delays) are software defined with no additional HW cost.
❑ Once used the microcontroller can often adopt other task (especially a more
complex algorithmic ones) to offload the logic.
❑ The use of a microcontroller for such tasks usually results in a significant saving
of hardware resources (LUTs, Flip-Flops)
page 54 [email protected]
Thank You for Your Attention!