REDSTONEPEDIA › Circuits › Logic gates
Logic gate
A same as B · 17 blocks
It has two inputs, A and B. The output is on when A and B are the same: both on or both off.
reacts in 4 ticks (0.2 s) · made of comparator, redstone torch, redstone wire · fits in 5×4×2
Try it
Use the A and B buttons under the view to drive the inputs: the box marked OUT turns red while the output is on. Press play under the view to watch a demo on a loop; touch any other control to take over.
How this design does it: XNOR gate, 17 blocks, 4 ticks: the 15-block XOR (a dust on each input block, two subtract comparators in a square with them) whose two signals meet on a stone instead of the output; a wall torch on that stone is the output, lit unless exactly one input is on.
Build it
Download .litematic Download the design as text
The .litematic opens in Litematica (Minecraft 26.3): every block of the design in one region. The text file is the same build written as plain text, block by block.
Blocks used: comparator redstone torch redstone wire stone
Details: how it works, measurements and properties
In depth
A logic gate: the output depends only on the inputs right now. XNOR: the output is on while A and B are the same (both on or both off).
| A | B | OUT |
|---|---|---|
| off | off | on |
| off | on | off |
| on | off | off |
| on | on | on |
The output settles 4 ticks (0.2 s) after an input changes.
How to try it
Press play under the view to watch the demo on a loop (the badge reads demo with the step it is on; the same sequence is drawn as a timing diagram below). Touch any control to stop it and try the circuit yourself.
To try it: tap the A button of the bar (or the cell tagged A) to turn that input on or off (it powers the cell with a redstone block); tap the B button of the bar (or the cell tagged B) to turn that input on or off (it powers the cell with a redstone block).
Inputs are tagged in lime; the output is tagged OUT: the orange glass marker next to it glows while the output is on (the output strip by the demo badge shows its last 40 game ticks, 2 seconds). Drag to look around, pinch or scroll to zoom, step one game tick at a time with the step button.
Inputs and output over time
The inputs follow this schedule (the 3D view's demo plays the same). Lime: an input is on; orange: the output is on (taller = a stronger signal, 1 to 15). Time runs left to right in game ticks (20 ticks = 1 s).
Swipe the diagram sideways: the whole sequence lasts 281 ticks (14.05 s).
Step by step (13 lines)
00 (rest): output 1 -> 01: output 0 after 4 ticks (0.2 s) -> 00: output 1 after 4 ticks (0.2 s) -> 10: output 0 after 4 ticks (0.2 s) -> 00: output 1 after 4 ticks (0.2 s) -> 11: output 1 -> 01: output 0 after 4 ticks (0.2 s) -> 10: output 0 -> 01: output 0 -> 11: output 1 after 4 ticks (0.2 s) -> 10: output 0 after 4 ticks (0.2 s) -> 11: output 1 after 4 ticks (0.2 s) -> 00: output 1
Measurements
| metric | value | what it means |
|---|---|---|
| function | xnor | the logic function the truth table names |
| latency | 4 ticks (0.2 s) | the worst time from an input change to the output's change |
Notes from its designer
XNOR gate, 17 blocks, 4 ticks: the 15-block XOR (a dust on each input block, two subtract comparators in a square with them) whose two signals meet on a stone instead of the output; a wall torch on that stone is the output, lit unless exactly one input is on.
Properties
| Study | Logic gates |
|---|---|
| Kind | Logic gate |
| Blocks placed | 17 (not counting the input levers or buttons the view adds) |
| Box | 5×4×2 (40 blocks of space) |
| Made of (the blocks that change state) | comparator, redstone torch, redstone wire |
| Inputs / outputs | A (repeater), B (repeater) / OUT |
| Design file | gate-xnor |
The design file
Design file (26 lines)
# Logic gate: A same as B · 17 blocks # https://vjeux.github.io/redstonepedia/circuits/gates/gate-xnor.html name: gate-xnor circuit: gate xnor port input.a: 0 0 0 port input.b: 1 0 1 port output: 3 1 0 origin: -1 0 0 palette: S minecraft:stone C minecraft:comparator[facing=west,mode=subtract,powered=false] K minecraft:comparator[facing=east,mode=subtract,powered=false] T minecraft:redstone_wall_torch[facing=east,lit=true] d minecraft:redstone_wire[east=side,north=side,power=0,south=side,west=side] layer 0: ..S.. .S... layer 1: SdCST SKd.. layer 2: dSSd. d.... layer 3: .dd.. .....