Skip to content
Digital logic (gates / K-map / truth table) templates

Physics — XOR from NAND Gates

The classic four-NAND exclusive-OR.

Template previewDigital logic (gates / K-map / truth table)
XOR from NAND gatesABG1G2G3G4YEvaluated: 2 inputs, 1 output, 4 rows — Y = ¬(¬(A · ¬(A · B)) · ¬(¬(A · B) · B)).Y = ¬(¬(A · ¬(A · B)) · ¬(¬(A · B) · B))

Make it your own.

title "XOR from NAND gates"
type gates
input A at (0,0)
input B at (0,4)
gate NAND G1 at (3,2)
gate NAND G2 at (6,0)
gate NAND G3 at (6,4)
gate NAND G4 at (9,2)
output Y at (12,2)
wire A G1
wire B G1
wire A G2
wire G1 G2
wire G1 G3
wire B G3
wire G2 G4
wire G3 G4
wire G4 Y