Forum Discussion

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

Timing Violations workaround strategy

Hello,

Probably I didn't properly define timing constraints ... TimeQuest reported quite a lot of timing violations.

In this connection I have one question - does exist some straightforward approach on working around "timing violations" ?

For example on the image below there are 2 screenshots form TimeQuest:

  • top screenshot - results of "Report Top Failing Paths"

  • bottom screenshot - "Peport Timing" for the path, highlighted in yellow on the top screenshot

So, in order to workaround timing violations on SDRAM data bus (blue cadre on the top screenshot) should I proceed with set_multicycle_path, e.g.:

set_multicycle_path -setup -to [get_pins {nios_led2_sdram:u0|nios_led2_sdram_sdram:sdram|za_data

[*]}] 2

set_multicycle_path -hold -to [get_pins {nios_led2_sdram:u0|nios_led2_sdram_sdram:sdram|za_data

[*]}}] 1

or there are other solutions ?

Thanks in advance.

https://alteraforum.com/forum/attachment.php?attachmentid=13535&stc=1

39 Replies

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

    Hi Jens,

    A couple of questions:

    1. Did you apply multicycle constraint at once ... or after running TimeQuest (and analyzing results) at least one time ?

    2. What is virt_100mhz_clk? Is it external clock or PLL-generated clock ?

    3. Did you try to workaround timing violations by tuning the phase shift between "sdram clock" and "sdram controller clock" ?

    Thanks

    P.S. I've just run timing analysis without multi-cycle constraint, but applying phase shift between 2 PLL-generated clocks (according to approach from embedded peripherals ip user guide, pp. 2-10 ... 2-14).

    Also I applied input and output constraints calculating them according to "demystifying timing constraints" from your link.

    Here is the content of my .SDC file:

    create_clock -name clk -period 20 create_clock -name {altera_reserved_tck} -period 40 {altera_reserved_tck}
    derive_pll_clocks
    derive_clock_uncertainty
    set_input_delay -clock altera_reserved_tck -clock_fall 3 
    set_input_delay -clock altera_reserved_tck -clock_fall 3 
    set_output_delay -clock altera_reserved_tck 3 
    create_generated_clock -name clk_ext_sdram -source .gpll~PLL_OUTPUT_COUNTER|divclk}] 
    #  Constraint SDRAM DATA for input
    set_input_delay -clock clk_ext_sdram -max 6.4 ]
    set_input_delay -clock clk_ext_sdram -min 1.0 ]
    #  Constraint SDRAM DATA for output
    set_output_delay -clock clk_ext_sdram -max 1.5 
    set_output_delay -clock clk_ext_sdram -min -0.8 
    set_multicycle_path -setup -to }] 2# set_multicycle_path -hold -to }] 1
    set_false_path -from 
    set_false_path -from 
    set_false_path -from * -to 
    set_false_path -from * -to 

    The 1st location where I consult timing violations is "Report all I/O Timings".

    There are 16 timing HOLD violations (related to SDRAM data) and 55 SETUP violations (related to all (at 1st glance) SDRAM ports).

    Surprisingly launch clock and latch clock are the same. Any comments.

    Thanks.

    Here is screenshot for HOLD violations.

    https://alteraforum.com/forum/attachment.php?attachmentid=13664&stc=1
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Pavel,

    1. Yes at once becaus the fitter is using timing constraints.

    2. It's the virtual clock for the I/O timing analysis (see Quartus II Handbook, QII5V3 2015.05.04. p. 7-14 or the TimeQuest User guide from Ryan Scoville, http://www.alterawiki.com/wiki/timequest_user_guide)

    3. No, I use the shift calculated according the Embedded Peripherals IP User Guide

    Do you drive the internal sdram_controller with the same clock as the external SDRAM device? The external clocks should be shifted. In your screenshot the launch clock should be the external shifted clock and the latch clock is the internal clock. The multicycle -setup constraint is used to tell Timequest what is the right latch edge.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Jens,

    1. yes at once becaus the fitter is using timing constraints.

    Well ... this is probably a critical point that I fail to understand: after all timing relations e.g. clock/clock, clock/interface signal are influenced by routing.

    Here I mean that fitter can be quite "smart" and will route all tracks so that NONE adjusting with PLL clock shifting or multicycle is necessary.

    But this can be known AFTER fitting is run at least one time. Or I missed something ?

    2. it's the virtual clock for the i/o timing analysis (see quartus ii handbook, qii5v3 2015.05.04. p. 7-14 or the timequest user guide from ryan scoville, http://www.alterawiki.com/wiki/timequest_user_guide)

    In these two sources virtual clock is created because it's external (i.e. generated OUTSIDE FPGA) whereas on my board both "SDRAM clock" and "SDRAM controller clock" are generated INSIDE FPGA.

    Is it also your case ?

    3. no, i use the shift calculated according the embedded peripherals ip user guide

    Ok, but I meant something other. It seems that in the "Embedded Peripherals IP User Guide" this shift is used to setup phase shift between 2 clocks, generated by PLL and it's the ONLY remedy against timing violations ... because they don't mention multicyling. My question was about eventual possibility to use ONLY phase shift for timing violation workaround (without any multicycling). Did you try this ?

    do you drive the internal sdram_controller with the same clock as the external sdram device? the external clocks should be shifted.

    No, they are driven by 2 clocks. These 2 clocks are PLL-generated and shifted one relative to other according to "Embedded Peripherals IP User Guide" procedure.

    in your screenshot the launch clock should be the external shifted clock and the latch clock is the internal clock.

    That is strange because clk_ext_sdram is actually u0...divclk.

    the multicycle -setup constraint is used to tell timequest what is the right latch edge.

    I considered that timequest is quite "smart" and capable to deduct it itself.

    After all, multicycle option isn't mandatory, how TimeQuest manage this if there is no multicycling.

    Thanks once more.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    1. If you look at the fitter messages you can see something like this:

    "Info (332104): Reading SDC File: 'project_timing.sdc'"

    I think fitter use constraints for controlling desing optimization.

    2. The virtual clock is just used outside the FPGA. No internal logic is driven from this clock but it's from the PLL inside.

    3. Yes I do. Sometimes it works. But if you want closure timing than you have to use the rigth constraints.

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

    1. Sure, it does. But once again, when you are starting to work with your design and didn't run TimeQuest, how can you know beforehand that multicycle constraint is necessary for this particular design ?

    At the beginning you have no any information how your design will be fit, isn't it ?

    I perceive applying timing constraint as "iterative" process: when starting with design the timing constraints should be as relaxed as possible ... only the mandatory ones (e.g. create_clock, etc.)

    Then, running TimeQuest and analyzing results, you apply additional constraints (e.g. multicycling) if necessary to get finally your design without timing violations.

    But applying multicycling "at once", without any feedback from TimeQuest ... frankly speaking I don't understand.

    2. So, on your board the SDRAM chip is clocked by an external clock, and NOT by one, coming from FPGA ?

    3. So, first you try to resolve timing issues using shift between two PLL-generated clocks and when this shift isn't sufficient, you use multicycling. Correct ?

    Here I didn't understand one thing: if you use (like me) two PLL-generated clocks (one - for SDRAM chip, other - for SDRAM controller), what is usage of virtual clock ? What it clocks exactly ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Pavel, you are rigth constrain timing is an iterative process.

    No the SDRAM is clocked from the FPGA. As I wrote the clock does not drive any internal logic but it comes from an internal PLL.

    This virtual clock is used to constrain the I/O timing like:

    set_output_delay -max $SDRAM_MAX_OUT_DELAY -clock virt_100MHz_clk [get_ports SD_DATA*]

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

    --- Quote Start ---

    Pavel, you are rigth constrain timing is an iterative process

    --- Quote End ---

    So, you confirm that when you start working on your project (i.e. design is accomplished in Quartus/Qsys, but isn't compiled yet), you have no any idea how how design will be fit during compilation.

    Consequently you can't apply any "hard" constraints (e.g. multicycling), but only the very basic ones (i.e. creating clocks), isn't it ?

    That's why I was surprised when you said that you apply "multicycling" constraint "at once" (i.e. without preliminary compilation or TimeQuest run).

    Or I misunderstood your approach ?

    --- Quote Start ---

    No the SDRAM is clocked from the FPGA. As I wrote the clock does not drive any internal logic but it comes from an internal PLL.

    --- Quote End ---

    If you have no any additional clocks on your board (except basic clock), what sense to create virtual clock ?

    In all manuals virtual clock is created to "emulate" some external clock.

    --- Quote Start ---

    This virtual clock is used to constrain the I/O timing like:

    set_output_delay -max $SDRAM_MAX_OUT_DELAY -clock virt_100MHz_clk [get_ports SD_DATA*]

    --- Quote End ---

    Why not use PLL-generated clock for this ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I use all timing constraints in every synthesis run (not just for timing analysis with Timequest). Finding the right ones it's an iterative process. Before you can run Timequest you have to do a complete fit. First I assign basic constraints (base clocks, virtual clocks, I/O delays, derive_pll_clocks, derive_clock_uncertainty, set_clock_groups)

    The virtual clocks are for I/O timing analysis, please refer TimeQuest Timing Analyzer Cookbook (MNL-01035 2016.2.25, page 9)

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

    For internal paths on 150MHz that is a design issue and basically 150MHz should not be a problem in many fpgas.