ROM

Library: Memory
Introduced: 2.1.0
Appearance:
Classic Logisim:
ANSI:

Behavior

The ROM component stores up to 16,777,216 values (specified in the Address Bit Width property), each of which can include up to to 32 bits (specified in the Data Bit Width property). It behaves similarly to a RAM with the 'Non-Volatile' property set, but with a greatly simplified interface: a circuit can access the current values in ROM, but it cannot change them, so there is no clock, no control inputs, and there is only one output-only data bus. The user can modify individual values interactively via the Poke Tool, or the user can edit, export, or import the contents via the Menu Tool.

The ROM component's contents are stored as a property of the component. This allows the ROM contents to be set before placing the component into the circuit. Multiple ROM components can be kept in the toolbar, each configured with different contents. The contents are non-volatile, and persist across simulation resets or when Logisim exits.

Current values are displayed in the component. Addresses are displayed in hex to the left of the display area. Inside the display area, each value is listed in hex. The value at the currently selected address will be displayed in inverse text (white on dark gray).

Single, Dual, and Quad Lines Modes

Logisim ROM has a 'Line Size' property that controls how many locations ("lines") of memory are accessed at a time. Setting 'Line Size' to 'Single' is the simplest case: at most one location is accessed at a time, and there is one output labeled D. When 'Line Size' is set to 'Dual', however, the ROM component reads two locations simultaneously, and there are two outputs, labeled D and 1. In 'Quad' mode, ROM will read four locations, with four databuses labeled D, 1, 2, and 3. The addresses accessed are all consective: for 'Dual' line mode, ROM will access addresses A and A+1; for 'Quad' line mode, ROM will access addresses A, A+1, A+2, and A+3.

Address Alignment

In 'Dual' and 'Quad' line modes, the selected address must be aligned to a multiple of 2 or 4, respectively. There is no support for mis-aligned accesses. This means the lowest bit or lowest two bits of the address must always be zero in those modes. If the address is mis-aligned the ROM will output all error (E) values instead of loading data from the ROM contents.

The decision to omit support in Logisim for mis-aligned addresses is deliberate. Support for mis-aligned addresses is not trivial in many actual scenarios: a memory chip may require multiple row accesses, for example, in order to perform a mis-aligned read. In addition, FPGA synthesis is substantially simpler when mis-aligned addresses are not permitted.

Importing and Exporting Memory Contents

The contents of memory can be imported from an external data file, or exported to an external file. A variety of file formats are supported: see Memory Import/Export Format in the User's Guide for details.

Pins (assuming "Classic Logisim" appearance)

A on west edge (input, bit width matches Address Bit Width property)
Selects which of the values is currently being accessed by the circuit.
D on east edge (input/output, bit width matches Data Bit Width property)
Outputs the value at the currently selected address.

Properties

When the component is selected or being added, the digits '0' through '9' alter its Address Bit Width property and Alt-0 through Alt-9 alter its Data Bit Width property.

Address Bit Width
The bit width of the address bits. The number of values stored in ROM is 2addrBitWidth.
Data Bit Width
The bit width of each individual value in memory.
Line Size
Allows for Single, Dual, or Quad line mode.
Contents
Stores the contents of memory.
Label
The text within the label associated with the register.
Label Font
The font with which to render the label.
Appearance
Selects between the "Classic Logisim" appearance style, which is somewhat more compact, or "ANSI" style, which is more conventional but larger.

Poke Tool Behavior

Clicking the ROM component brings keyboard and mouse focus to the ROM (indicated by a red rectangle), allowing for the contents to be viewed or edited. Because Poke Tool editing all takes place within a very small space, the interface for this is severely but necessarily constrained. For all but the simplest editing, it is more convenient to right-click the ROM and select "Edit Contents..." to bring up the integrated hex editor.

The Poke Tool has two modes of operation: You can edit the address displayed, and you can edit an individual value at some memory location.

Editing Addresses: Use the Poke Tool and click anywhere within the memory component but outside the gray box holding the memory contents. Logisim will draw a red rectangle around the address at the upper left corner. From here:

Editing Contents: Use the Poke Tool and click anywhere within the memory component within the gray box holding the memory contents. Logisim will draw a red rectangle around the memory cell currently being edited. From here:

FPGA Synthesis

Supports VHDL and Verilog synthesis. With Verilog, only 'Single' line mode is supported.

Up to Library Reference