ROM and Lookup Tables
Volatile memories, such as SRAM and DRAM, lose stored data when power disconnects. Systems require non-volatile memory to retain boot firmware, device microcode, and configuration parameters.
Furthermore, memory structures can implement complex combinational logic. A Read-Only Memory (ROM) functions as a physical truth table. This concept forms the basis of Field-Programmable Gate Array (FPGA) logic blocks.
The ROM as a Hardware Truth Table
A combinational logic function with $N$ inputs and $M$ outputs is defined by a truth table containing $2^N$ rows.
A read-only memory with $N$ address lines and $M$ data lines contains $2^N$ words of $M$ bits each.
By storing output truth table bits at the corresponding input address locations, the ROM implements the logic function directly. Applying an input address presents the precomputed output values onto the data bus after internal propagation delay ($t_{\text{acc}}$).
Figure 1 illustrates a simple 4-word by 3-bit diode/transistor ROM matrix:
The row decoder activates exactly one horizontal word line. Transistors located at specific grid intersections pull the vertical bitlines to ground, generating output logic 0. Intersections without transistors remain pulled high, producing logic 1.
For example, a BCD-to-seven-segment display decoder has 4 inputs and 7 outputs. A $16 \times 7$ ROM implements this decoder without requiring combinational logic minimization.
However, ROM capacity requirements scale exponentially ($2^N$). For functions with more than 16 to 20 inputs, discrete logic gates provide superior silicon efficiency.
Non-Volatile Memory Technologies
Non-volatile semiconductor storage technologies differ in programming and erasure mechanisms:
- Mask ROM: Data patterns are permanently patterned during wafer photolithography using metal layer masks. Mask ROM offers the highest density and lowest per-unit cost in high-volume production, but cannot be modified.
- One-Time Programmable ROM (PROM): Manufactured with microscopic fusible links. A programmer applies high current pulses to blow selected fuses. Data cannot be erased.
- Electrically Programmable ROM (EPROM): Stores charge on isolated floating gate transistors. Erasing data requires exposing the die to ultraviolet (UV) light through a transparent quartz window for several minutes.
- Electrically Erasable PROM (EEPROM): Erases and rewrites data byte-by-byte using Fowler-Nordheim electrical tunneling. Microcontrollers integrate small EEPROMs for calibration and configuration storage.
- Flash Memory: High-density EEPROM that executes erasure in multi-kilobyte blocks:
- NOR Flash: Supports random read access with execution-in-place (XIP) capability for microcontroller firmware.
- NAND Flash: Organizes cells into sequential pages and blocks. NAND flash achieves high storage density for solid-state drives (SSDs) and USB drives.
The FPGA Look-Up Table (LUT)
In an FPGA, configurable logic blocks do not use fixed logic gates. Instead, they use small Static RAM lookup tables (Figure 2).
A 4-input LUT (LUT4) contains:
- 16 configuration SRAM cells that store a 16-bit truth table.
- A 16-to-1 multiplexer tree controlled by four input variables ($A, B, C, D$).
A LUT4 can implement any of the $2^{16} = 65{,}536$ possible 4-variable Boolean functions by loading the appropriate 16-bit bitstream during power-on initialization. Modern FPGAs use 6-input LUTs (LUT6, containing 64 SRAM bits).
Logic Gates versus Lookup Tables
| Input Count ($N$) | ROM Array Size ($2^N$) | Optimal Architectural Choice |
|---|---|---|
| Up to 4 inputs | 16 bits | Single FPGA LUT; basic logic gates in ASICs |
| 5 to 8 inputs | 32 to 256 bits | Lookup table for arbitrary mappings; logic gates for arithmetic |
| 9 to 16 inputs | 512 to 65,536 bits | Dedicated Block RAM (BRAM) for arbitrary tables |
| Over 20 inputs | $> 1,000,000$ bits | Multi-level combinational logic gates |
Structured arithmetic operations (such as 32-bit adders) require minimal gate areas. In contrast, unstructured arbitrary mappings (such as cryptographic S-boxes) map efficiently into memory lookup tables.
Module 3 Architectural Summary
This concludes Module 3. Review the primary architectural concepts:
- Latches and Flip-Flops: Cross-coupled inverters create bistable storage. Master-slave configurations establish edge-triggered D flip-flops, governed by setup time, hold time, and clock-to-Q delay.
- Synchronous Design Discipline: A unified clock net synchronizes register updates. Two-stage synchronizers isolate asynchronous inputs to minimize metastability failures.
- Finite State Machines: System behavior models formally as Moore or Mealy state machines, implemented using state registers, next-state decoders, and output logic.
- Registers and Counters: Cascaded flip-flops form parallel-load registers and shift registers (SISO, SIPO, PISO, PIPO). Synchronous counters eliminate carry-ripple delays.
- Memory Arrays: Multi-ported register files provide concurrent operand access. 6T SRAM cells implement fast on-chip caches. 1T1C DRAM cells provide dense main memory, and non-volatile ROM/LUT arrays compute Boolean logic.
Module 4 introduces the Verilog hardware description language to model and synthesize these digital structures.
Practice Exercises
Problem 1
A Direct Digital Synthesis (DDS) sine generator uses a 10-bit phase accumulator to address a sine lookup ROM. The ROM outputs 12-bit amplitude samples. Calculate total ROM bit capacity and determine output frequency for a step size of 1 when driven by a 100 MHz clock.
Solution
Calculate capacity:
$$2^{10}\text{ words} \times 12\text{ bits} = 1024 \times 12 = 12{,}288\text{ bits}$$
With step size $k = 1$, the accumulator overflows every 1024 clock cycles:
$$f_{\text{out}} = \frac{f_{\text{clk}}}{2^N} \times k = \frac{100\text{ MHz}}{1024} \times 1 \approx 97.66\text{ kHz}$$
Problem 2
Derive the 16-bit configuration word for a 4-input LUT implementing:
$$F(A, B, C, D) = (A \cdot B) \oplus (C \cdot \overline{D})$$
Assume input $A$ is the MSB address and $D$ is the LSB address.
Solution
Evaluate $F$ across all 16 input combinations:
- Term $A \cdot B = 1$ for addresses
1100through1111(12 to 15). - Term $C \cdot \overline{D} = 1$ for addresses
0010,0110,1010,1110(2, 6, 10, 14). - Compute $F = (A \cdot B) \oplus (C \cdot \overline{D})$:
| ABCD | $A \cdot B$ | $C \cdot \overline{D}$ | Output ($F$) |
|---|---|---|---|
| 0000 to 0001 | 0 | 0 | 0 |
| 0010 | 0 | 1 | 1 |
| 0011 to 0101 | 0 | 0 | 0 |
| 0110 | 0 | 1 | 1 |
| 0111 to 1001 | 0 | 0 | 0 |
| 1010 | 0 | 1 | 1 |
| 1011 | 0 | 0 | 0 |
| 1100 to 1101 | 1 | 0 | 1 |
| 1110 | 1 | 1 | 0 |
| 1111 | 1 | 0 | 1 |
With address 0 at LSB, the binary bitstream is 1011_0100_0100_0100 (hexadecimal 0xB444).
Problem 3
An FPGA design requires an unstructured 12-input, 8-output lookup table. Explain why dedicated Block RAM (BRAM) is superior to distributed LUT logic.
Solution
Calculate memory size:
$$2^{12} \times 8\text{ bits} = 4096 \times 8 = 32{,}768\text{ bits} = 4\text{ KB}$$
Implementing a 12-input function with 4-input LUTs requires wide multiplexer trees across hundreds of LUT logic slices.
In contrast, dedicated on-chip Block RAM (BRAM) contains integrated SRAM macros. The table fits into a single BRAM block with synchronous single-cycle access, preserving general logic slices for datapath arithmetic.