Write and read an 8-bit RAM

Eight bits make one byte. A byte can represent an unsigned value from 0 to 255. A RAM circuit keeps the stored bits after its input switches change, until a write operation changes the stored value.

Data input is not the stored value

Imagine setting eight input bits to 00000111. This pattern represents decimal 7. Setting inputs alone is not necessarily a write: the circuit must also receive the write control required by its design. Once written, the stored byte can remain 7 even if the inputs are changed to 00000101 (decimal 5).

A simple write/read experiment

  1. Open the bundled 8-bit RAM example in LogicForge, or download its .lfg project.
  2. Set a recognizable byte on the data inputs, such as 00000111.
  3. Activate the write control in the example. Check the memory state or output indicators.
  4. Disable writing, then change the input byte. Check that the stored value does not change just because the input changed.
  5. Read the stored value, then perform a second write and compare the result.

Exact enable, clock and output controls depend on the RAM circuit you build. A disabled tri-state output can be Z rather than 0; an unknown signal can be X. Neither is an ordinary binary value.

How memory helps a calculator

A calculator needs to retain an operand while another is entered. The bundled CALC-8 project combines a keypad, adders, 8-bit RAM and displays. Use the half-adder guide to explore the arithmetic building blocks before tracing the larger project.

To distinguish decimal and binary values, write down the bit pattern and the display value together. For example, 00001100 is decimal 12.

What this example models

This is an educational digital circuit simulation. It helps explain stored state and control signals; it does not model the transistor-level implementation or electrical timing of a physical RAM chip.

Download LogicForge for Windows to explore the full circuit, or start with the browser gate simulator.