RAM
This is the repaired documentation packaged with Version
2.0.5. The RAM component itself did not change between 2.0.3 and 2.0.5,
but the original 2.0.3 documentation contained
some errors that were repaired in this version.
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
- A on west edge (input, bit width matches Address Bit Width attribute)
- Selects which of the values are currently being accessed by the
circuit.
- D on east edge (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. (A zero on sel with disable this.) 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.
- sel on south edge (input, bit width 1)
- If you have just one RAM module, ignore this input.
If you have multiple RAM modules in parallel, you can use this input
to enable or disable the entire RAM module, based on whether the value is
1 or 0. In other words, when this is 0, no value is emitted on
the D output, and the values in memory will not
change when the clock rises from 0 to 1.
- triangle on south edge (input, bit width 1)
- Clock input: When out is 0, and this input
rises from 0 to 1 (and sel is 1/undefined and
clr is 0), then the value at the currently selected address
changes to whatever value is
at the D pin. As long as the clock input remains 0 or 1,
though, the D value will not be stored into memory.
- out on south edge (input, bit width 1)
- Selects whether the RAM should emit (on D)
the value at the current address (A). This output behavior
is enabled if out is 1 or undefined; if out
is 0, then D behaves as an input for writing a value
once the clock rises from 0 to 1.
- clr on south edge (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.
- Typing hexadecimal digits will change the top address
accordingly.
- Typing the Enter key will scroll down one line.
- Typing the Backspace key will scroll up one line.
- Typing the space bar will scroll down one page (four lines).
To edit a particular value, click the value within the display
rectangle. Logisim will draw a red rectangle around that address.
- Typing hexadecimal digits will change the value at the address
currently being edited.
- Typing the Enter key will move to editing the value just below it in
the display (down one line).
- Typing the Backspace key will move to editing the value at the
previous address.
- Typing the space bar will move to editing the value at the following
address.
Text Tool Behavior
None.
Menu Tool Behavior
The pop-up menu for a RAM tool includes three special options.
- Clear Contents: Resets all values in memory to 0.
- Load Image...: Loads all values in memory according to the values
found in a file, presumably created through the Save Image... menu
option.
- Save Image...: Stores all values in memory into a file designated by
the user.
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