Logic GatesΒΆ

Logic gates can be drawn by importing the logic module:

from schemdraw import logic

Logic gates are shown below. Gates define anchors for out and in1, in2, etc. Buf, Not, and NotNot, and their Schmitt-trigger counterparts, are two-terminal elements that extend leads.

../_images/logic_1_0.svg

Gates with more than 2 inputs can be created using the inputs parameter. With more than 3 inputs, the back of the gate will extend up and down.

logic.Nand(inputs=3)
../_images/logic_2_0.svg../_images/logic_2_1.svg../_images/logic_2_2.svg
logic.Nor(inputs=4)
../_images/logic_3_0.svg../_images/logic_3_1.svg../_images/logic_3_2.svg

Finally, any input can be pre-inverted (active low) using the inputnots keyword with a list of input numbers, starting at 1 to match the anchor names, on which to add an invert bubble.

logic.Nand(inputs=3, inputnots=[1])
../_images/logic_4_0.svg../_images/logic_4_1.svg../_images/logic_4_2.svg