| fpga4fun.com - where FPGAs are fun. |
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.
An FPGA can use multiple clocks (using multiple global lines and dedicated input pins). Each clock forms a "clock domain" inside the FPGA.
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?
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.
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.