Redstonery
RedstoneryCircuits › Edge-triggered D flip-flop
Memory circuit

Edge-triggered D flip-flop

Sample data on a selected clock event.

11 × 6 footprint1 layer28 blocksTested in 4 rotationsJava Edition 26.2
Open in the simulatorBuild it in the game

Layout

Layer 0 (on the floor)
lever [face=floor, facing=north, powered=false] at x 0, z 0redstone dust at x 1, z 0redstone dust at x 2, z 0redstone dust at x 3, z 0repeater [facing=west, delay=2] at x 4, z 0redstone dust at x 5, z 0redstone dust at x 6, z 0redstone dust at x 7, z 0repeater [facing=west, delay=1] at x 8, z 0redstone dust at x 9, z 0redstone lamp at x 10, z 0lever [face=floor, facing=north, powered=false] at x 0, z 5redstone dust at x 1, z 5redstone dust at x 2, z 5redstone dust at x 3, z 5redstone dust at x 4, z 5redstone dust at x 5, z 5redstone dust at x 6, z 5redstone dust at x 7, z 5redstone dust at x 8, z 5redstone dust at x 4, z 4redstone dust at x 4, z 3redstone dust at x 4, z 2repeater [facing=south, delay=1] at x 4, z 1redstone dust at x 8, z 4stone at x 8, z 3redstone torch (on a wall) [facing=north] at x 8, z 2repeater [facing=south, delay=1] at x 8, z 1
redstone dustredstone torchrepeater or comparatorinputlampsolid blockarrows point where a device sends its output; north is up

How it works

A master and slave repeater latch alternate their lock phases. Data is captured when Clock turns on; changing Data while Clock stays on leaves Q unchanged. Keep Data stable for at least 12 game ticks before Clock, and leave 20 game ticks between clock changes.

  1. A master and slave repeater latch alternate their lock phases, capturing data when Clock turns on.
  2. The stored output then remains stable while data changes with Clock still on. Hold Data steady for at least 12 game ticks before Clock and leave 20 between clock changes.

Inputs and outputs

  • InputData (x 0, y 0, z 0)
  • InputClock (x 0, y 0, z 5)
  • OutputQ (x 9, y 0, z 0)

Blocks you need

19 × redstone dust, 4 × repeater, 2 × lever, 1 × redstone lamp, 1 × stone, 1 × redstone torch (on a wall).

Build it in the game: 28 commands

Relative to where you stand, with x running east and z running south. Paste one line at a time into chat, or into a chain of command blocks. The block art is the game's own; the layout is what the page above shows.

setblock ~0 ~0 ~0 minecraft:lever[face=floor,facing=north,powered=false]
setblock ~1 ~0 ~0 minecraft:redstone_wire
setblock ~2 ~0 ~0 minecraft:redstone_wire
setblock ~3 ~0 ~0 minecraft:redstone_wire
setblock ~4 ~0 ~0 minecraft:repeater[facing=west,delay=2]
setblock ~5 ~0 ~0 minecraft:redstone_wire
setblock ~6 ~0 ~0 minecraft:redstone_wire
setblock ~7 ~0 ~0 minecraft:redstone_wire
setblock ~8 ~0 ~0 minecraft:repeater[facing=west,delay=1]
setblock ~9 ~0 ~0 minecraft:redstone_wire
setblock ~10 ~0 ~0 minecraft:redstone_lamp
setblock ~0 ~0 ~5 minecraft:lever[face=floor,facing=north,powered=false]
setblock ~1 ~0 ~5 minecraft:redstone_wire
setblock ~2 ~0 ~5 minecraft:redstone_wire
setblock ~3 ~0 ~5 minecraft:redstone_wire
setblock ~4 ~0 ~5 minecraft:redstone_wire
setblock ~5 ~0 ~5 minecraft:redstone_wire
setblock ~6 ~0 ~5 minecraft:redstone_wire
setblock ~7 ~0 ~5 minecraft:redstone_wire
setblock ~8 ~0 ~5 minecraft:redstone_wire
setblock ~4 ~0 ~4 minecraft:redstone_wire
setblock ~4 ~0 ~3 minecraft:redstone_wire
setblock ~4 ~0 ~2 minecraft:redstone_wire
setblock ~4 ~0 ~1 minecraft:repeater[facing=south,delay=1]
setblock ~8 ~0 ~4 minecraft:redstone_wire
setblock ~8 ~0 ~3 minecraft:stone
setblock ~8 ~0 ~2 minecraft:redstone_wall_torch[facing=north]
setblock ~8 ~0 ~1 minecraft:repeater[facing=south,delay=1]