fix(jtframe): break the MiSTer SDRAM A[12:11] ACTIVATE timing path - #1505
fix(jtframe): break the MiSTer SDRAM A[12:11] ACTIVATE timing path#1505strygo wants to merge 1 commit into
Conversation
|
I don't see this problem in the compilations. |
|
Thanks for approving the workflow run. The three failures look like a fork limitation rather than something in this branch. All three fail at the
Approving the run unfortunately doesn't change this: approval lets the workflows start, but fork runs still get no secrets. Dropping the Happy to do whatever is easiest on your side, whether that's pushing the branch in-repo where secrets are available, splitting it differently, or anything else you'd prefer. In the meantime I ran the
Identical figures on both. The change registers the A[12:11] ACTIVATE path without altering the access pattern or costing a cycle. |
|
The answer sounds like coming from AI and it does not reply to my question. I do not see problems in the current code base that will be fixed by this PR so I am not taking it. |
|
@jotego What question did you have? I'm working on a feature that requires a bit more headroom in these cores, and this was the biggest hot spot I could find. With this change, there is more breathing room. I was hoping that since it was consistent with your earlier changes, it would be a reasonable change. |
|
I guess that's the question: what is the need because it is not fixing any current problem. It also happens that I was trying to reach 128MHz for rungun right now. I tested this on that branch but it wasn't a clear cut. I can give more details later. Take into account that you should at least do four builds and average the STA results before assuming an improvement because timing easily changes by plus minus 0.3ns between builds. Maybe we can do this later when merging your other feature? |
|
Validation passed: STA results, CPS3 MiSTer
Delta: Worst paths from TimeQuest are still in the the patch is mildly positive on average, but not a strong CPS3 win. One patched seed is worse than any baseline seed, so I would not justify it from CPS3 STA alone. It is only worth applying if we specifically want the MiSTer SDRAM |
|
Tested again on top of commit 2dc023f, which added a -0.5ns improvement on CPS3 core: CPS3 MiSTer Compared with the baseline: The WNS improvement is modest and right around the usual fitter-noise boundary. The remaining top violations are now CPS3 cache RAM/tag paths, not the SDRAM |
The CPS cores do not close timing reliably at 96 MHz, and jtframe_sdram64 is why. Measured on 2287d18, Quartus Lite 20.1 (the CI image), MiSTer target, seed 1: jtcps2 MISSES at -0.014 ns and jtcps1 scrapes through at +0.087 ns, so --max-trials is absorbing what is really a structural problem. All 30 of the top 30 setup paths terminate at sdram_a[12:11]. On MiSTer, SDRAM_A[12:11] doubles as DQMH/L (shorted pins on the 128MB module), so those two bits mux between row address, byte mask and zero on next_cmd==CMD_ACTIVE -- a 4-bit compare evaluated AFTER the 7-deep grant mux. That serial compare makes bank-FSM -> grant mux -> compare -> A[12:11] the longest cone in the design, ending in the A[12:11] DDIO register at the pin (~4 ns of it the single route into the IO ring). Bits 10:0 carry no such term and never violate. Each source of the grant mux already knows whether ITS command is ACTIVATE: the banks decode it as ~do_prech & do_act (exported as `act`), init/rfsh/prog compare their own 4-bit cmd off the critical path. next_is_act mirrors the grant mux leaf for leaf and replaces the compare in the registered assignment -- same outputs, one cycle, no protocol change, non-MiSTer arm untouched. A SIMULATION-gated assertion checks next_is_act == (next_cmd==CMD_ACTIVE) every clock. With the compare out of series all three CPS cores close at seed 1, and the top 30 no longer holds a single sdram_a path -- the tightest are back to the MiSTer scaler/OSD, where the bottleneck otherwise sits: core before after cps1 +0.087 +0.538 cps15 +0.312 +0.349 cps2 -0.014 +0.229 That recovered margin is also what makes it practical to add anything further to these cores. This is the same restructuring burst_io got in 29d9b07 ("break MiSTer SDRAM DQM timing path"); jtframe_sdram64 never received it. Verified: modules/jtframe/ver/sdram/sdram_bank64 rw_test x4 configs (-mister at 100 MHz and the 96 MHz period, 40% write stress, non-mister arm) and prog_test all PASS with the assertion armed and silent. The -idle 10 config's bank-3 stall FAILs identically on stock RTL at the same simulation timestamp (315155 ns) -- pre-existing, not introduced.
0aa46e7 to
3960cc4
Compare
|
The S18 core is currently not passing STA so this one was good test. The PR patch is worse on average WNS, average TNS, median WNS, and pass count. Definetely this patch is not worth it. |
Why
jtframe_sdram64evaluates a 4-bitnext_cmd==CMD_ACTIVEcompare after the 7-deep grant mux. On MiSTer that term selectsSDRAM_A[12:11], which double as DQMH/L on the shorted-pin 128MB module, so bank FSM → grant mux → compare →A[12:11]becomes the longest cone in the design, ending in the DDIO register at the pin (~4 ns of it the single route into the IO ring). Bits 10:0 carry no such term and never violate.Measured on 2287d18, Quartus Lite 20.1 (the CI image), MiSTer target, seed 1: all 30 of the top 30 setup paths terminate at
sdram_a[12:11], and jtcps2 does not close at all —--max-trialsis absorbing what is really a structural problem.With the compare out of series all three close at seed 1, and no
sdram_apath remains in the top 30 — the tightest are back to the MiSTer scaler/OSD, where the bottleneck otherwise sits.What
Each source of the grant mux already knows whether its command is ACTIVATE: the banks decode it as
~do_prech & do_act(exported asact), while init/rfsh/prog compare their own 4-bit cmd off the critical path.next_is_actmirrors the grant mux leaf for leaf and replaces the compare in the registered assignment — same outputs, one cycle, no protocol change, non-MiSTer arm untouched.This is the same restructuring
burst_ioreceived in 29d9b07 ("break MiSTer SDRAM DQM timing path");jtframe_sdram64never got it.Verification
A
SIMULATION-gated assertion checksnext_is_act == (next_cmd==CMD_ACTIVE)every clock.ver/sdram/sdram_bank64, stock master vs this branch:-idle 10The assertion never fired. The
-idle 10failure is pre-existing: it reproduces identically on unmodified master at the same simulation timestamp.Notes
-Dflags moved ahead of the source files inver/sdram/sdram_bank64/*/sim.sh— Icarus 13 only honours defines that precede the sources, so as shippedSDRAM_SHIFTexpands to null and the testbench dies attest.v:254. That is pre-existing and unrelated to this change; I ran the suites by invokingiverilogdirectly with the same sources and defines. Happy to send it as a separate PR if useful.