3

I am working on a design with a Cyclone-V FPGA.

  • I have a PLL that generates 4 clocks of equal frequency but with 90 degree phase shift from eachother.
  • 4 DFFs running on each of these respective clocks. The outputs of these 4 DFFs are connected to a 4:1 mux.
  • I would like the outputs of the 4 DFFs going into the mux to have equal path delay (or equivalently path delay to the output of the mux).
  • The output of this mux is a clock connected to a global clock buffer.
  • The mux selects only switch when all 4 mux inputs are low and will be low for a long time. Therefore, we are not concerned with constraining the mux select path.
  • All of the circuitry is internal to the FPGA (no I/O)

The clocks are defined here:

create_clock -name {CLK_250_IN_g[0]} -period 4.000 -waveform { 0.000 2.000 } [get_pins { inst_pllgclkbuff4_cve_CLK_250_IN|inst_cycloneve_clkctrl[0].inst_cyclonev_clkena0|outclk }]
create_clock -name {CLK_250_IN_g[1]} -period 4.000 -waveform { 1.000 3.000 } [get_pins { inst_pllgclkbuff4_cve_CLK_250_IN|inst_cycloneve_clkctrl[1].inst_cyclonev_clkena0|outclk }]
create_clock -name {CLK_250_IN_g[2]} -period 4.000 -waveform { 2.000 4.000 } [get_pins { inst_pllgclkbuff4_cve_CLK_250_IN|inst_cycloneve_clkctrl[2].inst_cyclonev_clkena0|outclk }]
create_clock -name {CLK_250_IN_g[3]} -period 4.000 -waveform { 3.000 5.000 } [get_pins { inst_pllgclkbuff4_cve_CLK_250_IN|inst_cycloneve_clkctrl[3].inst_cyclonev_clkena0|outclk }]

Schematic

I attempted to achieve this by constraining this path with set_max_delay and set_min_delay in my sdc (there are 4 copies of these constraints for each of the 4 registers).

set_max_delay -from [get_cells {inst_clkgen_a|inst_clkgen_phases|CLKOUT_phases[0]}] -to [get_cells {inst_clkgen_a|inst_mux4_1_CLK_OUT|Mux0}] 0.100
set_max_delay -from [get_cells {inst_clkgen_a|inst_clkgen_phases|CLKOUT_phases[1]}] -to [get_cells {inst_clkgen_a|inst_mux4_1_CLK_OUT|Mux0}] 0.100

set_min_delay -from [get_cells {inst_clkgen_a|inst_clkgen_phases|CLKOUT_phases[0]}] -to [get_cells {inst_clkgen_a|inst_mux4_1_CLK_OUT|Mux0}] 0.000
set_min_delay -from [get_cells {inst_clkgen_a|inst_clkgen_phases|CLKOUT_phases[1]}] -to [get_cells {inst_clkgen_a|inst_mux4_1_CLK_OUT|Mux0}] 0.000

This is making no difference to the path delay from the Q output to mux.out. The resulting path delays are shown in the circuit diagram, indicating the min/max constraints are not working.

How is possible to accomplish this?

Mitu Raj
  • 10,843
  • 6
  • 23
  • 46
cplusruss
  • 85
  • 3
  • Yah, it is difficult to put delay under ... manipulation (control sounds a bit far from what we are trying). Sometimes, people play with .. let me recall.. CELL or LCELL(?) selection or placement. IIRC, there was some version of PLD with something like delay-line element, I might be too wishful. – jay Nov 09 '21 at 17:41
  • Jay, thanks. Will look into that. I saw another post here using delay lines, so I can give that a shot. – cplusruss Nov 09 '21 at 20:49

2 Answers2

3

Your clock constraints look fine. Your delay constraints look fine as well.

min/max constraints are not working

That's not what you should interpret from the Timing Analyser's report. You asked for \$0.1 \text{ ns}\$ max path delay, which looks unrealistic for the Timing Analyser to achieve on that path on a Cyclone-V FPGA. Around \$1 \text{ ns}\$ is the best it could come up with. In other words, your design has failed to achieve the timing requirements specified by you. Not that the constraints are wrong.

I would like the outputs of the 4 DFFs going into the mux to have equal path delay

You should not worry about getting exact path delays, as it doesn't make much sense on timing paths on a clocked synchronous design. And no Timing Analyser and Synthesiser can place and route at the exact path delays as the user wishes. You can specify only a range within which the delay should be constrained to: (min , max). Synthesiser will attempt to route your design accordingly, meeting setup and hold requirements as derived from the (min, max) constraints.

Mitu Raj
  • 10,843
  • 6
  • 23
  • 46
  • Mitu, fantastic. Thanks so much. I sort of had a hunch that the min/max was too much, but wasn't seeing any violation in the report. Will try with some bigger numbers -- like min 4 nsec, max 4.2 nsec or something like that. – cplusruss Nov 09 '21 at 20:29
  • Mitu, this design is not synchronous (no registers on the output of the mux) -- do you know if the set_min_delay actually *adds* routing delay? – cplusruss Nov 09 '21 at 20:45
  • 1
    FPGAs are used for synchronous designs and you have clock in your design. The path you talk about may or may not be synchronous. It depends on where this signal is actually going to. Maybe it's going to another flop sitting inside/outside the FPGA which is driven by the same or another synchronous clock? In that case, it is synchronous reg-to-reg path. You have not provided that information though. – Mitu Raj Nov 09 '21 at 20:52
  • `set_min_delay` will only convey the minimum delay you target on that path. The Timing Analyser tries to achieve it during synthesis and place and route and finally computes the actual logic + routing delay on that path, and then reports the slack. ie., the difference between your requirement and the actual delay. – Mitu Raj Nov 09 '21 at 20:56
  • Thanks Mitu. Yes, that's true. Technically speaking, the output of this mux goes to a pin. I might want to constrain to that. – cplusruss Nov 09 '21 at 21:10
  • In that case, I guess this is reg-to-IO path. But I am not sure why DFFs are used here. – Mitu Raj Nov 09 '21 at 21:17
  • Yep. Thanks for your help. DFFs are used before the mux to pipeline some logic before it that is not shown in the logic diagram (the D inputs are shown unconnected). Yes, it's a reg-to-IO path. My main problem is getting delays to work at all. It's like the timing analyzer is ignoring them altogether. With a 10 nsec min_delay, I'm still getting like ~ 1.4 nsec numbers. – cplusruss Nov 09 '21 at 21:41
  • In Xilinx, virtual clocks are recommended to be used along with set_min and set_max delays to properly use this constaint. You may want to look into it for Intel FPGAs as well. – Mitu Raj Nov 09 '21 at 21:52
0

Set max skew constraint in your SDC file. Here is a link that shows the command.

https://www.intel.com/content/www/us/en/docs/programmable/683243/21-3/maximum-skew-set-max-skew.html

The example below sets the max skew to 0.2 ns.

set_max_skew -from [get_registers {CLKOUT_phases[0] CLKOUT_phases[1] CLKOUT_phases[2] CLKOUT_phases[3]}] -to [get_ports {CLK_OUT}] 0.2 
Jakub Rakus
  • 2,225
  • 5
  • 18
  • 26
Travis
  • 1
  • 1