mSpectrum

In 2008 I started learning about field-programmable gate arrays (FPGAs), a subject that in the late 1980s was not covered in my electronics master. It did cover the design of chips using layers of metal and semiconductors, which at the time was a very cumbersome process. Later I found the idea of creating hardware “simply” by using a hardware description language (HDL) very intriguing and got myself a couple of Xilinx Spartan 3E FPGA development boards and starting learning.

My initial (commercial) Spartan 3E FPGA boards
My initial (commercial) Spartan 3E FPGA boards

First steps with Xilinx Spartan 3E

I started by extending some VGA example code to re-create the ZX Spectrum video system. The ZX Spectrum is the home computer system from my youth that still elicits warm feelings. I loaded the on-chip FPGA RAM with the loading screen-shot of one of my favorite games and started coding. Next step was to optimize the implementation to support the native resolution of the VGA monitors to get nice crisp pictures. With the ultimate goal reaching full HD (1080p) resolution on the limited Spartan 3 hardware.

mSpectrum running at full-hd (1080p) resolution on Spartan 3E
mSpectrum running at full-hd (1080p) resolution on Spartan 3E

To create a minimal working ZX Spectrum in FPGA I added the open source Z80 core (T80), a copy of the ZX Spectrum ROM, RAM and a PS/2 keyboard module. Over time I added sound and a supervisory CPU (based on the Xilinx Spartan 3 Picoblaze) and firmware to load and save from SD cards and various other functions. I also included to support the ZX Spectrum 128K with an AY-3-8912 sound chip core, reaching the maximum of the Spartan 3 boards.

Loading from SD-card using the supervisory CPU
Loading from SD-card using the supervisory CPU

Stepping up to the Spartan 6

The project lay dormant for about 5 years and in 2016 I got interested in upgrading to the Spartan 6 FPGA. Not only for the additional size and power of this chip, but also to support HDMI in addition to VGA. During that time I was also starting to upgrade my electronic design capabilities and wanted to develop my own FPGA board. During the last half of 2016 I designed the “mSpectrum Spartan 6 edition” board and transformed the VHDL mSpectrum source code to support both Spartan 3 and Spartan 6. The Spartan 6 board features a singular 512KB SRAM memory chip, with an interface very similar to the PSRAM memory available on the Nexus 2 Spartan 3E board. The Picoblaze supervisory CPU was upgraded to the Spartan 6 variant.

mSpectrum Spartan6 edition with LX9 FPGA and 512 KB SRAM
mSpectrum Spartan6 edition with LX9 FPGA and 512 KB SRAM

mJTAG programmer

To program my own Spartan 6 board, I designed and build a JTAG programmer “mJTAG” that is heavily based on the design of the Bus Blaster project from Dangerous Prototypes.

mJTAG programmer based on the Bus Blaster project
mJTAG programmer based on the Bus Blaster project

Larger capacity Spartan 6 boards

My own Spartan 6 board is based on the LX9 version of the chip. This is the largest capacity available in a TQFP-144 package. Larger chips (LX16 and onwards) are only available as ball grid arrays (BGAs) and thus very difficult to use in your own designs. A company called QMTECH offers very affordable Spartan 6 modules containing either LX16 or LX25 chips, with either SDRAM or DDR3 memory on board. I created an mSpectrum motherboard for these modules providing PS/2 keyboard, SD card, sound, VGA and HDMI connectors.

mSpectrum motherboard with QMTECH Spartan6 LX16 module with SDRAM
mSpectrum motherboard with QMTECH Spartan6 LX16 module with SDRAM

Supporting Altera / Intel Cyclone V

To broaden my experience to other FPGA vendors, I got myself a DE10-nano board, containing an Altera / Intel CycloneV FPGA. Components like HDMI use vendor dependent code and had to be completely rewritten for the Cyclone V family. Other cores like onboard ROM and RAM had to rewritten into generic VHDL code that could be translated by the vendor tools to the specific architectures.

DE10-nano CycloneV board with mSpectrum VGA, PS/2, audio and SD-card connectors
DE10-nano CycloneV board with mSpectrum VGA, PS/2, audio and SD-card connectors

The Picoblaze supervisory CPU is designed to directly map on to the Xilinx FPGA-fabric and is not written in generic HDL. Although people have created compatible Picoblaze designs in generic HDL, I chose to move to a new supervisory CPU design: an other Z80 (T80 core) cpu. The firmware was rewritten from Picoblaze assembly to C-code. The Z80 C-code is translated to assembly / machine language using the SDCC cross-compiler.

ZX Spectrum Next

The latest installment occurred in November 2020 and is a 4 layer board motherboard that contains two 512 KB SRAM chips for use with the QMTECH boards, making it possible to run the popular ZX Spectrum Next core as well as the mSpectrum core.

4 Layer board providing SRAM memory
4 Layer board providing SRAM memory