Introduction: A Beginners Guide to Programmable Logic Devices

About: Open source hardware design engineer - in addition to designing power supplies and writing VHDL code for FPGAs and CPLDs, I am also an active part of the open source hardware movement.

I put this instructable together after noticing that there really isn’t anything on the website about programmable logic except for one question and one instructable about a programmer (see links below).

 https://www.instructables.com/answers/Whats-an-FPGA-Whats-an-CPLD/

 https://www.instructables.com/id/Ghetto-Programmable-Logic-CPLD-Development-Syste/


So in an effort to try to help everyone understand what a programmable logic device is and as a
means of posting my first instructable here you are.
 
 

Programmable logic devices, what are they? Specifically they are an integrated circuit that you program using a hardware description language such as VHDL or Verilog. Other languages that you may have heard of are CUPL or ADA. With the correct tools you can even generate a schematic that is used to build the file that will be used to program the device.
 
 

 There are several types of programmable logic available. Older versions like the programmable array logic (PAL) such as the PAL20R8, the generic array logic (GAL) such as the GAL22v10, the programmable logic device (PLD) such as the 22V10, the simple programmable logic device (SPLD) such as the 20V8 have been around for quite some time.
 
 

The complex programmable logic device (CPLD) such as the XC2C32A from Xilinx, and the field programmable gate array (FPGA) such as the XC3S50 from Xilinx are some of the newer versions of programmable logic that are a result of improvements to the original types of devices.



These types of devices are available from several manufacturers such as Texas Instruments, Cypress Semiconductor, Atmel, Lattice Semi, Altera, Actel, and Xilinx. Some of these suppliers no longer manufacture these devices themselves but have sold the rights to Rochester Electronics who manufactures them with the same part numbers and logos while some like Lattice still offer GAL devices in addition to newer CPLDs and FPGAs.

Step 1: Types of Programmable Logic Devices.

For those that noticed, I mentioned two types of parts, a PLD (and variants) and FPGA. What are the differences? The short answer is architecture. The FPGAs generally have lots of Flip Flops while PLDs have much fewer if any at all.

In addition today’s FPGAs usually get other features such as built in multipliers, dedicated block ram, and can generally handle more interface standards (such as LVDS). Most FPGA devices need a separate device to program them (the exception to this is Actel and the Spartan 3AN series from Xilinx). This is due to the fact that most FPGAs are SRAM based devices and when power goes out, the program is lost. The FPGA architecture is structured similar to the pictures below:


Step 2: Types of Programmable Logic Devices Part II

CPLDs on the other hand dont need a separate device to program them and they do not loose their program when power is cycled or lost. Their architecture is completely different from that of a FPGA as shown below. In addition some CPLDs are able to handle different signaling schemes (LVDS, HSTL, etc) as well as have the ability to consume tiny amounts of power when put into power miser modes.
 

As you can see the Xilinx device is broken out in to I/O Blocks, programmable logic arrays (PLA), and the advanced interconnect matrix (AIM). Programming is done via the JTAG pins on the device.

The PLA is part of the function block. As you can see signals are routed from the I/O Blocks to the function block then to the AIM and vice-versa. From the picture you can see small blocks labeled MC1 to MC16. These are macro cells.

 


The PAL, GAL, and PLD devices have an architecture as shown below.

Step 3: What Device Do I Use?

Like micro controllers you have lots of options and price points. The main thing to consider when selecting a PLD or FPGA is what is it you need to do. Remember programmable logic devices wont have a any analog inputs such as A/D (The exception to this is the Actel Smart Fusion and that is yet another instructable) so everything is digital in nature. Practically anything you can do in a micro controller can be done in a piece of programmable logic and in a great many designs engineers routinely use both a FPGA/CPLD with a Microprocessor or micro controller.

A selection guide for Xilinx CoolRunner II devices is shown below and the PDF is attached if the image is too fuzzy for you.
 

To get an idea of what other devices are out there here are some links to get you started:

 

www.xilinx.com

www.altera.com

www.atmel.com

www.digikey.com(my favorite source for parts).

Step 4: Tools

Like micro controllers, you need a tool to allow you to develop your code, test it both before and after layout via simulation, and at some point be able to program your part. Depending on your budget you can get tools that range from being free to easily spending $50,000. The free tools really are all that you will need. Anything beyond that is going to be for the hard core or those who work for a company that has paid for a tool set from someone like Mentor Graphics or Synplicity.

All the mainstream suppliers (Xilinx, Altera, Atmel, and Actel) have free tools. Some need a license (Actel and Atmel) that limits you to a time frame for the tools to work while others are not time based and work forever once you have registered (Xilinx and Altera).

As I use Xilinx that is the tool set that we will cover. The FREE Xilinx tool set is called� WebPack and will allow you to design with most of the parts from Xilinx. This is a complete front to back tool that includes verification capability and two simulators (one from Xilinx and one from ModelSim).

Most of the tools look similar to this. This is Xilinxs ISE tool that you get when you down load WebPack. Here you can write your code and manage your project. For those that don't want to write code they can generate a schematic from with in the tool as shown below.

Step 5: Development Kits

For most of us a development kit is an absolute must. So what is out there? For Xilinx there are kits that start at $40 and can run as high as a few thousand dollars.

What will $40 get you? A CPLD starter kit from Xilinx that includes everything you see below:

For those that want to get into FPGAs then there are the Spartan 3 kits that start at $49 such as the Avnet Spartan 3A Evaluation Board as shown below and it comes with the CD and programming cable as well:

Step 6: VHDL, Verilog, or Schematics

Now for one of the easiest and hardest questions to answer; what language do I use if any at all? This question alone has been the source of some heated arguments amongst engineers so I will talk a bit about three options.

Schematic entry. Possibly the least difficult if one has experience with logic design at the gate level. Most tools have all the gates in the component library. The draw back is that with a schematic you have to specify and place each gate unless you have built functions and have saved them. With coding, you can describe how you want the logic to operate and not have to explicitly call out each gate. This is one of the benefits of coding with a hardware description language or HDL.

VHDL and Verilog are programming languages used to describe hardware type logic. Both are high level languages like C and C++ but do allow one to code a logic function at a very basic (i.e. gate level) level.

Here are some examples of an AND Gate using VHDL and Verilog in the attached PDF.


Step 7: Summary

So there you have it. A basic introduction into Programmable Logic Devices. Personally I prefer Xilinx but have used Altera, Actel, and Cypress in the past.

I hope this instructable was able to answer most questions that you might have had and hopefully it will cause you to have other questions as well.


Be on the lookout for more instructables dealing with programmable logic devices.