Memory Expansion

The memory you need is rarely the memory chip you can buy. A design may need 8K words of 16 bits, while the available chips hold 2K words of 8 bits. Memory expansion solves this by combining several small chips into one larger memory. There are only two basic moves, making the words wider and adding more words, and real designs usually need both.

Learning objectives

By the end of this lesson you will be able to:

  • Calculate how many chips are needed to build a larger memory.
  • Expand word width by connecting chips in parallel.
  • Expand the number of words using an address decoder and chip selects.
  • Work out the address range that each chip responds to.
  • Combine both methods in a single design.

The two kinds of expansion

Expansion Goal How the chips are connected
Width (word length) More bits per word Same address and control lines to all chips, each chip supplies different data bits
Depth (number of words) More words Same low address lines and data lines to all chips, a decoder drives the chip selects from the high address lines

When both are needed, the total number of chips is:

Chips = (total words / chip words) x (total width / chip width)

You should confirm that the total address range is a power of two, so the address bits divide cleanly into "inside the chip" and "which chip".

Width expansion

To build a 1K x 16 memory from 1K x 4 chips, the number of words is already right, but each word is too narrow.

  • Chips needed = 16 / 4 = 4.
  • All four chips receive the same 10 address lines and the same chip select, write enable and output enable.
  • Chip 1 supplies data bits D3 to D0, chip 2 supplies D7 to D4, chip 3 supplies D11 to D8, and chip 4 supplies D15 to D12.

Every access touches all four chips at the same time, and together they present one 16-bit word.

Depth expansion

To add words, the extra address bits select which chip is active. Only one chip responds to any address, so the chips can safely share the data bus.

The recipe is:

  1. Find the number of chips: total words / chip words.
  2. The low address lines (enough to address one chip) go to every chip.
  3. The remaining high address lines go to a decoder.
  4. Each decoder output drives the chip select of one chip.
  5. Write the address range of each chip from the decoder value.

Worked example 1: 4K x 8 from 1K x 8 chips

  • Chips needed = 4,096 / 1,024 = 4.
  • Address lines for 4K words = 12 (A11 to A0).
  • Each chip needs 10 lines (A9 to A0), so these go to every chip.
  • The remaining 2 lines, A11 and A10, go to a 2-to-4 decoder whose outputs select the chips.
A11 A10 Chip selected Address range (hex)
00 Chip 0 000 to 3FF
01 Chip 1 400 to 7FF
10 Chip 2 800 to BFF
11 Chip 3 C00 to FFF

The data lines D7 to D0 of all four chips are connected together. The decoder guarantees that only one chip drives them at a time. For example, address 5A3 in hex is 0101 1010 0011 in binary, so A11 A10 = 01 and chip 1 is selected. The chip itself receives the low ten bits, 01 1010 0011. You can check such hex and binary conversions with the number converter.

Worked example 2: 1K x 16 from 1K x 4 chips

This is pure width expansion, as described above.

  • Chips needed = (1,024 / 1,024) x (16 / 4) = 1 x 4 = 4.
  • No decoder is needed, since all chips are always selected together.
  • Address lines: 10, shared by all four chips.
  • Data lines: 4 per chip, 16 in total.

Compare this with example 1: the chip count is the same, but the wiring is very different. Width expansion shares address and splits data, and depth expansion shares data and splits chip selects.

Worked example 3: 8K x 16 from 2K x 8 chips

This design needs both kinds of expansion.

  • Depth: 8K / 2K = 4 rows of chips.
  • Width: 16 / 8 = 2 chips per row.
  • Total chips = 4 x 2 = 8.
  • Address lines for 8K words = 13 (A12 to A0).
  • Each chip holds 2K words, so it needs 11 lines (A10 to A0).
  • The remaining 2 lines, A12 and A11, feed a 2-to-4 decoder.

Each decoder output enables one row of two chips. Within a row, one chip supplies D7 to D0 and the other supplies D15 to D8.

A12 A11 Row selected Address range (hex)
00 Row 0 0000 to 07FF
01 Row 1 0800 to 0FFF
10 Row 2 1000 to 17FF
11 Row 3 1800 to 1FFF

The last address, 1FFF, is 1 1111 1111 1111 in binary, which is 13 bits all ones, as expected for 8K words.

Using enable inputs

Many decoders have enable inputs. In a larger system, the decoder is often enabled only when a higher-level address block is active. For example, a processor with 16 address lines may place the 8K memory at the bottom of its address space, using A15 to A13 to decide whether the memory is selected at all. Each additional layer of decoding divides the address space again. This is called address decoding, and the same principle appears in every computer memory map.

Common mistakes

  • Mixing up width and depth. If chips are meant to add words, they must not all be enabled at once, or they would drive the bus together.
  • Overlapping address ranges. If two chips respond to the same address, they both drive the data bus and corrupt the data. Check that the ranges are separate.
  • Connecting the wrong address bits to the decoder. The decoder takes the highest address lines. The low lines go to the chips.
  • Leaving gaps or aliases. If an address bit is not decoded, the memory appears at several places in the address space.
  • Forgetting that K is 1,024. 4K is 4,096 words, not 4,000.

Practice problems

Problem 1. Build a 16K x 8 memory from 4K x 8 chips. How many chips, which decoder, and what is the range of chip 2?

Answer: 16K / 4K = 4 chips. There are 14 address lines (A13 to A0). A11 to A0 go to every chip, and A13 and A12 go to a 2-to-4 decoder. Chip 2 (A13 A12 = 10) covers 2000 to 2FFF in hex, which is 8,192 to 12,287 in decimal.

Problem 2. How many 1K x 8 chips are needed for a 2K x 32 memory?

Answer: Depth is 2K / 1K = 2 and width is 32 / 8 = 4, so 2 x 4 = 8 chips.

Problem 3. In Example 3, which row responds to the address 1234 hex?

Answer: 1234 hex is 1 0010 0011 0100 in binary, so A12 A11 = 10 and row 2 responds. This matches its range, 1000 to 17FF.

Problem 4. A 64K x 8 memory is built from 16K x 4 chips. How many chips, and how many address lines go to the decoder?

Answer: Depth is 64K / 16K = 4, and width is 8 / 4 = 2, so 4 x 2 = 8 chips. The memory has 16 address lines, 14 of them go to every chip, and 2 go to the decoder.

Frequently asked questions

Why not just buy a bigger chip? Sometimes you can. Expansion is used when the exact size is not available, when cost is lower with smaller parts, or when you are practising how real address decoding works.

What happens if two chips are enabled at the same time? Both try to drive the data bus. If they hold different bits, the result is a bus conflict that corrupts the data and can damage the outputs.

Does the same idea apply inside an FPGA? Yes. FPGA tools combine several small block RAMs into a wider or deeper memory automatically, using the same width and depth rules.

Course complete: you have finished the Digital System Design course. Return to the Learn section to revisit any course, or test a design idea with the truth table generator.