Electronic – Achieving low-frequency clocks in FPGA fabric when below what PLL can provide

fpga

I have a 100 MHz reference clock source coming in from the XTAL on the board (Xilinx). As a trivial example, I wish to build a 1Hz virtual clock to drive a real-world clock/timer.

Now, as I see it, the Clocking Wizard is incapable of producing a frequency that low using PLL primitives or even if it were capable, the jitter and inaccuracy would be atrocious.

So that leaves me with a couple of options:

  • Use the Clocking Wizard to produce a clock which is ~an order of magnitude slower than the XTAL, then use a traditional counter divider to reach 1 Hz.

  • Directly use a traditional counter divider to reach 1 Hz.

My reasoning is that the first solution would help improve efficiency by minimising switching power losses, but both solutions don't feel particularly efficient to me.

Is there a way that I can achieve a very slow clock which is also not burning up millions of cycles just to count?

Best Answer

Do not use Clocking Wizard to generate timing pulses for external use, as SCL serial clocks for I2C or SPI protocol or whatever else. The Clocking Wizard application area is stated in a Vivado Design Suite document Clocking Wizard v6.0 LogiCORE IP Product Guide, page 7:

Applications

  • The creation of clock networks with the required frequency, phase, and duty cycle, with reduced jitter.
  • Electromagnetic interference reduction in electronic devices using the Spread Spectrum feature.

The creation of clock networks for use within your FPGA chip, and not of clock pulses/signals that may be used elsewhere.

Read also about clock networks, clock routing and other clocking features, what these do in your FPGA and why these are outright waste of resources to carry your "1Hz virtual clock" signals.

If you want to build "a 1Hz virtual clock" as an exercise in building resource-optimized variable length shift registers, follow instructions from a Vivado Design Suite document RAM-Based Shift Register v12.0 LogiCORE IP Product Guide or similar documents of your choice. The output of your "virtual clock" generating circuit goes to an output IO pin, and not to a clock region; you need not route this signal around within your FPGA.

If you are interested in how the design tools implement your VHDL/Verilog code, read about slice registers/slice LUTs/distributed RAM.

Do not worry about "burning up millions of cycles just to count": FPGA is made to run millions and even more of cycles; IP cores take care of optimizing power and resource costs to help FPGA do a useful job. Just notice that for tasks similar to your hypothetical task, the hardware solutions sort of RTC chips with 32.768KHz crystals are recommended.