Engineering — Logic: full subtractor
Difference and borrow for three input bits.
Make it your own.
title "Full subtractor"
type gates
input A at (0,0)
input B at (0,2)
input Bin at (0,5)
gate XOR G1 at (3,1)
gate XOR G2 at (6,2)
gate NOT G3 at (3,3)
gate AND G4 at (6,3.5)
gate NOT G5 at (6,5)
gate AND G6 at (9,5.5)
gate OR G7 at (12,4.5)
output D at (9,2)
output Bout at (15,4.5)
wire A G1
wire B G1
wire G1 G2
wire Bin G2
wire G2 D
wire A G3
wire G3 G4
wire B G4
wire G1 G5
wire G5 G6
wire Bin G6
wire G4 G7
wire G6 G7
wire G7 Bout