ROM Tutorial: Store and Read Data in Logisim-evolution
ROM (Read-Only Memory, in the Memory library) holds fixed data that your circuit can read but never changes while running. It is where CPUs keep their programs: the address input selects a row, and the stored value appears on the data output a moment later. If you are heading toward building a CPU, this is the component that becomes its instruction memory.
Step 1 — Place and size a ROM
- Place a ROM from the Memory library.
- In its attributes, set Address Bit Width and Data Bit Width. For example, 8 address bits × 8 data bits gives you 256 bytes — plenty for experiments.
- Wire a Counter (8 bits) into the address input and enable ticking (Simulate → Ticks Enabled). Wire the ROM’s data output into a Hex Digit Display.
Step 2 — Fill the ROM with data
- Select the ROM and click its Contents attribute — a hex editor window opens showing every address and its current value (all zeros at first).
- Click any cell and type a hex value, e.g. put
48 45 4C 4C 4F(“HELLO” in ASCII) at addresses 0–4. - Close the editor and watch the display: as the counter sweeps through the addresses, your bytes appear in order.
- To reuse the data later, use the editor’s file buttons to save the memory image to a file, and load it back the same way next time.
Example: a 7-segment lookup table
A lookup table is the most honest use of a ROM. A Hex Digit Display expects a 7-bit segment pattern, but your counter produces a 4-bit digit — so store the translation in ROM:
- Address width 4 (16 entries), data width 7.
- At address 0 store the segment pattern for “0”, at address 1 the pattern for “1”, and so on through 9.
- Feed any 4-bit digit into the address input; the correct segment pattern comes out, ready to drive a raw 7-segment display.
This is exactly how character generators and instruction decoders work: an input value goes in, a precomputed answer comes out, with no logic gates involved.
ROM vs RAM: which one do you need?
- ROM — contents are fixed at design time (edited by you). Survives in the saved
.circfile. Use for programs, lookup tables, font data. - RAM — also in the Memory library, but the circuit itself can write to it while running. Use for data memory, stacks, frame buffers. Its contents are lost when you close the project unless you save the memory image.
Troubleshooting
- Output always zero: the address width of your counter must match the ROM’s Address Bit Width, otherwise the upper address bits float.
- Edits don’t show: click back on the canvas after closing the hex editor so the component refreshes.
- Weird values after loading a file: the file’s data width must match the ROM’s Data Bit Width.
Next: put this ROM to work as program memory in Single-Cycle MIPS Processor, or learn how CPUs fetch from it in Building a Simple CPU.
