Getting started with programmable logic

There are basically two types of programmable logic in common use, the CPLD or Complex Programmable Logic Device and the FPGA or Field Programmable Gate Array. You might as well forget about the older devices like PALs and GALs (PLDs), as CPLDs are basically several PALs/GALs on the same chip, giving much higher gate counts and lots more I/O pins for about the same price. They also tend to be easier to program, in that a low-cost in-circuit programmer may be purchased from the manufacturer of the device, or you can make your own, as the circuit usually consists of a buffer chip and a few Rs and Cs, which connects to the PC printer port. The Xilinx XC9536 is an ideal programmable device to start with in that it is readily available in an easy-to-use PLCC-44 package, uses a 5 V supply, has 36 macrocells and 800 gates, and costs less than $20 in small quantities. It also has on-chip flash memory for storing the device configuration, so you don't have to reprogram the device every time it is powered up. CPLDs have predictable delays from input to output pins, which is nice. On the negative side, they tend to require quite a lot of power.

FPGAs have a different architecture from CPLDs, more suited to the implementation of large and complex systems - the sort of thing for which ASICs have tended to be used in the past. They don't have predictable delays, each design has to be carefully checked and simulated to make sure that it works properly.

FPGAs are probably not the ideal way to learn about programmable logic, as they typically have upwards of 84 pins and 5000 gates - rather overwhelming for the beginner. Most of them also require configuring (programming) every time they are powered up, either via a programming cable, or a special EEPROM or flash device, which can cost more than the FPGA itself. They may also be configured using a microcontroller. The smaller FPGAs generally don't cost any more than CPLDs, by the way. State-of-the-art FPGAs like the latest VIRTEX chips from Xilinx have up to 2 million gates and several hundred pins. Devices with 10 million gates will be along soon!

Free development software for their CPLDs and FPGAs is available from the Xilinx web site: http://www.xilinx.com. Look for the WebPack download.

Here's a simple circuit using an XC9536 that you should be able to put together on a prototyping board quite quickly:

I've designed a single-sided PCB for this circuit that may easily be made at home with rudimentary facilities:

The prototyping area is useful for adding additional components: LEDs, switches, etc.

Here is the artwork for a transparency that may be printed on a suitable laser printer: 9536.zip The file also includes a PDF of the schematic, which should be clearer than the above version and a complete zipped version of a simple project that may be used to check the hardware. Unzip the project.zip file into a suitable directory.

When you have built your version of the circuit, run the WebPack software, and open the project test.npl. If you look at the schematics, you will see that it is a simple binary divider. Build the project and download the resultant JEDEC file into the CPLD. With a logic probe or LED and resistor connected to the output pin (check the fitter report to see which pin it is) you should see the output pulses (about 10 Hz with a 4 MHz clock input.

What can you do with these devices, apart from flashing an LED? CPLDs are ideal for mopping up glue logic in a microprocessor system, for which you might use a handful of TTL or CMOS chips - address decoding, wait-state generation, DRAM refresh, etc.

If you want to design and build your own computer (the sort of thing people used to make from lots of TTL chips in the good old days) you will need to get into FPGAs. A simple 8-bit CPU will fit into the smallest members of the Xilinx Spartan family, the XCS05 (5 V) or XCS05XL (3.3 V). You can get a high-performance 16-bit RISC CPU into the Spartan XCS20XL.

Return to Leon's home page: index.html

Hosted by www.Geocities.ws

1