Electrical Engineering › Section V · Programmable logic and data storage › Topic V.4
Memory expansion, special memories, and the memory hierarchy
Real systems need memories wider and larger than any single chip, organised so that the fastest storage is always close at hand. This topic shows how chips are combined, how FIFOs and stacks order their data, and why computers use a whole hierarchy of memories.
Wider words: word-length expansion
Single chips, described in "Semiconductor memory: RAM, ROM, and flash", rarely match the word width a system needs. To widen the word, place chips side by side. Every chip receives the same address lines and the same control signals, so all of them select the same location together, while each chip drives its own slice of the data bus. Two 64k × 8 chips make a 64k × 16 memory: the first supplies data bits 0 to 7 and the second bits 8 to 15. The number of addresses is unchanged; only the word grows.
More words: capacity expansion
To add locations, stack chips instead. Each chip shares the data bus and the low address lines, and the extra high-order address lines go to a decoder whose outputs drive the chips' active-low chip-enable inputs, \(\overline{CE}\). Only the enabled chip responds; the others hold their data outputs in the high-impedance state, so they never fight over the bus. Doubling the chips needs one more address line, and four times the chips needs two. The decoder is the same circuit met in "Comparators, decoders, encoders, and code converters".
Worked example: 1M × 16 from 256k × 8 chips
Build a 1M × 16 memory from 256k × 8 RAM chips. 1. Width: 16 ÷ 8 = 2 chips side by side per row. 2. Depth: 1M ÷ 256k = 4 rows, so 2 × 4 = 8 chips. 3. Each chip has \(\log_2 262{,}144 = 18\) address lines, A17 to A0, shared by all eight. 4. The full memory needs \(\log_2 1{,}048{,}576 = 20\) lines, so A19 and A18 feed a 2-to-4 decoder that enables one row. 5. Row ranges: A19A18 = 00 covers \(00000_{16}\) to \(3FFFF_{16}\), 01 covers \(40000_{16}\) to \(7FFFF_{16}\), 10 covers \(80000_{16}\) to \(BFFFF_{16}\) and 11 covers \(C0000_{16}\) to \(FFFFF_{16}\). 6. Check: 8 chips × 256k × 8 bits equals 1M × 16 bits, 2 MiB.
Memory modules
Computers buy memory expansion ready-made as modules: small circuit boards carrying several DRAM chips arranged exactly as above. A desktop DIMM (dual in-line memory module) or a laptop SO-DIMM plugs into a socket and presents a 64-bit data path, or 72 bits (80 on DDR5) when extra chips hold error-correcting code (ECC). Current DDR5 DIMMs have 288 pins and split the 64 bits into two independent 32-bit subchannels. For example, eight chips of 16 Gbit each, eight bits wide, make a 64-bit, 16 GB module. Many phones and thin laptops solder the memory directly to the board instead.
FIFO and LIFO memories
Some memories impose an order on their data. In a FIFO (first in, first out) memory, words leave in the order they arrived, like a queue; FIFOs buffer data between systems running at different rates, such as a sensor and a slower link. Early FIFOs were shift-register arrays; most now are RAM with separate read and write pointers. In a LIFO (last in, first out) memory, or stack, the newest word leaves first. Processors keep a stack in RAM with a stack pointer register. If the pointer starts at \(2000_{16}\) and is decremented before each push, three pushes store bytes at \(1FFF_{16}\), \(1FFE_{16}\) and \(1FFD_{16}\), and the first pop returns the byte at \(1FFD_{16}\).
Magnetic and optical storage
A hard disk drive stores bits as magnetised regions on spinning platters, arranged in tracks and sectors and read by heads flying just above the surface; single drives passed 30 TB in 2025. Magnetic tape is slow to reach a given file but cheap per bit, so it remains common for archives. Optical discs store bits as pits and lands, or as marks changed by a laser in recordable kinds, and are read by a laser: a CD holds about 700 MB, a single-layer DVD 4.7 GB and a single-layer Blu-ray disc 25 GB. Older CCD and magneto-optical memories have dropped out of use.
The memory hierarchy
No single technology is fast, large and cheap at once: the faster a memory, the more it costs per bit. Systems therefore stack several levels. At the top sit processor registers and SRAM caches (L1, L2, L3), with access times around a nanosecond or less up to a few tens of nanoseconds; below them DRAM main memory at tens of nanoseconds; then solid-state drives, hard disks and archives, slower but far larger. The hierarchy works because programs show locality: they reuse recent data (temporal locality) and use data near recent data (spatial locality). A hit means the wanted data is in the faster level; a miss means fetching it from below.
Worked example: average access time
A processor's cache answers in 1.0 ns, and main memory needs a further 60 ns on a miss, so a miss costs \(1.0 + 60 = 61\) ns. The hit rate is 95%. 1. Model:
2. Substitute: \(t_{avg} = 0.95(1.0) + 0.05(61) = 0.95 + 3.05\). 3. Result: \(t_{avg} = 4.0\) ns, close to the cache speed even though most of the data lives in slow DRAM. 4. Sensitivity: raising the hit rate to 98% gives \(0.98 + 0.02(61) = 2.2\) ns. 5. Check: the answer must lie between 1.0 ns, every access a hit, and 61 ns, every access a miss.
Cloud storage
Cloud storage extends the hierarchy beyond the computer. Data is kept on networks of servers, computers that provide storage or other services, housed in data centres and reached over the Internet. Providers keep copies on several servers or sites, so one failure need not lose data, and capacity grows on demand, often paid for by use. The costs are reliance on a network connection, access times of milliseconds or more, and questions of privacy and control.
Testing memories
Memories are tested by comparing what they hold with what they should hold. A ROM can be checked with a checksum: add every stored word, keeping only the low bits, for example modulo 256 for bytes, and compare the result with a checksum stored in a reserved location or with a known-good value. A RAM is tested by writing patterns and reading them back. A checkerboard pattern of alternating 1s and 0s, then its inverse, makes every cell differ from its neighbours, which exposes cells that are stuck or shorted to adjacent cells. Address-line faults appear as data turning up at the wrong location.
Common mistakes to avoid
First, mixing up the two expansions: side-by-side chips widen the word, while stacked chips add locations and need a decoder. Second, forgetting that every stacked chip but the enabled one must hold its outputs in the high-impedance state. Third, counting address lines wrongly: four times the locations needs two extra lines, not four. Fourth, calling a FIFO a stack: a stack returns the newest word first. Fifth, using the cache time alone as the average access time: misses add the main-memory time.
Key takeaways
Word-length expansion puts chips side by side on shared address and control lines, each supplying part of the data bus. Capacity expansion stacks chips on a shared data bus, with a decoder on the extra address lines driving the chip enables. Modules such as DIMMs package these arrangements. FIFOs return data in arrival order and stacks return the newest first. Disks, tape and optical discs store data magnetically or optically. The memory hierarchy, from registers and caches to DRAM, drives and the cloud, exploits locality so that \(t_{avg} = h\,t_c + (1 - h)(t_c + t_m)\) stays near the fastest level's time. ROM checksums and RAM checkerboard patterns test memories.
Flashcards
Flashcard
Chips side by side on shared address lines, each driving part of the data bus
Test your understanding
Question 1 of 5
How many 64k × 4 RAM chips are needed to build a 256k × 8 memory?
Question 2 of 5
Four 128k × 8 chips form a 512k × 8 memory, with A18 and A17 driving a 2-to-4 decoder. Which address range belongs to the chip enabled when A18A17 = 10?
Question 3 of 5
A cache answers in 2 ns and main memory adds 50 ns on a miss. With a 90% hit rate, what is the average access time?
Question 4 of 5
A processor pushes the values 5, 9 and 3 onto its stack, in that order. Which value does the first pop return?
Question 5 of 5
Why does a memory hierarchy give an average access time close to the fastest level's?
