RAM

Library: Memory
Introduced: 2.0 Beta 1
Appearance:

Behavior

The RAM component, easily the most complex component in Logisim's built-in libraries, stores up to 4,096 values (specified in the Address Bit Width attribute), each of which can include up to to 32 bits (specified in the Data Bit Width attribute). The circuit can load and store values in RAM. Also, the user can modify individual values interactively via the Poke Tool, or the user can modify the entire contents via the Menu Tool.

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

Pins

West edge, labeled A (input, bit width matches Address Bit Width attribute)
Selects which of the values are currently being accessed by the circuit.
East edge, labeled D (input/output, bit width matches Data Bit Width attribute)
If out is 1 or undefined (i.e, floating), then the RAM outputs the value at the currently selected address at the D pin (unless sel is 0). If out is 0, then the D pin is an input, as a value that will be placed at the currently selected address once the clock rises from 0 to 1.
South edge, labeled sel (input, bit width 1)
If this is 1 or undefined, then the RAM is enabled. But if it is 0, then the RAM is effectively disabled - the D output is undefined, and the values in memory will not change when the clock rises from 0 to 1.
South edge, indicated with a triangle (input, bit width 1)
Clock input: When this rises from 0 to 1, and when sel is 0 and out is 1 (and clr is 0), then the value at the currently selected address changes to whatever value is at the D pin. As long as it remains 0 or 1, though, the D value will not be loaded into memory.
South edge, labeled out (input, bit width 1)
Selects whether the RAM is currently being read (if out is 0 or undefined) or being written (if out is 1). Note that if it is 1, the RAM will only write to memory when the clock rises from 0 to 1.
South edge, labeled clr (input, bit width 1)
When this is 1, and sel is 1 or undefined, all values in memory are pinned to 0, no matter what the other inputs are.

Attributes

Address Bit Width
The bit width of the address bits. The number of values stored in RAM is 2addrBitWidth.
Data Bit Width
The bit width of each individual value in memory.

Poke Tool Behavior

There are two different modes in which you can manipulate RAM: You can edit the address displayed, and you can edit an individual value.

To edit the address displayed, click outside the display rectangle. Logisim will draw a red rectangle around the top address.

To edit a particular value, click the value within the display rectangle. Logisim will draw a red rectangle around that address.

Text Tool Behavior

None.

Menu Tool Behavior

The pop-up menu for a RAM tool includes three special options.

The file format used for image files is quite simple; the intention is that a user can write a program, such as an assembler, that generates memory images that can then be loaded into the RAM. As an example of this file format, if we had a 256-byte memory whose first five bytes were 2, 3, 0, 20, and -1, and all subsequent values were 0, then the image would be the following text file.

v2.0 raw
02
03
00
14
ff
The first line identifies the file format used (currently, there is only one file format recognized). Subsequent lines list the values in little-endian hexadecimal. Logisim will assume that any values unlisted in the file are zero.

Back to Library Reference