Electrical Engineering › Section V · Programmable logic and data storage › Topic V.1
SPLDs, CPLDs, and FPGAs
One programmable chip can replace a board full of fixed gates, and the same chip can be rewired tomorrow. Simple PLDs, complex PLDs and FPGAs do this in different ways, and knowing how each one builds logic tells you which to choose.
Logic you can rewire
Older digital boards carried dozens of fixed-function chips, and changing the design meant a new board. A programmable logic device (PLD) holds uncommitted logic whose connections the designer sets by programming. "Programmable and fixed-function logic, instruments, and troubleshooting" introduced the idea; this topic looks inside the three main families: simple PLDs (SPLDs), complex PLDs (CPLDs) and field-programmable gate arrays (FPGAs). They build logic either with arrays that form sum-of-products expressions or with tiny memories that store truth tables.
Programmable arrays: PAL, PLA and GAL
Any combinational function can be written in sum-of-products (SOP) form, as "Boolean simplification, standard forms, and truth tables" showed, so an SPLD is an AND array feeding an OR array. Each input enters in true and complemented form, \(A\) and \(\overline{A}\), on lines that cross the inputs of every AND gate, and a programmable link at each crossing is either connected or open. In a PAL (programmable array logic) the AND array is programmable and the OR array fixed, so each OR gate always receives the same few product terms. Many PALs used fuses and were one-time programmable (OTP). A PLA (programmable logic array) programs both arrays. A GAL (generic array logic) keeps the PAL layout but uses reprogrammable EEPROM cells.
Worked example: fitting a function into a PAL
One PAL output has an OR gate fed by three AND gates, each with input lines \(A, \overline{A}, B, \overline{B}, C, \overline{C}\). Program it for
1. Four minterms but only three AND gates, so simplify first. 2. The first two terms differ only in \(A\), giving \(\overline{B}C\); the last two differ only in \(C\), giving \(AB\). So \(X = \overline{B}C + AB\). 3. Gate 1 keeps its links to \(\overline{B}\) and \(C\); gate 2 keeps \(A\) and \(B\); all other links on these gates are opened. 4. Gate 3 is unused: leave all six links intact, so it ANDs each variable with its complement and outputs 0. 5. Check: at ABC = 101, \(\overline{B}C = 1\), so X = 1, as the minterm \(A\overline{B}C\) requires.
Macrocells and their modes
In a PAL or GAL the OR output passes through a macrocell before reaching a pin. A macrocell typically holds an XOR gate, a D flip-flop, multiplexers and a tri-state output buffer. A configuration bit on one XOR input sets whether the SOP result is inverted. A multiplexer picks the mode: in combinational mode the flip-flop is bypassed, and in registered mode the result enters the D input and reaches the pin only at the active clock edge, as in "Latches and flip-flops". A feedback path returns the output to the AND array, so registered macrocells can build counters and state machines. The classic 22V10 GAL has 10 output macrocells.
CPLDs: many SPLDs on one chip
A CPLD (complex programmable logic device) joins several SPLD-like blocks, called logic array blocks (LABs) or function blocks, through a programmable interconnect array (PIA) that routes signals between blocks and pins. Each block holds a group of macrocells sharing one AND array. Each macrocell owns only a few product terms, so CPLDs add expanders: a shared expander is an inverted product term fed back so any macrocell in the block can use it, and parallel expanders borrow unused terms from neighbouring macrocells. Classic CPLDs store their configuration in nonvolatile EEPROM or flash, so they work the instant power arrives, with predictable delays.
FPGAs: logic blocks, routing and I/O
An FPGA (field-programmable gate array) has no large AND-OR arrays. It has a grid of many small configurable logic blocks (CLBs), ringed by input/output blocks and joined by a dense mesh of programmable interconnect. Small, simple blocks make the architecture fine grained; larger ones make it coarse grained. Each block contains look-up tables, flip-flops and multiplexers, usually with fast carry logic. Capacities run from a few thousand logic cells to millions, far beyond any CPLD. The first commercial FPGA appeared in about 1985.
Look-up tables
The function generator in an FPGA is a look-up table (LUT). A LUT with \(k\) inputs is a tiny memory of \(2^k\) bits: the inputs form an address, and the bit stored there is the output. The design tools load the function's truth table into it, so any function of \(k\) variables fits, simplified or not. A 4-input LUT holds 16 bits and can produce any of \(2^{16} = 65{,}536\) functions; many current FPGAs use 6-input LUTs of 64 bits. Inside, a LUT is a tree of 2-to-1 multiplexers steered by the inputs, as in "Multiplexers, demultiplexers, and parity". Wider functions are split across several LUTs.
Worked example: loading a 3-input LUT
Program a 3-input LUT for \(X = \overline{A}B + AC\), with \(A\) as the most significant address bit. 1. The LUT has \(2^3 = 8\) bits, at addresses 000 to 111. 2. Evaluate X at each address, in order from 000: 0, 0, 1, 1, 0, 1, 0, 1. 3. Store those eight bits. 4. Check one entry: at ABC = 101, \(\overline{A}B = 0\) and \(AC = 1\), so X = 1. 5. Read the pattern: when A = 0 the output copies B, and when A = 1 it copies C, so the LUT acts as a 2-to-1 multiplexer with A as its select line. No simplification was needed.
Volatile configuration and hard cores
Most FPGAs hold their configuration in SRAM cells, which are volatile: the design vanishes at power-off and is reloaded at every start-up, usually from an external flash chip. Some FPGAs use flash cells, which keep the design and are live at power-up, or one-time antifuses. Modern FPGAs also embed fixed circuits called hard cores: RAM blocks, DSP multiplier blocks, clock managers, high-speed serial transceivers and, in system-on-chip FPGAs, whole processors. A soft core is a processor built from ordinary logic blocks.
Choosing SPLD, CPLD, FPGA or ASIC
SPLDs suit a few equations of glue logic, though few new designs use them. CPLDs suit instant-on control logic with fixed timing. FPGAs suit large designs: signal processing, networking, video, accelerators and chip prototypes. At very high volumes engineers design an application-specific integrated circuit (ASIC) instead. Its logic is fixed in manufacture, so each chip is faster, smaller and lower in power, but design and mask costs can reach millions of dollars, and a mistake cannot be reprogrammed away.
Common mistakes to avoid
First, assuming a PAL output can take any number of product terms: each OR gate has a fixed count, so simplify first or use expanders. Second, mixing up PAL and PLA: in a PAL only the AND array is programmable. Third, thinking an unused AND gate with all links intact outputs 1: it sees each variable and its complement, so it outputs 0. Fourth, expecting an SRAM-based FPGA to keep its design without power. Fifth, sizing a LUT by the gates in an expression: only the number of inputs matters.
Key takeaways
A PAL programs only the AND array, a PLA programs both, and a GAL is a reprogrammable PAL. Macrocells add polarity control, a flip-flop for registered mode, a combinational bypass and feedback. CPLDs link SPLD-like blocks through a programmable interconnect array, use expanders for extra product terms, and are instant-on. FPGAs use many small logic blocks built on k-input LUTs, which store \(2^k\)-bit truth tables, plus routing, I/O blocks and hard cores; most are SRAM-based and reload at power-up. ASICs win at high volume but cannot be changed.
Flashcards
Flashcard
Programmable logic device: uncommitted logic whose connections the user programs
Test your understanding
Question 1 of 5
Which statement correctly describes the arrays in a PAL?
Question 2 of 5
How many bits of storage does a 5-input look-up table need?
Question 3 of 5
In a PAL, an AND gate is not needed for the function, so all of its input links are left intact. What does that gate contribute to the OR output?
Question 4 of 5
An SRAM-based FPGA is switched off and then on again. What happens to its design?
Question 5 of 5
A CPLD macrocell is set to registered mode. When does its output pin change?
