z80replacement · a Z80 CPU replacement with an FPGA
FPGA pinout
the csfBGA285 pinout check, the bank split and the pin assignment
Status, 29 November 2026: nobody has built this module yet. The first sample run of 2 boards comes soon. Wait until the project has tested these boards before you send an order or a build request to a factory.
Repository file: docs/fpga_pinout.md
This file gives the result of the phase 1 pinout check for the ECP5 in the csfBGA285 package. See fpga.md for the selection of the FPGA.
Sources
| File | Version | Link |
|---|---|---|
| ECP5U-12 Pinout | FPGA-SC-02032 v2.1, 25 February 2026 | https://www.latticesemi.com/view_document?document_id=51576 |
| ECP5U-25 Pinout | FPGA-SC-02033 v2.0, 17 September 2021 | https://www.latticesemi.com/view_document?document_id=50485 |
| ECP5U-45 Pinout | FPGA-SC-02034 v3.0, 17 September 2021 | https://www.latticesemi.com/view_document?document_id=50486 |
| ECP5U-85 Pinout | v1.0, 2 November 2015 | https://www.latticesemi.com/view_document?document_id=50487 |
| Project Trellis database | prjtrellis-db commit 9754ff4, iodb.json per device |
https://github.com/YosysHQ/prjtrellis-db |
| OrangeCrab r0.2.1 | orangecrab-hardware commit c511d56 | https://github.com/orangecrab-fpga/orangecrab-hardware |
One footprint for all densities
The result is yes. One PCB footprint takes the LFE5U-12F, -25F, -45F and -85F.
- Each density has the same 285 balls. No ball is NC on any density.
- The 167 balls that are not user I/O (power, ground, configuration, JTAG, RESERVED) have the same function on all densities.
- Each density has 118 user I/O balls. They are the same balls, with the same bank, the same differential pair and the same DQS function.
- The Project Trellis database agrees with the Lattice files for all 118 balls on all four densities.
Two differences need care:
- PIO names. The internal PIO names (for example PL20A) and the DQS group numbers on the 45F and 85F differ from those on the 12F and 25F. The balls do not change. Thus the LPF file must use ball names, not PIO names.
- PLL inputs. On the 45F and 85F, the balls B7, B8, B11, B12, C7, C8, C11 and C12 are also PLL inputs. On the 12F and 25F, they are plain I/O. Use these eight balls only as plain I/O.
Banks
| Bank | User I/O | VCCIO balls | PCLK balls | DQS groups |
|---|---|---|---|---|
| 0 | 6 | 1 | 4 | none |
| 1 | 6 | 1 | 4 | none |
| 2 | 21 | 2 | 6 | 2 |
| 3 | 28 | 2 | 6 | 2 |
| 6 | 26 | 2 | 6 | 2 |
| 7 | 18 | 2 | 6 | 2 |
| 8 | 13 | 2 | none | none |
| Total | 118 | 12 |
All 13 I/O balls of bank 8 are also configuration pins. The SPI flash uses D0 (U18), D1 (T18), D2 (R18), D3 (N18) and the chip select CSSPIN (U17). Until 11 November 2026 the chip select was on SN/CSN (R17), which is the chip select input of the slave SPI mode: with that ball the FPGA cannot load from the flash (todo.md, item 5). CCLK (U16), PROGRAMN, INITN, DONE, CFG_0 to CFG_2 and the JTAG pins (TCK, TDI, TDO, TMS) are dedicated pins outside the 118.
The design does not use the DQS groups or the VREF balls (J1 and H15) since the SRAM replaced the DDR3L on 9 November 2026. See "History" below.
Bank split for this design
All banks operate at 3.3 V.
| Banks | VCCIO | Use | Balls | Needed |
|---|---|---|---|---|
| 3 and 6 | 3.3 V | SRAM (U5, 2M x 8): 8 data balls, 21 address balls and 3 control balls. Bank 3 holds 18 signals and bank 6 holds 14. | 54 | 32 |
| 0, 1, 2, 7 | 3.3 V | Z80 bus, translator controls, UART link, oscillator, LEDs | 51 | 55 in total, with bank 8 |
| 8 | 3.3 V | QSPI flash (5 balls), and 8 more balls for slow signals | 13 |
The 22 balls of banks 3 and 6 that the SRAM does not use are free. The SRAM balls are 32 of the 48 balls that the DDR3L used.
Notes on this split:
- The Z80 CLK must go to a PCLK ball in bank 0, 1, 2 or 7, for example B18 or B10.
- At least 4 of the 3.3 V signals must use the configuration balls of bank 8. Use slow signals there, for example the LEDs, /RESET or the UART.
- VCCIO8 must be 3.3 V, because the flash is on bank 8.
- Banks 3 and 6 are on opposite sides of the package (ball columns 1 to 7 and 14 to 18). The SRAM traces must reach both sides.
- No VREF. The SRAM uses 3.3 V LVCMOS. No bank needs a reference voltage, and the VREF balls J1 and H15 are free.
- No 1.35 V. The board has no 1.35 V rail. VCCIO3 and VCCIO6 are on 3.3 V.
Pin assignment
gateware/top/make_lpf.py holds the pin assignment and writes
gateware/top/z80r_mg285.lpf. With --check, the script compares each
ball with the Lattice pinout file. The function check() checks these
items:
- the ball is in the csfBGA285 column of the pinout file
- no two signals use the same ball
- the bank of the ball is the bank number in the table
PINS - the ball is a user I/O ball
- each clock input (
clkandclk25) is on a PCLK ball - the ball is not in the table
VREF(this table is empty since the SRAM replaced the DDR3L) - each flash ball has its configuration function: D0/MOSI, D1/MISO, D2, D3 and CSSPIN
The script then prints the user I/O balls that have no signal. The function does not check the differential pairs, and it has no special check for the SRAM balls.
The assignment passes the check for the 12F and the 85F (11 November 2026).
The FPGA turns 90° on the board (270° in KiCad):
- Row A faces the SRAM and the translators (+x).
- Column 1 faces the low y edge. Column 18 faces the high y edge. Since 10 November 2026 the low y edge has socket pins 21 to 40 and the high y edge has pins 1 to 20. (Until then the text said: "Column 1 faces socket pins 1 to 20 (low y). Column 18 faces pins 21 to 40 (high y)." The pin numbers of the footprint were a mirror image. See pcb.md, "History: the mirrored pin numbers".)
- The configuration balls, JTAG and bank 8 face the isolators and the flash (−x).
| Bank | Side of the package | Signals |
|---|---|---|
| 2 | row A, low y | A0, A2–A6, /IORQ, /WR, /RD, /NMI, /RESET, /BUSREQ, /BUSACK, /WAIT, /MREQ, /M1, /RFSH, /INT, ADIR, /COE |
| 7 | row A, high y | A9–A15, D0, D1, D2, D4, D5, D7, /HALT, /SOE, DDIR, /DOE |
| 0 and 1 | row A, middle | CLK on B10 (PCLKT0_0), the 25 MHz clock on A9 (PCLKT1_0), A1, A7, A8, D3, D6, /AOE |
| 8 | row V, high y | QSPI flash, console UART, /CORE_RESET, two LEDs |
| 3 | low y | SRAM A2, A4, A6, A7, A11, A15, A16, A20, D0–D7, /CE and /WE |
| 6 | high y | SRAM A0, A1, A3, A5, A8, A9, A10, A12, A13, A14, A17, A18, A19 and /OE |
Correction (11 November 2026): the rows for the banks in the table above come from the corrected
bank numbers of make_lpf.py (PINS). The bank numbers in PINS were stale after the pin swap, and
python make_lpf.py --check <Lattice ECP5U-85 pinout csv> printed 22 bank errors. The bank numbers
are now the numbers of the Lattice pinout file, and the check prints no error. The LPF file and the
schematic did not change: make_sch.py does not use the bank number of PINS. Before this
correction the table gave the rows of the first pin swap, and the SRAM rows of the swap of
10 November 2026.
Banks 3 and 6 (10 November 2026, after the change to the IS61WV20488FBLL-10BLI, sram.md): the pin swap ran again and moved the SRAM signals among the 32 balls of the two banks, with the new data balls of the part (65 balls of the FPGA have a new signal, the SRAM among them). The table rows for banks 3 and 6 are from that run. Older text of these two rows: bank 3 had the SRAM data D0–D7 and the address A0–A9, and bank 6 had the address A10–A20, /CE, /OE and /WE. The rows for the banks 0, 1, 2 and 7 did not change, because each bank has the same set of signals; the balls inside the banks changed.
The three rows above are the result of pin_swap.py of 10 November 2026, after the
correction of the pin numbers of P1. Older text of these three rows (the
result of the first pin swap, before the correction): bank 2 had A8–A15,
D0–D2, D4, D5, D7, /MREQ, /IORQ, ADIR, DDIR, /DOE and /COE. Bank 7 had
A2–A7, D6, /M1, /RFSH, /HALT, /BUSACK, /RESET, /WAIT, /INT, /NMI, /BUSREQ
and /SOE. Banks 0 and 1 had A0, A1, D3, /RD, /WR and /AOE next to the
clocks. The pin swap moves the signals within the pool of balls of the
banks 0, 1, 2 and 7, thus the table changes with each run.
The assignment uses 87 signal balls, and the LPF file has 87 LOCATE
lines. 31 user I/O balls stay free for later changes (make_lpf.py --check, 11 November 2026). No signal is deeper than the fourth ring of
balls. The fourth ring has 9 signals (make_lpf.py --rings). Until
11 November 2026 this text said "100 signal balls", "14 balls stay free"
and 10 signals in the fourth ring. Those numbers were stale, and
routing_study.md still has them.
The SRAM has no fixed function for a ball of the FPGA. Each of the 32 SRAM balls can carry each SRAM signal (data, address or control). The net of the signal goes to the pin of the SRAM that has that signal.
The order of the balls inside each pool comes from
hardware/pcb/pin_swap.py (9 November 2026). The program keeps the set of
balls of each pool and changes only which signal goes to which ball.
The goal is few crossings between the nets on the board (pcb.md,
"Pin swap"). The pin swap cut the straight-line crossings of the SRAM
nets and the bus nets from 592 to 286. These are the pools:
- the Z80 bus and the translator controls (banks 0, 1, 2 and 7, not CLK and CLK25)
- the 32 SRAM balls of banks 3 and 6 (one pool)
Thus each ball keeps its bank, its PCLK function and its pair. The result of the check above stays valid. A place and route of the full design on the 85F accepts the new balls.
OrangeCrab, for comparison
The OrangeCrab r0.2.1 puts an LFE5U-25F-8MG285C and one MT41K64M16TW (1 Gbit DDR3L) on one board. Its DDR3L uses banks 2, 6 and 7 at 1.35 V. Banks 0, 1, 3 and 8 operate at 3.3 V. That split leaves only 48 balls at 3.3 V, which is too few for this design. The OrangeCrab feeds each VREF ball from a 1 kΩ / 1 kΩ divider from 1.35 V. The OrangeCrab has no VTT regulator. The only termination is 51 Ω on CK to a capacitor, and 240 Ω for ZQ. It ties the unused balls of the DDR3L banks to 1.35 V or GND. This design has no DDR3L, and all its banks operate at 3.3 V.
History: the DDR3L bank split (before 9 November 2026)
On 9 November 2026 the user replaced the DDR3L with a 2 MB SRAM, to make the PCB routable (memory.md, ddr3.md). This section keeps the earlier bank plan.
A full DDR3 byte lane (8 DQ, DM and a DQS pair) fits in only six DQS groups: one in bank 2, two in bank 3, two in bank 6 and one in bank 7.
| Banks | VCCIO | Use | Balls | Needed |
|---|---|---|---|---|
| 3 and 6 | 1.35 V | DDR3L: both byte lanes in bank 3, address, command and CK in bank 6 | 54 | 49, plus VREF |
- VREF. An SSTL input needs the VREF ball of its bank. In that split, the DDR3L inputs (DQ and DQS) were all in bank 3, so only bank 3 needed its VREF ball (J1). Bank 6 had only outputs. Then bank 3 had 27 usable balls for 27 signals, and bank 6 had 26 balls for 22 signals.
- Banks 6 and 7 together have 44 I/O, which is too few for DDR3L.
- Bank 3 held DDR3L byte lane 0 in the DQS group of F2, byte lane 1 in the DQS group of K2, and RESET#. Bank 6 held the address, bank address, command, CKE, ODT and CK (G18/H17).
- Inside a byte lane, the layout could swap DQ bits and the byte lanes. It could not swap address bits at the DDR3L, because the mode register writes use the address bits. But each address or command signal could go to each ball of the set in bank 6.
- The pin swap used three pools: the Z80 bus, the DQ and DM balls of each DQS group, and the address and command balls of bank 6.
Items still open
- Read the ECP5 data sheet (FPGA-DS-02012) and the sysIO usage guide for the JTAG supply voltage.
- Download the Lattice csfBGA285 migration file and compare it with this result.
Source of this page: web/ and docs/ in the
z80replacement repository. Hardware: CERN-OHL-S-2.0. Other files: GPL-3.0-or-later.