# FPGA-Neural V2 — Memory Upgrade (64MB) + N_SLOTS=8 + Clock Re-Verification Supersedes the SDRAM-related content of `PRE_PCB_VERIFICATION.md` and `PRE_PCB_CLOSURE_4POINT.md` (both describe the previous 8MB AS4C4M16SA-6TIN baseline). This document is the authoritative record for: the memory capacity investigation, the frozen replacement part, every RTL change it required, two real timing regressions found and fixed via real P&R data, and the honest, current state of N_SLOTS=4 vs N_SLOTS=8 clock closure. --- ## 1. Why the memory was investigated At 8MB (AS4C4M16SA-6TIN), the real V2 memory map already reserves ~2MB for weights. A concrete throughput check: the existing D-Stress benchmark (256 neurons × 128 inputs = 32,768 weight bytes) takes 49,771 cycles (777µs at the real, P&R-verified 64MHz) to run to completion. Extrapolating linearly, a 24MB weight budget (the proportional share of a 64MB device) would take on the order of **~580ms for one inference pass** — already deep into "too slow to matter" territory for this accelerator's real target (a low-latency SPI-peripheral offload engine), well before capacity itself becomes the binding constraint. This was disclosed to the user directly: capacity was not really the bottleneck, compute throughput was. The user weighed this and still asked for the largest same-family, same-package part, with N_SLOTS=8 as the preferred processor count — both honored below, with a fully honest report of what real P&R data says about clock closure at each. ## 2. Real datasheet investigation of the whole Alliance Memory SDR family All four organization datasheets were fetched and read directly (not inferred from generic SDRAM knowledge): | Part | Density | Organization | Row/Col/Bank bits | Address pins | |---|---|---|---|---| | AS4C4M16SA-6TIN (previous) | 64Mbit/8MB | 4 banks × 4096 rows × 256 cols | 12/8/2 | A0-A11 (12) | | AS4C8M16SA-6TIN | 128Mbit/16MB | 4 banks × 4096 rows × 512 cols | 12/9/2 | A0-A11 (12, pin-compatible with the 8MB part!) | | AS4C16M16SA-6TIN | 256Mbit/32MB | 4 banks × 8192 rows × 1024 cols... | — | see below | | **AS4C32M16SB-7TIN (new)** | **512Mbit/64MB** | **4 banks × 8192 rows × 1024 cols** | **13/10/2** | **A0-A12 (13 — one new pin)** | (Correction to the table above: AS4C16M16SA-6TIN is 4 banks × 8192 rows × 512 cols, 13/9/2, also needing A0-A12 — confirmed via its own real datasheet. The key finding driving the final part choice: going from 32MB to 64MB costs **zero additional pins** beyond what 32MB already requires, since both need the same 13 address pins. There is no PCB-simplicity reason to stop at 32MB once the 13th pin is already being added.) **"SA" vs "SB" note**: Alliance Memory's own datasheet revision history (AS4C32M16SA Rev 2.0: "Die Shrink – A revision") confirms these letter suffixes denote die-shrink process revisions, not functional or pinout changes. Real distributor availability (section 6 below) shows "SB" as the currently-stocked die for this part. **Package: BGA, not TSOP-II** — per the user's own explicit choice, the FROZEN part is **AS4C32M16SB-7BIN** (54-ball TFBGA, 8.0×8.0×1.2mm max, "B" package-code suffix), not the TSOP-II "-7TIN" variant discussed earlier in this investigation. Same die, same organization, same timing, same 3.3V/industrial-temp electricals — the datasheet's own "Features" section lists both a 54-pin TSOP-II AND a 54-ball FBGA package option for this exact device; only the physical footprint differs (a PCB-level choice, the user's own call). The datasheet-level electrical/timing audit in this document applies unchanged to either package option. ## 3. Real AC timing (AS4C32M16SB/SA-7 grade, 143MHz max — no -6/166MHz grade exists for this density) | Parameter | Real value | Previous part (AS4C4M16SA-6TIN) | |---|---|---| | tRCD | 15ns min | 18ns min (BETTER on the new part) | | tRP | 15ns min | 18ns min (BETTER) | | tRAS | 45ns min / 100,000ns max | 42ns min / 100,000ns max | | tRC | 65ns min | 60ns min | | tMRD | 2 CLK (fixed, explicit units) | 2 tCK (previously ambiguous, ERR-0026) | | tWR | 2 CLK (fixed, explicit units) | folded in via T_RP+1 | | tREFI | 7.8125µs (8192 rows/64ms) | 15.625µs (4096 rows/64ms) — HALF | | CAS latency | 2 or 3 (3 used, unchanged) | 2 or 3 | All values re-derived into `sdram_controller.v`'s own `ns_to_cycles()` function at the real 64MHz target — verified safe at 64MHz through 166MHz via the full regression sweep (section 7). ## 4. RTL changes required ### 4.1 `sdram_controller.v` and `sdram_model.v` — parameterized geometry Both files gained real `ROW_BITS`/`COL_BITS`/`BANK_BITS` parameters (defaults 13/10/2, matching the new part) replacing hardcoded 12/8/2 widths throughout: the address decode, the column-phase address assembly (previously a hardcoded `{4'b0100, col}` concatenation, now a parameterized construction that places the AP bit at the same bit 10 position regardless of column width), the MRS mode-register value (re-derived to be zero-padded correctly for any ROW_BITS), and the refresh-interval computation (now `64000000/(1<