Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

setup and hold time with set_input_delay

Hello,

I have some problem understanding the set_input_delay min and max

constraint.

Assume that you have an interface that is connected to an FPGA.

This interface has a clock (Clk) and a databus (DB).

The datavalid window is centered around the rising edge of Clk. Assume

a setup time of 1ns and a hold time of 2 ns. The clk period is 10 ns.

How should I constrain this with the set_input_delay command?

thanks for helping me,

22 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Ok many thanks Rysc for this useful explanation! Timequest documentation is not really easy to understand...

    Yet I have a question about this:

    1) I do not understand why there is no relation between fpga_clk and the virtual ext_clk ? fpga_clk could not be created from ext_pll using create_generated_clock ?...

    (moreover there is a Quartus warning about this:" Warning: From ext_clk (Rise) to fpga_clk (Rise) (setup and hold) "

    2)I don't know why "Report Fmax summary" is not available In Timequest report? It says "No paths to report", yet there is a path!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    1) Create a constraint on the clock coming in. Something like the following(I'm typing all constraints from memory, so syntax may be off):

    create_clock -name fpga_clk -period 10.0 [get_ports clk_in]

    2) Create an external clock. (Users should always create a virtual external clock for I/O interfaces. This isn't emphasized enough in the documentation.) Since your clock coming in is phase-shifted, you can phase-shift it externally:

    create_clock -name ext_clk -period 10.0 -waveform {5.0 10.0}

    This basically phase-shifts the clock 180 degrees. Note that there are variations on this. You could have the external clock not be phase-shifted and phase-shift the fpga_clk. The analysis will end up being the same.

    3) Add I/O constraints with 0.0ns delays, just as a place holder.

    set_input_delay -clock ext_clk -max 0.0 [get_ports din*]

    set_input_delay -clock ext_clk -min 0.0 [get_ports din*]

    4) Undestand the setup and hold realtionship between ext_clk and fpga_clk. You can run TimeQuest and do a report_timing -setup and -hold between these two clocks. But just drawing the waveforms, it's pretty obvious the requirements are a 5ns setup time and a -5ns hold requirement.

    5) Change the delay values to match your external delays. I don't follow your descriptions of "Assume a setup time of 1ns and hold time of 2ns". How much could the data come out before the clock, including board delays. If that's 4ns, then your -max delay should be 4ns and since the setup requirement is 5ns, TimeQuest is left trying to meet a 1ns setup time. If you're saying it could be delayed by as much as 1ns, then have that be the -max delay.

    For the hold, if the data may leave by as much as 2ns after the clock, the the -min delay is -2ns. Since the hold requirement is -5ns, then only if the dta is held by another -3ns will it fail timing.

    The language of setup and hold always seems confusing, especially the sign. Just start putting in numbers, rerunning TimeQuest and analyzing the setup and hold on the input paths. Look at the waveform to see if the analysis it is doing is what you want.