.PS log_init # Usual defs... qrt=dimen_/4; hlf=dimen_/2; dim=dimen_; # Basic RS Flip Flop: G1:NAND_gate line from G1.In1 left_ 6*L_unit; R:Here line from G1.Out right_ 6*L_unit; " $Q$" ljust_ line from G1.In2 left_ 3*L_unit then down_ 3*L_unit J1:Here move to G1.center then down_ 12*L_unit; right_ G2:NAND_gate with .center at Here line from G2.In2 left_ 6*L_unit; S:Here line from G2.Out right_ 6*L_unit; " $\overline{Q}$" ljust_ line from G2.In1 left 3*L_unit then up_ 3*L_unit J2:Here move to G1.Out then right_ 3*L_unit line from J2 to (Here,J1) then to Here; dot move to G2.Out then right_ 3*L_unit line from J1 to (Here,J2) then to Here; dot # Clock circuit... G3:NAND_gate with .Out at R G4:NAND_gate with .Out at S line from G3.In2 left_ 3*L_unit line to (Here,G4.In1) then to G4.In1 move to G3.In2+(-3*L_unit,(G4.In1.y-G3.In2.y)/2); dot; line left_ 9*L_unit; "Clock " ljust_ line from G3.In1 left_ 12*L_unit; "$D$ " ljust_ line from G4.In2 left_ 2*L_unit; right_; G5:NOT_gate with .Out at Here line from G5.In1 left_ 2*L_unit line to (Here,G3.In1);dot move to G2.center then down_ 4*L_unit; "\tiny DLatch" ljust_ .PE