fpga4fun.com - where FPGAs are fun.
Home
Welcome
Information


FPGA projects
Music box
Pong game
R/C servos
Text LCD module
Quadrature decoder
PWM and one-bit DAC
Debouncer
LED displays
Crossing clock domains
External contributions

FPGA interface projects
RS-232
JTAG
I2C
EPP
SPI
CNC steppers

FPGA advanced projects
Graphic LCD panel
Digital oscilloscope
10BASE-T interface
PCI interface
Spoc CPU core

Hands-on
A simple oscilloscope


FPGA introduction
What are FPGAs?
How FPGAs work
FPGA pins
Clocks and global lines
Download cables
Configuration
Learn more

FPGA software
Design software
Pin assignment
Design-entry/HDL
Simulation/HDL
Synthesis and P&R

FPGA electronic
SMD technology
Crystals and oscillators

HDL info
HDL tutorials
Verilog tips
VHDL tips

Quick-start guides
ISE
Quartus

Site
News
FPGA links
HDL tutorials
Forum


Clocks and Global lines

An FPGA design is usually "synchronous". Simply put, that means that the design is clock based - each clock (rising edge) allows the D-flipflops to take a new state.

In a synchronous design, a single clock may drive a lot of flipflops simultaneously. That can cause timing and electrical problems inside the FPGA. To get that working properly, FPGA manufacturers provide special internal wires called "global routing" or "global lines". They allow distributing the clock signal all over the FPGA with a low skew (i.e. the clock signal appears almost simultaneously to all the flipflops).

When you feed a clock signal to your FPGA, you shouldn't use any FPGA pin, but use a "dedicated input pin". Usually, only such input pins have the ability to drive a global line. Check the FPGA datasheet to find which pins are the "dedicated inputs".

FPGA software are aware of these dedicated inputs, and will automatically assign clocks to them if given the choice.

Clock domains

An FPGA can use multiple clocks (using multiple global lines and dedicated input pins). Each clock forms a "clock domain" inside the FPGA.

Flipflops and combinatorial logic in each clock domain

For each flipflop inside the FPGA, its clock domain is easy to determine. Just look at the flipflop clock input.
But what about the combinatorial logic that sits in between flipflops?

Clock domain speeds

For each clock domain, the FPGA software will analyze all flop-to-flop paths and give you a report with the maximum allowed frequencies. In the general case, only the paths from within each clock domains are analyzed. The synchronizer paths (from different clock domains) usually don't matter and are not analyzed.

One clock domain may work at 10MHz, while another may work at 100MHz. As long as each clock uses a global line, and you use clock speeds that are lower than the maximums reported by the software, you don't have to worry about internal timing issues, the design is guaranteed to work internally timing-wise.

There may still be some timing issues from the FPGA input and output pins though. The software will give you a report about that. See also the next section.

Signals between clock domains

If you need to send some information across different clock domains, special considerations need to apply.

In the general case, if your clocks have no relationship with each other, you cannot simply use a signal generated from one clock domain into another. Doing so would violate setup and hold flipflop timings (in the destination clock domain), and cause metastability.

Crossing clock domains requires special techniques, like the use of synchronizers (that's simple), or FIFOs (that's more complicated).

More info here, here and here.



>>> NEXT: FPGA download cables >>>



This page was last updated on January 17 2008.