Readable/Writable Memory with D Flip-Flops

A D flip-flop is a fundamental memory circuit that captures and stores a single bit of data (a 1 or a 0) only when a write signal is triggered. By pairing a compressed 2-wide vertical RS NOR latch with an inverter decoder and a read multiplexer, you can create a complete readable and writable RAM cell. This design is essential for players building redstone computers, calculators, or multi-bit data registers.

Memory CircuitsIntermediateJava Edition
Readable/Writable Memory with D Flip-Flops video tutorial

Video: Building a minecraft computer tutorial pt7: Readable/Writeable Memory with D flip-flops by bennyscube

How to build it

  1. Build the 2-Wide Inverter Decoder

    Start by placing solid blocks in a staggered, 2-wide zigzag pattern to hold your NOT gates (redstone torches). Place redstone torches and dust along this path so that an incoming data signal is inverted and routed toward the memory stage without spilling into adjacent lanes.

  2. Construct the Vertical RS NOR Latch

    At the output of the inverter section, build a vertical RS NOR latch to keep the whole circuit within the 2-wide footprint. Offset the upper and lower feedback blocks slightly rather than stacking them directly on top of each other so both inputs from the decoder can reach the latch.

  3. Connect the Decoder to the Latch

    Run redstone dust from the two outputs of your inverter decoder directly into the set and reset inputs of the vertical RS NOR latch. This allows a single data line to either set or reset the latch depending on whether the input is on or off.

  4. Add the Write-Enable Line

    Notice that the circuit only holds its stored value while the control wire stays powered. Place a redstone repeater facing into the control line to keep it locked by default, and attach your Write-Enable input before it so you can unpower the lock whenever you want to write new data.

  5. Place the Stabilization Repeater

    Bend the feedback loop over the top of the latch and insert an extra redstone repeater along the upper wire. As shown in the video, this repeater prevents a redstone update quirk that would otherwise cause the latch to lose its state.

  6. Attach the Read Multiplexer (MUX)

    At the output end of the D flip-flop, add two consecutive NOT gates (blocks with redstone torches) to double-invert the stored signal. Run a separate Read-Enable line into the intermediate inverter block so the stored bit only passes through to the final output line when the read line is triggered.

  7. Test Read and Write Operations

    Place levers on the Data input, Write-Enable input, and Read-Enable input. Toggle the data lever, pulse the write lever to lock the bit into memory, and then switch on the read lever to verify that your stored 1 or 0 appears at the output.

How it works

This readable and writable memory cell breaks down into four distinct logical stages working in series:

  • Inverter Decoder (3 NOT Gates): An RS NOR latch requires two separate lines (Set and Reset), whereas a D flip-flop takes a single Data (D) input. The front-end NOT gates split and invert the single data input into both its original value and its inverse.
  • Write Enable Control: The control line under and behind the decoder forces the decoder torches off while powered, locking the latch in its current state. When you toggle the Write command, the lock releases and allows the current Data bit (1 or 0) to flow into the latch.
  • Vertical RS NOR Latch: Two cross-coupled redstone torches arranged vertically store the bit indefinitely. One torch being ON forces the other OFF until the decoder forces a state change.
  • Read Multiplexer (MUX): To prevent all memory cells from dumping their data onto a shared computer bus at once, the output passes through a torch inverter controlled by a Read line. Only when the Read signal unlocks the final torch does the stored 1 or 0 pass out of the cell.

Tips & variations

  • 2-Wide Tileable Footprint: Because the inverter chain and the RS NOR latch are built vertically inside a 2-block-wide profile, you can stack multiple cells side-by-side (with a 1-block gap or alternating repeaters) to create an 8-bit or 16-bit register.
  • Don't Skip the Extra Repeater: If your latch forgets its state right after you turn off the write signal, make sure you included the extra repeater on the bent upper wire—without it, redstone update order issues can cause the torch loop to fail.
  • WorldEdit / Structure Blocks: When copying this design to build larger RAM banks, double-check that you include the lowest layer of blocks and dust underneath the write line, and leave the Read MUX separate if you plan to wire a shared bus later.

Frequently asked questions

What is the difference between an RS NOR latch and a D flip-flop?
An RS NOR latch uses two separate inputs to set and reset its stored bit, while a D flip-flop uses a single Data input along with a Write/Clock input that decides exactly when the data should be saved.
Why does the circuit lose its stored bit when I turn the input off?
The internal control wire must stay powered during normal operation to hold the value, and you need the stabilization repeater on the upper loop to prevent a redstone update glitch.
Why do we need a Read line at the end of the D flip-flop?
In a redstone computer, multiple memory cells share the same output bus. The Read multiplexer (MUX) acts as a gatekeeper so the stored bit is only sent to the output when you actively read from that cell.

Components used

More d flip-flop