Forum Discussion

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

Constraining SDRAM

Hello,

I have a very strange issue on my EP3C55F484, when sometimes Nios II processor works, sometimes - not. One minute I am able to upload the binary, it works fine for a half of a day even if I do a dozen times of re-upload and debug, but suddenly *bam*, it doesn't allow to upload a new binary:


Pausing target processor: not responding.
Reseting and trying again: FAILED
Leaving target processor paused

Sometimes it happens on the beginning of a day, sometimes at the end of the day, but there are no tendencies - completely random issue. I've checked hardware - everything should be fine, all voltages are correct. PLL working fine, no lock losses.

My constraints are not complete or bad, I am not sure where I am doing a mistake, so let's look what I have:

SDRAM chip: Micron MT48LC4M16A2P-75 - datasheet here. (http://www.micron.com/parts/dram/sdram/~/media/documents/products/data%20sheet/dram/47264msdram.ashx)

The Qsys design runs on 62.5MHz, clocked from PLL output 0. The SDRAM chip itself, is clocked @ 62.5MHz -3ns phase shift, PLL output 1.

TimeQuest reports Fmax of 71.5MHz

The first thing to do is to define timing parameters from datasheet:


set SDRAM_PCB_DELAY 0.10
set SDRAM_ACCESS 5.40
set SDRAM_DATA_OUT_HOLD 3.00#  CS#, RAS#, CAS#, WE#, DQM, ADDRESS - will be named as MISC
set SDRAM_MISC_HOLD 0.80
set SDRAM_MISC_SETUP 1.50

Then, I need to define a clock and its output delay:


create_generated_clock -name sdram_sys_clk_pin -source {PLL0|altpll_component|auto_generated|pll1|clk} 
set_output_delay -clock sdram_sys_clk_pin $SDRAM_PCB_DELAY 

Now, constrain I/Os:


set_input_delay -clock sdram_sys_clk_pin -min  }]
set_input_delay -clock sdram_sys_clk_pin -max  }]
set_output_delay -clock sdram_sys_clk_pin -min   sdram_sys_ba
 sdram_sys_dqm
 sdram_sys_ras_n sdram_sys_cas_n sdram_sys_cs_n sdram_sys_we_n}]
set_output_delay -clock sdram_sys_clk_pin -max   sdram_sys_ba
 sdram_sys_dqm
 sdram_sys_ras_n sdram_sys_cas_n sdram_sys_cs_n sdram_sys_we_n}]

Set relationship between clocks:


set_min_delay -0.60 -from {PLL0|altpll_component|auto_generated|pll1|clk} -to {sdram_sys_clk_pin}
set_max_delay 0.52 -from {PLL0|altpll_component|auto_generated|pll1|clk} -to {sdram_sys_clk_pin}

At this point, I should constraint all paths using multicycles, but I am not sure, how multicycles would work in this case. If I add set_max_delay, then the delays are way too long: TQ says I need to add almost 10ns delay, which is strange..?

I am attaching result of: report_timing -setup -npaths 100 -detail full_path -file "TQ_100worstpaths.txt"

You'll see, that I am using 5 SDRAM controllers: 1 for Nios and 4 buffer for data, but the issue is the same for all. It fails timing between I/O pin and first data register (qsys_system|etc|some|controller|stuff|za_data

[*])

P.S. I don't get any hold/removal/recovery violations for that particular clock.

Maybe someone could point me how to solve that setup violation problem and what am I doing wrong? Thank You.

14 Replies

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

    I did try with -1ns, but that didn't help.

    I am observing interesting thing. I've routed sys_clk signal to debug output pin and set the PLL phase difference between sys_clk and sdram_chip_clk to -6ns. The scope shows me, that the difference between these two signals is -3.2ns. I didn't check that before, but if there's such a huge difference, then I believe I had way much smaller phase difference, when used PLL settings for -3ns. So far, the design is working fine with -6ns @ PLL settings, but as You may know, I still see problems in TQ. Maybe adding max delays will help.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I've tried to set phase difference to -10.2ns. This obviously helps TimeQuest to show me, that there are no setup violations made, but if I try to upload Nios design (at least it allows to try to upload!), it says that verify has failed between some addresses... Now trying other options.

    --- Quote End ---

    And no hold violations either?

    If you get a clean bill from TQ and it still fails, then it gets exotic

    a) the constraints aren't correct (can't see how, though...)

    b) TQ is missing something (very rare but not impossible)

    c) the datasheet is wrong

    d) the hardware is faulty and doesn't meet the datasheet

    At this point, I'd just try to add a bit of safety margin into my constraints and shift the PLL clock a bit more.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I don't know if it matters and how TQ calculates all delays, but I use ALT_DDRO to output the clock.

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

    ALT_DDIO_OUT? Why?

    That said, TQ can model all the delays inside the FPGA.

    Though.. ALT_DDIO_x might have some kind of embedded false path exceptions (rising to fall and fall to rising).