Home ProgrammableLogic

Programmable Logic

The problem
These days microchips for countless functions are available
Still especially on the digital domain it often is the case that a chip for a specific niche function is not available,
so the function needs to be created using multiple integrated circuits.
As early as the seventies the problem was recognized that even with the pretty large collection of the 7400 series sometimes it was cumbersome and expensive to design a circuit for specific needs.
It occurred that if would be a great thing to have chips which function could be defined on the spot.

Chip manufacturer Lattice came with a smart solution in the late seventies.
A chip that hold-ed a number of logic AND gates that could be configured on location like a Programmable-ROM or EPROM.

Signetics later came up with a version that offered both AND and OR gates.
By configuring the devices smartly its function could be customized to fit required needs.
A multi chip address selector or complex logic gate could be reduced to a single chip and
be programmed at the factory.
Also in case of UV Erasable versions they could be reprogrammed such updating the hardware
without a redesign.
It also reduced the amount of different chips to be ordered.
Many of the same chips with different configuration software could diminish the required stock pile.

The different names PAL, PLA and GAL basically are the same for roughly the same idea depending on the brand.

Although great, this technology was not widely spread as it required as it people with specific skills
and programmers that where not very common available.
Despite they where great-fully used in aviation and military applications.

The concept of programmable logic gates lead to a desire for further development.
For instance if you want to create a specific need UART circuit you'll need shift multiple registers,
counters and logic gates which only partially could be solved using existing programmable logic.
In stead of just using logic gates, both Altera (now Intel) and Xilinx came with the idea of creating powerful macro cells that could be configured as a gate, D-type flip-flop, and some other basic blocks required to create any logic function possible.
By using a lot of these macro-cells in a single chip it became possible to create very powerful custom chips cheaply.

A cheap CPLD develop kit i used for some of my experiments A cheap CPLD develop kit i used for some of my experiments

While developments progressed, even more desirable concepts where created.
Altera replaced the macro-cell's by Logic Elements (LE's) while Xilinx did the same calling it Configurable Logic Blocks.
Main differences are that these small units are not flashed but are memory based.
The device now needs to be programmed each time it is powered up.
This can be done using a JTAG programmer, or using a EEPROM holding the configuration.
Also these LE's (or CLB's for that mather) again are grouped such that a higher flexibility and more important a way larger number of these small powerful units can be integrated in the chip
such offering a very powerful configurable device.
Also with the more modern versions (that's all of them) extra features like PLL, dedicated multipliers where added.

Xilinx and Altera have become the most important manufacturers of CPLD's and FPGA's.
Some small players like Lattice and Micro-Chip have some FPGA like devices in their selection but have no relevant role to play in this market.

An older but still popular Xilinx Spartan-6 FPGA An older but still popular Xilinx Spartan-6 FPGA

New developments
With the current situation development still continues.
Next to the parallel logic FPGA's offer, often a sequential programmable device like a microprocessor was desired.
It's not to hard to implement a microprocessor into a FPGA design,
however of course this takes lots of it resources that could be applied more efficiently.
For this reason most modern FPGA's often hold one or more ARM core's often running Linux.
Personally until now i used a separate microcontroller, but that's because most of the projects i did
really where proof of concepts which architecture still had to be developed.

How to use FPGA's and CPLD's
All these fancy stories of course have a downside.
Here's a couple of them:

 (Pitfall's)  FPGA's are challenging require thorough knowledge of digital logic and experience to really understand what could go wrong.
Pitfalls are lurking all over the place !

 (HDL in general)  The VHDL program language looks very archaic which is understandable knowing its based on languages like Modula-II and ADA
Verilog looks more modern and easy to learn but is not really deterministic and therefore can cause more troublesome to solve challenges.

Effectively this results into the following

 (HDL in the USA)  They prefer Verilog, except for military and aviation applications where VHDL is chosen.
After all you like an aircraft to respond as expected not affected by logical maybe's.

 (HDL in Europe)  Here most people use VHDL.
It is not difficult to learn but a lot of typing and declaring,
when done correctly offering a sturdy design.

 (Programming)  Furthermore understand that both languages are Hardware Description Languages.
This effectively means that something totally different will happen than a C or FORTRAN programmer would expect.
The result will not be a program but a design.
The output will not be a debugable assembly file (although you can at the cost of many resources add debug points in a design)
This is technology definitely not thought of for the novice engineer !
This of course does not mean one should not give it a try.

Amateur applications
Although FPGA's are relatively expensive devices these days there are a lot of affordable development board available on places like Ebay.
A mostly required JTAG programmer also can be obtained using 'the silk route'.
(some develop kits have one build in)

The required Integrated Development Software Altera-Quartus, Xilix-ICE, Xilinx-Vivado, Lattice-Diamond
are freely available (after registration) and will run on Windows and Linux.

Some popular SDR devices like AnalogDevices PlutoSDR, The LimeSDR, FreeSRP and USRP's contain a FPGA.
It is not for everyone to create a HDL design yourself, but it surely not is impossible.
Be sure what you are doing, check and re-check and keep in mind,
like with microcontrollers, a wrong setup design can severely damage the chip !
This however does not stop people from using a Arduino, so why not to try a FPGA or CPLD.
So far till now i only once blew a chip because a grounding problem causing 24Volts to reach the chip.

A cheap JTAG programmer A cheap JTAG programmer

I you really want to experiment with 'cutting edge' technology try to purchase one of the many FPGA or CPLD kits available.
CPLD's are some more easy to use but also more limited in capabilities.
On the other hand they offer better predictable timings, often relevant for DSP applications like SDR.

Old stuff like PAL, PLA and GAL are rare to find and seldom interesting,
although recently a found a guy who used them for address decoding vintage microprocessors.

More info
This Dutch language magazine presents a article a wrote about the subject
DARU nr 17
Also on this website projects using both FPGA's and CPLD's can be found.