Physics — Logic: half subtractor
Difference = A XOR B, borrow = (NOT A) AND B.
Make it your own.
title "Half subtractor"
type gates
input A at (0,0)
input B at (0,2)
gate XOR G1 at (3,0.5)
gate NOT G2 at (3,3)
gate AND G3 at (6,2.5)
output D at (6,0.5)
output Bout at (9,2.5)
wire A G1
wire B G1
wire A G2
wire G2 G3
wire B G3
wire G1 D
wire G3 Bout