Sub topic 10
ROM, PLA and PAL as Logic Implementations
This chapter assumes you can read a truth table, write a function in canonical SOP form (a sum of minterms), and use decoders. A decoder produces every minterm of its inputs, and that is the idea behind the devices below.
Why programmable logic
A combinational function can be built from individual gates. It can also be built from a regular array of AND gates feeding a regular array of OR gates, where you choose which connections exist. Such an array is called programmable logic. Every function in this chapter is a two-level AND-OR circuit. Only the programmable parts differ.
| Device | AND array | OR array |
|---|---|---|
| ROM | Fixed (a full decoder) | Programmable |
| PLA | Programmable | Programmable |
| PAL | Programmable | Fixed |
ROM as a logic device
A ROM (read-only memory) with n address lines and m output bits stores 2^n words of m bits each. Viewed as logic, it is a function generator:
- The n address lines are the n inputs.
- An internal n-to-2^n decoder activates exactly one word line per input combination. This is the fixed AND array, and it generates all 2^n minterms.
- Each output bit is an OR of the minterms where that column of the stored table holds a 1. These connections are the programmable OR array.
So a ROM implements m functions of n variables directly from their truth tables. You do no minimization. You write the truth table into the memory.
Worked example: a 3-bit squarer
Let the input be a 3-bit number A = A2A1A0, and let the outputs be the 6-bit value A squared. The ROM needs 2^3 = 8 words of 6 bits. Its size is 8 × 6 = 48 bits.
| A (decimal) | Address A2A1A0 | Output (A²) | Binary B5…B0 |
|---|---|---|---|
| 0 | 000 | 0 | 000000 |
| 1 | 001 | 1 | 000001 |
| 2 | 010 | 4 | 000100 |
| 3 | 011 | 9 | 001001 |
| 4 | 100 | 16 | 010000 |
| 5 | 101 | 25 | 011001 |
| 6 | 110 | 36 | 100100 |
| 7 | 111 | 49 | 110001 |
B0 always equals A0, because squaring preserves parity. B1 is always 0, because a square is 0 or 1 modulo 4. A designer can therefore drop those two outputs from the memory and wire B0 straight to A0. The ROM then needs only 8 × 4 = 32 bits. Checking for such redundant outputs is a standard GATE trick.
ROM sizing rules
- Words = 2^n, where n is the number of input variables.
- Total bits = 2^n × m.
- Adding one input variable doubles the ROM. This exponential growth is the main weakness of the ROM approach.
- A ROM stores a full truth table, so it is wasteful when a function has few product terms. That is the motivation for the PLA.
PLA: programmable AND and OR arrays
A PLA (programmable logic array) has k input variables, p product lines, and m outputs. Both planes are programmable:
- The AND plane forms p product terms. Each product can use any subset of the inputs, each in true or complemented form.
- The OR plane sums any subset of those products for each output.
The PLA does not generate all 2^k minterms. It generates only the p product terms you need, and these can be simplified implicants, such as one term covering a whole K-map group. This is why a PLA is usually far smaller than a ROM for the same function.
Many PLAs also include an XOR stage on each output. It lets you program the output polarity, so the device can implement either F or F'. You choose whichever has fewer product terms.
Sharing products across outputs
A key PLA advantage is that products are shared by several outputs. The product lines are counted once, however many outputs use them. When you minimize a multi-output function, look for common product terms across the outputs, not only the smallest expression for each output on its own.
Worked example: a two-output PLA
Implement these functions with a PLA:
- F1 = AB' + AC + A'BC
- F2 = AC + BC
Unique product terms: AB', AC, A'BC, BC. That is 4 products. AC appears in both outputs, so it is built once.
You could shrink F1 further. AB' + AC + A'BC reduces to AB' + AC + BC, because A'BC + AC = C(A'B + A) = C(A + B) = AC + BC. Now F1 = AB' + AC + BC and F2 = AC + BC. The products are AB', AC and BC, so only 3 are needed.
| Product line | A | B | C | F1 | F2 |
|---|---|---|---|---|---|
| AB' | 1 | 0 | – | 1 | 0 |
| AC | 1 | – | 1 | 1 | 1 |
| BC | – | 1 | 1 | 1 | 1 |
In the AND plane, "1" means the true input is connected, "0" means the complement is connected, and "–" means the input is unused. In the OR plane, a "1" means that product feeds that output.
PLA size
A PLA with k inputs, p products and m outputs has these programmable connection points:
- AND plane: 2k × p, since each input and its complement can connect to each product line.
- OR plane: p × m.
The program table above has k = 3, p = 3, m = 2. Its AND plane has 2 × 3 × 3 = 18 crosspoints, and its OR plane has 3 × 2 = 6.
PAL: programmable AND, fixed OR
A PAL (programmable array logic) keeps the AND plane programmable but fixes the OR plane. Each output ORs a fixed number of product lines, for example 4 or 8.
Consequences:
- It is cheaper and faster than a PLA, because the fixed OR plane is simpler.
- Products cannot be shared between outputs. If two outputs need the same product, you must generate it twice, once on each output's own lines.
- If an output has more product terms than its OR gate accepts, you must split the function. You build part of it on one output, feed that back as an input, and combine it on another. This costs extra delay.
Worked example: fitting a function into a PAL
A PAL has 3 inputs and each output ORs exactly 2 product lines. Can it implement F = A'B + AB' + C?
F has 3 products, so one output with 2 lines is not enough. Use two outputs:
- Output X = A'B + AB' (this is A XOR B, 2 products).
- Output F = X + C. This needs 2 products, X and C, but only if X is fed back as an input to the AND plane.
The result works, but F is now two gate levels deep through the array. This kind of question appears in GATE as "how many PAL outputs or lines are needed".
Comparison and decision criteria
| Feature | ROM | PLA | PAL |
|---|---|---|---|
| AND plane | Fixed, full decoder | Programmable | Programmable |
| OR plane | Programmable | Programmable | Fixed |
| Products available | All 2^n minterms | Chosen p terms | Fixed count per output |
| Needs minimization | No | Yes | Yes |
| Product sharing | Implicit | Yes | No |
| Typical cost | Grows as 2^n | Moderate | Lowest |
| Flexibility | High for dense tables | Highest | Lowest |
Choose by the shape of the function:
- Use a ROM when the table is dense and has few inputs, such as a code converter or lookup table with many minterms.
- Use a PLA when the function has many inputs but few distinct products, especially with shared terms.
- Use a PAL for simple, fast, low-cost logic where each output needs only a few products.
Implementing with a ROM in code
You can model a ROM as a lookup table in Verilog. The synthesis tool maps it to memory or logic. This module implements the squarer from earlier.
module rom_square(input [2:0] a, output reg [5:0] y);
always @(*) begin
case (a)
3'd0: y = 6'd0;
3'd1: y = 6'd1;
3'd2: y = 6'd4;
3'd3: y = 6'd9;
3'd4: y = 6'd16;
3'd5: y = 6'd25;
3'd6: y = 6'd36;
3'd7: y = 6'd49;
default: y = 6'd0;
endcase
end
endmoduleCommon errors
- Counting ROM size by products. ROM size depends only on the number of inputs and outputs, 2^n × m. It does not depend on how simple the function is.
- Forgetting complements in the AND plane. A PLA needs both X and X' lines for each input, which is why the AND plane has 2k columns.
- Treating a PAL like a PLA. A PAL cannot share a product between outputs, so count the product for each output separately.
- Ignoring output polarity. If F' has fewer products than F, a PLA with an output XOR can implement F' and invert it.
- Not minimizing for a PLA. Fewer products mean a smaller array. Use K-maps, and look for terms common to several outputs.
Exercise
A ROM implements a 4-bit binary-to-Gray converter. How many words and how many bits must it store? Then give the minimum number of product lines a PLA needs if the Gray outputs are G3 = B3, G2 = B3'B2 + B3B2', G1 = B2'B1 + B2B1', G0 = B1'B0 + B1B0'.
Show answer
The ROM has 4 inputs and 4 outputs, so it stores 2^4 = 16 words of 4 bits, which is 64 bits. For the PLA, the distinct products are B3 (for G3, which is a single-literal product), B3'B2, B3B2', B2'B1, B2B1', B1'B0 and B1B0'. These are 7 distinct products and none are shared, so the PLA needs 7 product lines.
Exercise
A PLA has 5 inputs, 8 product lines and 3 outputs. How many programmable crosspoints does it have in the AND plane and in the OR plane?
Show answer
The AND plane has 2k × p = 2 × 5 × 8 = 80 crosspoints. The OR plane has p × m = 8 × 3 = 24 crosspoints. The total is 104.
Exercise
Two outputs of a PAL both need the product term XY'. Each output has its own fixed OR gate. How many times is XY' generated, and why does a PLA do better?
Show answer
It is generated twice, once on a product line of each output, because a PAL's OR plane is fixed and cannot share a product line between outputs. A PLA has a programmable OR plane, so XY' is generated once on one product line and connected to both outputs.