So, what FPGA is? According to Wikipedia “a field-programmable gate array (FPGA) is an integrated circuit designed to be configured by the customer or designer after manufacturing—hence “field-programmable”.”.
The FPGA contains a whole lot of logic gates that can be configurable by customers in any way they like. It means that we can create our own integrated circuit on this chip. We can do a simple multiplexer from it, create a memory controller, microcontroller or a CPU. We can even put the whole computer inside it! Amazing!
The main FPGA characteristic is the amount of logic gates that it has. For instance, the most basic Altera Cyclone chip has about 5,000 gates. It’s a lot! For instance a CPU like Z80 or 6502 requires from 1,000 to 2,000 gates. The whole retro computer based on those CPUs will take 3,000 – 6,000 gates. Apart of the gates, FPGA normally has some memory in it (not much, usually around 50-100 kilobytes) and several PLLs.
FPGAs are not expensive as well. A quite decent chip for most hobby projects costs $10-$20.
A special language is used to program FPGA. The most popular ones are VHDL and Verilog. Each of them has its own benefits. They can be mixed in one project so it is good to know both of them.
I prefer VHDL because I find that it gives better control. But some tasks are easier to do in Verilog.
Those languages are not program languages like C or BASIC. They are used to describe the schematic. The normal project consists from “processes”. Each process does its job independently from the others. Processes communicate between each other by “signals”, just like normal electronic components do. Usually, all processes are syncronised by clock signals.
There should be the same considerations in FPGA design like in usual digital electronic design. For instance, signal timing should be considered to avoid “signal racing” exactly like in traditional design. Even basic FPGA are good enough to use 50MHz or even 100MHz clocks. More than enough for any retro computer!
To create and debug devices on FPGA it is essential to have a good development board with a chip that is going to be used in a project. There are several manufactures of FPGAs, but the most popular are Altera and Xilinx. I use Altera for my projects just because I have Altera dev. board. The main principles are the same, so it is relatively easy to switch between those brands.
To program Altera devices there is a free version of software called “Quartus”. It can be downloaded from Altera site. I use Terasic DE1 dev. board with Altera Cyclone II chip on it.
This board is almost perfect for hobby projects. Check it out:
- Altera Cyclone II 2C20 FPGA with 20,000 LEs (more than enough for hobby projects)
- USB Blaster built in on board for programming and user API controlling (don’t need a programmer)
- 8Mbyte (1M x 4 x 16) SDRAM, 4Mbyte Flash Memory, 512Kbyte (256K x 16) SRAM (decent amount of memory for most projects)
- SD Card Socket
- 4 Push-button switches and 10 DPDT switches
- 8 Green User LEDs, 10 Red User LEDs and 4 Seven-segment LED displays (great for debugging)
- 50MHz oscillator, 24MHz oscillator, 27MHz oscillator and external clock sources
- 24-bit CD-Quality Audio CODEC with line-in, line-out, and microphone-in jacks
- VGA DAC (4-bit R-2R per channel) with VGA out connector
- RS-232 Transceiver and 9-pin connector
- PS/2 mouse/keyboard connector
- Two 40-pin Expansion Headers (in case if you want to connect something else)
The price of this board is $150 plus delivery from Terasic site.
I’m going to use this board to make a replica of the “UT-88″ computer that I briefly described in the previous post. Lets see how it goes.