Board design,
NES_KV260.v
is the main module. The whole NES machine (CPU, PPU, APU, memory controller, memory mapper) is in there.nes_dp.v
converts NES video signal to 1080p and feeds into PS's live video input, which in turn drives HDMI output.- Everything runs at 21.47Mhz (NES main clock) except part of nes_dp, which runs at 148.5Mhz (1080p pixel clock). Video is scaled from 256x240 to 1024x960 (4x).
- A .nes ROM is first sent to the ARM CPU (PS) through UART_1. PS program there (
sw/*
) then forward it to PL through NES_KV260's AXI4-Lite port (s00_axi
). - Game controllers are handled in a similar way. Button presses are detected on the PC, sent to PS and finally reaches PL through AXI.
Cartridge of up to 2MB are supported, which should cover 95% or more games. Cartridge ROM, internal RAM (2KB) and VRAM (2KB) are all stored in the on-chip UltraRAM (total 2304KB, used 100%). PS DDR memory is not used by FPGA. Here's a rough memory layout,
UltraRAM layout:
256K words, every word is 9 bytes (72 bits)
71:64 63:0
0 +------------+------------------+
| PRG RAM | PRG ROM |
128K +------------+------------------+
|Internal RAM| CHR ROM |
| VRAM | |
256K +------------+------------------+
Final resource usage,
Obviously UltraRAM is the heavily-used resource here.
Use Vitis/Vivado 2021.2 with Y2K22 patch.
Vivado build,
- Create a new project with K26 SoM. Don't forget to choose the KV260 Starter Kit board in "connections"
- Import all source files in
fpga/hdl
. - Import constraints file
fpga/pmod.xdc
. - Create board design with
fpga/design_1.tcl
. (Tools->Run Tcl Script) - Generate Bitstream. Wait 10 minutes.
- File->Export->Hardware->Include bitstream to get
nes260.xsa
.
Vitis app and boot.bin,
- Create a platform with
nes260.xsa
- Create an application project
nes
, import everything insw/
as source code. - Build and get
nes_system/Debug/sd_card/BOOT.bin
.
- fpganes was originally authored by Ludvig Strigeus.
- Greg Taylor's IMX219 MIPI sensor 1080p/30fps video to Ultra96-V2/Kria KV260 FPGA DisplayPort code helped a lot in getting live video through PS to work.