Skip to content
BetterDL

ROM

Also called: read-only memory, read only memory

Read-only memory: non-volatile memory whose contents are set at manufacture or by programming beforehand, and only read during normal operation.

ROM is memory you only read while the system is running. Its contents are put in beforehand, when the chip is made or programmed, and they survive with the power off: ROM is non-volatile.

Typical uses:

  • the start-up program a computer runs when switched on (the firmware)
  • fixed tables, such as character shapes or the segment patterns for a display
  • any combinational function, used as a lookup table

Inside, a ROM is a decoder plus OR gates. The address goes into an address decoder, which activates one word line. Each data bit is an OR gate, and a stored 1 is simply a connection from a word line to that OR gate. That is exactly the decoder implementation of a set of functions, built in bulk.

That's also why a ROM can implement any n-input, m-output function: wire the inputs to the address lines and store the truth table. It needs 2ⁿ words of m bits. Each extra input doubles the size.

"Read-only" has loosened over time. The ROM family runs from mask ROM (fixed forever) through PROM, EPROM and EEPROM to flash, which can be rewritten in place.

A1A0D2D1D0

Worked examples

Example

Reading the ROM in the diagram

The diagram is a 4 × 3 ROM. D2 = W0 + W2, D1 = W0 + W1, D0 = W1 + W3.

  1. 1.

    Address 0: only W0 is on. W0 reaches D2 and D1. Word 110.

  2. 2.

    Address 1: W1 reaches D1 and D0. Word 011.

  3. 3.

    Address 2: W2 reaches D2 only. Word 100.

  4. 4.

    Address 3: W3 reaches D0 only. Word 001.

  5. 5.

    To change the contents you'd change the connections, which is why it is read-only.

Example

Sizing a ROM for a function

A ROM must convert a 4-bit input into 2 outputs.

  1. 1.

    Inputs set the words: 2⁴ = 16 words.

  2. 2.

    Outputs set the word size: 2 bits.

  3. 3.

    A 16 × 2 ROM, 32 bits in all.

Common mistakes

  • Thinking a ROM is read sequentially. Any address can be read directly; ROM is random-access.

  • Sizing a ROM as inputs × outputs. It needs 2ⁿ words for n inputs.

  • Assuming no ROM can ever change. EEPROM and flash are in the ROM family and can be rewritten.

Practice ROM

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

ROM is taught in Memory.