.PS log_init # Usual defs... qrt=dimen_/4; hlf=dimen_/2; dim=dimen_; C1: Here G1:XOR_gate line from G1.In1 left_ 2*L_unit; dot; line left_ 4*L_unit "$A_0$ " ljust_; line from G1.In2 left_ 4*L_unit; dot; line left_ 2*L_unit "$B_0$ " ljust_ move down_ 6*L_unit; right_ G2:AND_gate with .center at (G1.center,Here) line from G2.In1 left_ 2*L_unit; line to (Here,G1.In1) line from G2.In2 left_ 4*L_unit; line to (Here,G1.In2) P2:G2.Out line from G1.Out right_ 25*L_unit P1:" $C_0$" ljust_ move to G1.Out then up_ 2*L_unit; "Sum" ljust move to G2.Out then up_ 2*L_unit; "Carry" ljust move to C1 then down_ 18*L_unit;right_ G1:XOR_gate line from G1.In1 left_ 6*L_unit "$A_1$ " ljust_; line from G1.In2 left_ 6*L_unit "$B_1$ " ljust_ move to G1.center then down 8*L_unit;right_ G2:AND_gate with .center at (G1.center,Here) line from G2.In1 left_ 2*L_unit line to (Here,G1.In1); dot line from G2.In2 left_ 4*L_unit line to (Here,G1.In2);dot line from G1.Out right_ 10*L_unit G3:XOR_gate with .In2 at Here line from G3.In1 left_ 6*L_unit line to (Here, P2); line to (P2, Here) move to G3.Out then up_ 2*L_unit; right_; "Sum" ljust_ move to G3.Out; line to (P1,Here); " $C_1$" ljust_ move to G3.center then down_ 8*L_unit; right_ G4:AND_gate with .center at (G3.center,Here) line from G4.In1 left_ 2*L_unit line to (Here,G3.In1); dot line from G4.In2 left 4*L_unit line to (Here,G3.In2); dot move to G4.center then down_ 8*L_unit; right_ G5:OR_gate with .center at (G4.center,Here) line from G5.In1 left_ 2*L_unit then up_ 2.5*L_unit line to (G4.Out,Here) then right_ 2*L_unit line to (Here,G4.Out) then to G4.Out line from G5.In2 left_ 6*L_unit line to (Here,G2.Out) then to G2.Out move to G5.Out P3:Here move up_ 2*L_unit; right_; "Carry" ljust_ move to C1 then down_ 42*L_unit;right_ G1:XOR_gate line from G1.In1 left_ 6*L_unit "$A_2$ " ljust_; line from G1.In2 left_ 6*L_unit "$B_2$ " ljust_ move to G1.center then down 8*L_unit;right_ G2:AND_gate with .center at (G1.center,Here) line from G2.In1 left_ 2*L_unit line to (Here,G1.In1); dot line from G2.In2 left_ 4*L_unit line to (Here,G1.In2);dot line from G1.Out right_ 10*L_unit G3:XOR_gate with .In2 at Here line from G3.In1 left_ 4*L_unit then up_ 2.5*L_unit then right_ 14*L_unit line to (Here,P3); line to (P3,Here) line from G3.Out to (P1,G3.Out); " $C_2$" ljust_ move to G3.Out then up_ 2*L_unit; right_; "Sum" ljust_ move to G3.center then down_ 8*L_unit; right_ G4:AND_gate with .center at (G3.center,Here) line from G4.In1 left_ 2*L_unit line to (Here,G3.In1); dot line from G4.In2 left 4*L_unit line to (Here,G3.In2); dot move to G4.center then down_ 8*L_unit; right_ G5:OR_gate with .center at (G4.center,Here) line from G5.In1 left_ 2*L_unit then up_ 2.5*L_unit line to (G4.Out,Here) then right_ 2*L_unit line to (Here,G4.Out) then to G4.Out line from G5.In2 left_ 6*L_unit line to (Here,G2.Out) then to G2.Out line from G5.Out to (P1,G5.Out); right_; " Carry Out" ljust_ move to G5.Out then down_ 6*L_unit "\tiny 3BitAdder" ljust_ .PE