Make a Chip Pro

From Spectrum
Revision as of 15:24, 19 July 2022 by Winston (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Latest news

The board's FPGA side has been tested, showing the serial flash, static RAM, power supplies, and the FPGA itself is working. This project is a work in progress.

Purpose

Remember "Make a Chip?" The software for the ZX Spectrum often put on eBay as "Very r@re!!1" by sellers?

Make-a-Chip was software by Icognito Software which allowed you to design (and test) some simple logic circuits at about the scale of 74-series jelly bean logic (up to about a dozen logic gates). Back in those days, at home, we had no way of actually synthesising these circuits (other than buying some said 74-series logic and connecting it together on a breadboard, to the design we may have done in Make-a-Chip). Or you could realise your design in a PAL chip, an early incarnation of a chip you could put your own circuit design on at home, although the equipment back then to do that was a bit costly and awkward.

These days, things are very different. We have a plethora of capable programmable logic devices - from the CPLDs (some of which are big enough to implement a Spectrum ULA) the FPGA (field programmable gate array) which tend to have rather more resources, and often have some additional onboard circuits such as phase locked loops and block RAM.

This project has been named "Make a Chip Pro", as I'm building it not to specifically implement some project, but to be a board for developing other projects that add an FPGA to our favorite 8 bit system.

The board

The board hosts a Lattice iCE40 HX4K FPGA (in a 144 pin TQFP package), up to 512k of static RAM, a serial flash ROM for the FPGA's configuration (with plenty of storage left over for other uses), a crystal oscillator for timing, plus the power supplies needed for the FPGA. It has 25 GPIO pins brought out to a header, where other devices can be connected to the FPGA.

Nearly all modern chips work at 3.3 volts and below, and are not tolerant of the 5 volt signals used by older hardware like the Spectrum, so it also necessarily must include level shifting components. All the important Z80 signals are buffered with bidirectional buffers where necessary (including the address bus, so DMA is possible).

Why the Lattice iCE40

The iCE40 is a straightforward, low-cost FPGA and it's one of the best documented FPGAs that are available. Unfortunately, manufacturers tend to keep their programming bitstreams secret, which is unfortunate, as you are forced to use their (often bloated) IDEs to develop for them. SiliconBlue (which was bought by Lattice) by contrast, fortunately published the programming bitstream for the iCE40 range. The iCE40 range is also quite straightforwad - it literally is just a sea of logic blocks, some synchronous semi dual ported block RAM, and a couple of PLL blocks. There is also quite a capable chip (in the form of the iCE40 HX4K TQ144) that is in a package that can be hand soldered. Another great thing about the iCE40 is that you're not expected to use JTAG to program it - everything's done through SPI, so a cheap and cheerful Adafruit FT232H board can be used as the programmer.

You can use the Lattice proprietary IDE if you like, but you can also use the open source Icestorm toolkit.

One thing that Lattice won't tell you about the iCE40 HX4K TQ144 is that really it's an HX8K device in a TQFP 144 package :-) And the open source tools will treat it as an HX8K.

What can you fit in the chip?

My experimentation so far shows that a basic 65C02 'system on a chip' with a memory controller, some hardware for debugging, a 32-bit timer, an SPI interface, a 9600-baud UART and some other small devices only takes a third of the logic resources. You could easily implement something like a RISC V processor on the chip. There is 16kbytes of block RAM, so you could implement something like a ULA Plus with RGB out on the board.

GitHub repositories

The repo for the hardware (kicad files) is here: https://github.com/spectrumero/macp

The 65C02 that I've been using in various tests is here: https://github.com/spectrumero/verilog-65C02