Establishes the real ESP32<->ECP5 programming architecture: flash #1 (neural-network data, existing V1 subsystem, ball reserved not yet wired into V2) stays separate from flash #2 (boot bitstream, MSPI auto-boot, CFG[2:0]=[0,1,0]); ESP32 talks JTAG only (bit-banged, no hardware JTAG-master peripheral on S3/C6), updating flash #2 through the ECP5's own internal sysCONFIG-to-SPI bridge, never driving the flash pins directly -- zero bus contention, confirmed against the real Lattice hardware checklist and sysCONFIG user guide. Adds real, verified ball assignments (official Lattice CABGA381 CSV + Project Trellis iodb.json) for JTAG, PROGRAMN/INITN/DONE, CFG[2:0], and the MSPI dedicated pins -- all written to docs/pinouts.md. Implements FPGA_DATA_READY as real RTL: a system-idle detector (dependency_manager's any_pending OR neural_director's !queue_empty OR any active slot), sticky on the busy->idle edge, self-clearing on new work -- not a per-neuron completion pulse, which was confirmed too fine-grained. Bit-exact regression re-verified at N_SLOTS=4 and 8 (zero cycle-count change), new explicit data_ready assertion check added to the D-Stress testbench (PASS both configs), and a fresh Yosys+nextpnr-ecp5 placement check (0 errors, data_ready placed at G3). Also fixes a real, independently-found bug while editing an adjacent file: nms_neural_multiprocessor_sdram_unified.v's own sdram_a port was still [11:0] (12 bits), stale from before the 64MB/13-bit memory upgrade. Not exercised by the real board-level top (which wires SDRAM directly, bypassing this wrapper) but WAS silently truncating A12 in every D-Stress simulation this session, including today's earlier ERR-0029 verification runs. Assessed impact: all D-Stress test addresses used this session decode to rows under 4096 (bit 12 never actually needed), so no false-positive PASS is believed to have resulted -- but the full 64MB space was never actually exercised through this wrapper. Fixed; re-verified bit-exact with identical cycle counts. See decisions.log DEC-0041 for full detail. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xXuuRUWZScuo1DeYJxs3v
142 lines
5.5 KiB
Markdown
142 lines
5.5 KiB
Markdown
Perfetto, il CSV è quello giusto: FPGA-SC-02034-3-0-ECP5U-45-Pinout.csv, rev. 3.0. L'ho letto e possiamo finalmente fare il pinout esatto per il LFE5U-45F caBGA381, senza deduzioni.
|
||
|
||
Ho anche verificato la documentazione Lattice aggiornata: per LFE5U VCC = 1,1 V ±5%, VCCAUX = 2,5 V ±5%, VCCIO da 1,2 a 3,3 V e VCCIO8 è il banco associato alla configurazione.
|
||
|
||
Pinout essenziale BG381
|
||
Ball Funzione Alimentazione / collegamento
|
||
H13 VCC 1.1 V
|
||
J13 VCC 1.1 V
|
||
K13 VCC 1.1 V
|
||
L13 VCC 1.1 V
|
||
M13 VCC 1.1 V
|
||
N13 VCC 1.1 V
|
||
H12 VCC 1.1 V
|
||
N12 VCC 1.1 V
|
||
H11 VCC 1.1 V
|
||
N11 VCC 1.1 V
|
||
H10 VCC 1.1 V
|
||
N10 VCC 1.1 V
|
||
H9 VCC 1.1 V
|
||
N9 VCC 1.1 V
|
||
H8 VCC 1.1 V
|
||
J8 VCC 1.1 V
|
||
K8 VCC 1.1 V
|
||
L8 VCC 1.1 V
|
||
M8 VCC 1.1 V
|
||
N8 VCC 1.1 V
|
||
F6 VCCAUX 2.5 V
|
||
P6 VCCAUX 2.5 V
|
||
F15 VCCAUX 2.5 V
|
||
P15 VCCAUX 2.5 V
|
||
F9, F10 VCCIO0 Bank 0
|
||
F11, F12 VCCIO1 Bank 1
|
||
H14, H15, J15 VCCIO2 Bank 2
|
||
L14, L15, M15 VCCIO3 Bank 3
|
||
L6, L7, M6 VCCIO6 Bank 6
|
||
H6, H7, J6 VCCIO7 Bank 7
|
||
P9, P10 VCCIO8 Bank 8 / configuration
|
||
|
||
Nota: il CSV elenca anche i pin VSS/VSSIO; vanno tutti collegati correttamente al piano GND, senza lasciarne nessuno scollegato.
|
||
|
||
JTAG / programmazione
|
||
|
||
Questi sono particolarmente importanti perché sono ball esatti del BG381:
|
||
|
||
Ball Pin Bank Collegamento
|
||
R5 TDI 40 JTAG TDI
|
||
T5 TCK 40 JTAG TCK
|
||
U5 TMS 40 JTAG TMS
|
||
V4 TDO 40 JTAG TDO
|
||
W3 PROGRAMN 8 controllo configurazione
|
||
V3 INITN 8 stato configurazione
|
||
Y3 DONE 8 configurazione completata
|
||
|
||
Il bank 8 è quello associato all'interfaccia di configurazione; Lattice indica esplicitamente VCCIO8 come alimentazione da dimensionare in funzione dell'interfaccia di configurazione utilizzata.
|
||
|
||
CCLK
|
||
|
||
Dal CSV:
|
||
|
||
Ball Pin Bank
|
||
U3 CCLK 8
|
||
|
||
Attenzione però: CCLK non è automaticamente il clock di sistema della nostra rete neurale. È il clock associato alla configurazione; il clock operativo della FPGA va identificato separatamente nel percorso dell'oscillatore/PLL.
|
||
|
||
CFG[2:0] (selezione modalità di boot)
|
||
|
||
Dal CSV, tutti banco 8:
|
||
|
||
Ball Pin Note
|
||
U4 CFG_0 CFGMDN0
|
||
T4 CFG_1 CFGMDN1
|
||
R4 CFG_2 CFGMDN2
|
||
|
||
Per boot automatico da flash #2 (MSPI): CFG[2:0]=[0,1,0] (letto CFG2,CFG1,CFG0) → CFG_2 a GND, CFG_1 a pull-up 1–10kΩ verso VCCIO8, CFG_0 a GND (dato reale, Lattice FPGA-TN-02039-2.3 §6.1.1, Tabella 6.3). Pin resi modificabili via jumper/resistori 0Ω, non hardwired fissi.
|
||
|
||
Pin dual-function MSPI verso flash #2 (boot)
|
||
|
||
Dal CSV, ball dual-function del banco 8, NON pin JTAG/dedicati separati — sono ball PIO ordinari con funzione secondaria sysCONFIG:
|
||
|
||
Ball Pin CSV Funzione MSPI
|
||
R2 PB15A: HOLDN/DI/BUSY/CSSPIN/CEN CSSPIN (chip select verso flash #2), + 4.7kΩ pull-up a VCCIO8
|
||
W2 PB11B: D0/MOSI/IO0 D0/MOSI verso flash #2
|
||
V2 PB11A: D1/MISO/IO1 D1/MISO verso flash #2
|
||
U3 CCLK (vedi sopra) MCLK verso flash #2, pull-up debole interna
|
||
|
||
Questi 4 ball (insieme a PROGRAMN/INITN/DONE sopra) collegano l'FPGA esclusivamente alla flash #2 (boot) — MAI alla flash #1 (dati rete neurale), che resta su un bus GPIO ordinario separato (sotto).
|
||
|
||
Flash #1 (dati rete neurale) — ball riservati, RTL non ancora presente in V2
|
||
|
||
**Importante**: i ball reali usati da V1 per questo stesso bus (`flash_sclk`=E3, `flash_mosi`=D3, `flash_miso`=D5, `flash_cs_n`=E4) sono **già occupati in V2** dal bus SDRAM (E3=sdram_a[4], D3=sdram_a[1], D5=sdram_a[0], E4=sdram_ba[0]) — non riutilizzabili, V2 ha una geometria pin diversa da V1. Individuati 4 ball liberi alternativi, stesso banco 7 (stessa tensione 3.3V del resto del bus SDRAM):
|
||
|
||
Ball Funzione dual (libera, riusabile come GPIO ordinario)
|
||
B2 VREF1_7 (non serve, nessuno standard I/O riferito a VREF in uso)
|
||
E2 PCLKC7_0 (ingresso PLL non usato, riusabile come GPIO)
|
||
F2 PCLKT7_0 (ingresso PLL non usato, riusabile come GPIO)
|
||
F3 PCLKC7_1 (ingresso PLL non usato, riusabile come GPIO)
|
||
|
||
Assegnazione proposta: `flash_sclk`=B2, `flash_mosi`=E2, `flash_miso`=F2, `flash_cs_n`=F3. **Non ancora nel LPF**: `flash_copy_engine.v`/`flash_slot_manager.v` (RTL V1 reale) non sono stati portati nel top-level di V2 — aggiungere un `LOCATE COMP` per questi segnali ora romperebbe la sintesi, dato che non esiste ancora una porta corrispondente in `fpga_neural_v2_top.v`. Riservati qui solo come ball, in attesa dell'integrazione RTL.
|
||
|
||
Decoupling
|
||
|
||
Qui preferisco essere molto preciso: non voglio inventare una quantità di condensatori per “ogni VCC”.
|
||
|
||
La Hardware Checklist ufficiale Lattice richiede esplicitamente:
|
||
|
||
VCC 1,1 V con PCB plane e adeguato decoupling;
|
||
VCCAUX 2,5 V;
|
||
VCCIO 1,2–3,3 V;
|
||
VCCIO8 coerente con l'interfaccia di configurazione.
|
||
|
||
Per la nostra scheda farei quindi una rete di decoupling distribuita, non un condensatore unico per ogni ball:
|
||
|
||
LFE5U-45F
|
||
┌──────────────┐
|
||
1V1_CORE ─────┤ VCC │
|
||
│ │
|
||
2V5_AUX ──────┤ VCCAUX │
|
||
│ │
|
||
3V3/2V5/etc ──┤ VCCIOx │
|
||
│ │
|
||
GND ──────────┤ VSS │
|
||
└──────────────┘
|
||
|
||
con i condensatori fisicamente distribuiti attorno al BGA, con quelli ad alta frequenza il più vicino possibile alle rispettive vie/pad di alimentazione.
|
||
|
||
Una cosa importante
|
||
|
||
Adesso che abbiamo il CSV ufficiale, posso fare un lavoro ancora più utile: estrarre tutti i 381 ball del BG381 e generarti una tabella Markdown completa divisa in:
|
||
|
||
VCC
|
||
VCCAUX
|
||
VCCIO0–8
|
||
VSS/VSSIO
|
||
JTAG
|
||
PROGRAMN/INITN/DONE
|
||
clock
|
||
GPIO utilizzabili
|
||
pin da NON utilizzare
|
||
BOM decoupling consigliata
|
||
header JTAG completo
|
||
|
||
Quella diventerebbe praticamente la nostra scheda di riferimento hardware per il PCB V2. |