Synthetisierbares VHDL · T65-Kern

Ein 6502-Computer,
in Logik nachgebaut.

CPU, Grafik, Sound, serielle Schnittstellen und ein virtuelles Diskettenlaufwerk — ein vollständiger Single-Board-Computer als FPGA-Design. Bootet unveränderte 6502-Software und teilt sich die Memory-Map mit dem Original-Emulator.

CPU T65 / 6502 Takt 27 MHz Video HDMI · VGA Status HW-verifiziert
EhBASIC bootet auf dem Tang Primer 20K
EhBASIC am HDMI-Ausgang · Tang Primer 20K (GW2A-18)
27 MHz
T65 CPU-Takt (effektiv)
SID
6581-kompatibel · Original-.sid-Wiedergabe
256
Farben · RGB332-Bitmap
2
FPGA-Boards · ein RTL-Kern
Komponenten

Die Peripherie-Chips — neu in RTL implementiert

Eine board-unabhängige VHDL-Bibliothek bildet die klassischen Bausteine des 6502-Systems nach. Gleiche Register, gleiche Adressen, gleiche Software.

01

T65 CPU-Kern Reset @ $FFFC

6502-kompatibler Soft-Core mit eigenem 16-Bit-Bus-Adapter. Läuft über ein cpu_enable-Toggle mit effektiv halbem Systemtakt bis 27 MHz und behandelt IRQ-Vektoren wie der Originalprozessor.

Details ansehen →
02

VIC-Grafik $8000 · $9000

Textmodus 40×25 mit 16-Farben-Palette, Legacy-Bitmap 320×200, 256-Farben RGB332 und gepacktes 64-Farben RGB222 — über C64-artiges Bus-Stealing während der Austastlücke, mit Overhead von nur 4,8 % im Textmodus.

Details ansehen →
03

SID-kompatibler Sound-Chip $D400–$D418

Ein recht vollständiges MOS-6581-Modell: 3 Stimmen, kombinierte Wellenformen, zyklusgenaue ADSR und Multimode-Filter. Die Demo spielt originale .sid-Dateien samt ihrem 6502-Player-Code mit leichter Konvertierung direkt auf der Hardware — über den PT8211-DAC.

Details ansehen →
04

VIA 6522 & UART 6551 $8800 · $8810

Timer, GPIO und IRQ-Flags der VIA; vollständige TX/RX-Logik der UART mit Statusregistern und RX-Interrupt. PS/2-Tastatureingaben werden in den seriellen Empfangspfad eingespeist.

Details ansehen →
05

D64 GoDrive $8824

Ein zweites SD-Kärtchen mit FAT32 hält .d64-Images. Die FPGA parst FAT32 und D64 vollständig in Logik und zeigt dem 6502 nur einfache 256-Byte-Sektoren — kein Dateisystem in Software.

Details ansehen →
06

Math-Coprozessor $88B0

Memory-mapped FPU für vorzeichenbehaftete 32×32-Festkomma-Multiplikation im 8.24-Format — beschleunigt BASIC-Mathematik wie die Mandelbrot-Renderings.

Details ansehen →
D64 GoDrive — virtuelles Laufwerk

Software laden wie früher

Die FPGA übernimmt FAT32- und D64-Auswertung vollständig. Der 6502 sieht nur ein simples Laufwerk und lädt mit den vertrauten BASIC-Befehlen.

  • Autodetect: MBR-partitioniert oder Superfloppy
  • Interaktives Auswahlmenü per Pfeiltasten (LOAD "!")
  • Verzeichnis und PRG-Load direkt aus EhBASIC
  • Auf realer 32-GB-Windows-SD-Karte verifiziert
COM12 — 115200 8N1
EhBASIC ready.
LOAD "$"
 0  "TESTDISK     " 1A 2A
   4  "HELLO"          PRG
   8  "MANDELBROT"     PRG
  12  "SOUNDDEMO"      PRG
READY.
LOAD "HELLO"
LOADING... $0801-$08C9
CALL 2049
HELLO FROM A REAL 6502!
READY.
Datenblatt

Memory-Map & Eckdaten

Aktive Konfiguration des Tang Primer 20K — kompatibel zur emulierten Maschine.

AdressbereichGrößeGerät
$0000–$3FFF16 KBBRAM Haupt-RAM — Zero-Page, Stack, EhBASIC
$4000–$5FFF8 KBBSRAM Haupt-RAM (optional DDR3-Backend)
$6000–$7FFF8 KBFenster in 16-KB-VIC-Framebuffer
$8000–$87FF2 KBVIC Text- & Farb-RAM
$8800–$880F16 BVIA 6522
$8810–$88134 BUART 6551
$8824D64 GoDrive Register
$88B0–$88BF16 BMath-Coprozessor (8.24 FPU)
$9000–$900F16 BVIC-Steuerregister
$A000–$CFFF12 KBShadow-ROM Anwendungsfenster
$D400–$D41825 BSID-kompatible Audio-Register
$F000–$FFFF4 KBShadow-ROM Kernel & Vektoren
Video
Ausgabe (Tang)HDMI/DVI 640×480 @ 60 Hz
Pixeltakt27 MHz · TMDS 135 MHz
Textmodus40×25, 16 Farben
Bitmap-Modi1-bpp · RGB332 · RGB222
Bus-Overhead4,8 % – 9,4 %
Audio & I/O
SoundSID 6581 · 3 Stimmen + Filter
DACPT8211 I²S · ~47 kHz
Oszillator24-Bit Phasenakkumulator
UART115200 8N1 (CH340)
EingabePS/2-Tastatur · UART
Boot & Clocking

Von der SD-Karte zum laufenden 6502

Ein 27-MHz-Oszillator speist eine 270-MHz-PLL; daraus entstehen TMDS-, System- und Pixeltakt.

01
microSD
SPI-Modus liest Boot-Image
02
sd_rom_loader
prüft Sektor 0, streamt 1…32
03
boot_shadow_rom
16-KB-ROM-Fenster geladen
04
Self-Test
RAM · VRAM · VIA · UART
05
T65 release
Reset-Vektor @ $FFFC
Portabilität

Ein Kern, zwei FPGA-Plattformen

Der board-unabhängige RTL-Kern läuft mit minimalem Board-Glue auf zwei Zielen.

Aktive Bring-up-Plattform

Sipeed Tang Primer 20K

Gowin GW2A-18
  • HDMI/DVI-Ausgabe über TMDS-Serializer
  • On-Board microSD Boot-Pfad im SPI-Modus
  • Nativer SID-Sound über PT8211-DAC am Dock
  • BSRAM-Backend stromsparend, DDR3 optional
  • PS/2-Tastatur über PMOD, CH340-UART
Referenz-Plattform

PIX16 Board

Xilinx Spartan-6 · xc6slx16
  • VGA-Textausgabe mit Boot-Statusscreen
  • SDRAM-gestütztes Haupt-RAM mit Self-Test
  • SD-Boot des 16-KB-Shadow-ROMs
  • UART-Monitor mit Live-ROM-Upload
  • ISE-Projekt versioniert und reproduzierbar
Verifikation

Inkrementell getestet mit GHDL

Jeder Baustein ist unabhängig testbar — von der Adressdekodierung bis zum FAT32-Reader.

Testbench-BereichAbdeckung
Bus & ResetAdressdekodierung aller Gerätefenster, Reset-Vektor-Fetch, ROM-skriptgesteuerte Buszyklen
VIA 6522Port-Masking, IER/IFR, Timer-1-IRQ-Assertion und -Clearing
UART 6551Status, TX, RX, Overrun, programmierter Reset, RX-IRQ
T65 CPUBoot aus realem ROM, UART-/VIA-Zugriff, IRQ-Handler, Kernel-Smoke-Test
D64 / FAT32Real-Geometrie-Images werden lazy gelesen, Start-LBAs verifiziert
SID & FPUSID-Audio/Filter beschränkt & nicht-stumm, 8.24-Multiplikation gegen Referenz
Synthesizable VHDL · T65 core

A 6502 computer,
rebuilt in logic.

CPU, graphics, sound, serial I/O and a virtual disk drive — a complete single-board computer as an FPGA design. It boots unmodified 6502 software and shares its memory map with the original emulator.

CPU T65 / 6502 Clock 27 MHz Video HDMI · VGA Status HW-verified
EhBASIC booting on the Tang Primer 20K
EhBASIC on the HDMI output · Tang Primer 20K (GW2A-18)
27 MHz
T65 CPU clock (effective)
SID
6581-compatible · plays original .sid
256
Colors · RGB332 bitmap
2
FPGA boards · one RTL core
Components

The peripheral chips — re-implemented in RTL

A board-independent VHDL library recreates the classic building blocks of the 6502 system. Same registers, same addresses, same software.

D64 GoDrive — virtual disk

Load software the old way

The FPGA handles all FAT32 and D64 parsing. The 6502 only ever sees a simple drive and loads programs with the familiar BASIC commands.

  • Autodetect: MBR-partitioned or superfloppy
  • Interactive arrow-key selection menu (LOAD "!")
  • Directory listing and PRG load straight from EhBASIC
  • Verified on a real 32 GB Windows-formatted SD card
COM12 — 115200 8N1
EhBASIC ready.
LOAD "$"
 0  "TESTDISK     " 1A 2A
   4  "HELLO"          PRG
   8  "MANDELBROT"     PRG
  12  "SOUNDDEMO"      PRG
READY.
LOAD "HELLO"
LOADING... $0801-$08C9
CALL 2049
HELLO FROM A REAL 6502!
READY.
Datasheet

Memory map & key figures

The active Tang Primer 20K configuration — compatible with the emulated machine.

Address rangeSizeDevice
$0000–$3FFF16 KBBRAM main RAM — zero page, stack, EhBASIC
$4000–$5FFF8 KBBSRAM main RAM (optional DDR3 backend)
$6000–$7FFF8 KBWindow into 16 KB VIC framebuffer
$8000–$87FF2 KBVIC text & color RAM
$8800–$880F16 BVIA 6522
$8810–$88134 BUART 6551
$8824D64 GoDrive registers
$88B0–$88BF16 BMath coprocessor (8.24 FPU)
$9000–$900F16 BVIC control registers
$A000–$CFFF12 KBShadow-ROM application window
$D400–$D41825 BSID-compatible audio registers
$F000–$FFFF4 KBShadow-ROM kernel & vectors
Video
Output (Tang)HDMI/DVI 640×480 @ 60 Hz
Pixel clock27 MHz · TMDS 135 MHz
Text mode40×25, 16 colors
Bitmap modes1-bpp · RGB332 · RGB222
Bus overhead4.8 % – 9.4 %
Audio & I/O
SoundSID 6581 · 3 voices + filter
DACPT8211 I²S · ~47 kHz
Oscillator24-bit phase accumulator
UART115200 8N1 (CH340)
InputPS/2 keyboard · UART
Boot & clocking

From SD card to a running 6502

A single 27 MHz oscillator feeds a 270 MHz PLL; from it come the TMDS, system and pixel clocks.

01
microSD
SPI mode reads the boot image
02
sd_rom_loader
validates sector 0, streams 1…32
03
boot_shadow_rom
16 KB ROM window loaded
04
Self-test
RAM · VRAM · VIA · UART
05
T65 release
Reset vector @ $FFFC
Portability

One core, two FPGA platforms

The board-independent RTL core runs on two targets with minimal board glue.

Active bring-up platform

Sipeed Tang Primer 20K

Gowin GW2A-18
  • HDMI/DVI output through a TMDS serializer
  • On-board microSD boot path in SPI mode
  • Native SID sound via the dock's PT8211 DAC
  • BSRAM backend for low power, DDR3 optional
  • PS/2 keyboard over PMOD, CH340 UART
Reference platform

PIX16 Board

Xilinx Spartan-6 · xc6slx16
  • VGA text output with a boot status screen
  • SDRAM-backed main RAM with self-test
  • SD boot of the 16 KB shadow ROM
  • UART monitor with live ROM upload
  • ISE project versioned and reproducible
Verification

Incrementally tested with GHDL

Every block is independently testable — from address decoding to the FAT32 reader.

Testbench areaCoverage
Bus & resetAddress decoding of all device windows, reset-vector fetch, ROM-scripted bus cycles
VIA 6522Port masking, IER/IFR, Timer-1 IRQ assertion and clearing
UART 6551Status, TX, RX, overrun, programmed reset, RX IRQ
T65 CPUBoot from real ROM, UART/VIA access, IRQ handler, kernel smoke test
D64 / FAT32Real-geometry images read lazily, start LBAs verified
SID & FPUSID audio/filter bounded & non-silent, 8.24 multiply against reference