Logic Gates¶
Logic gate definitions
- class schemdraw.logic.logic.And(*d, inputs: int = 2, nand: bool = False, inputnots: Optional[Sequence[int]] = None, **kwargs)¶
AND gate
- Parameters
inputs – Number of inputs to gate.
nand – Draw invert bubble on output
inputnots – Input numbers (starting at 1) of inputs that have invert bubble
- Anchors:
out in[X] - for each input
- class schemdraw.logic.logic.Buf(*d, **kwargs)¶
Buffer
- Anchors:
in out
- class schemdraw.logic.logic.Not(*d, **kwargs)¶
Not gate/inverter
- Anchors:
in out
- class schemdraw.logic.logic.NotNot(*d, **kwargs)¶
Double inverter
- Anchors:
in out
- class schemdraw.logic.logic.Or(*d, inputs: int = 2, nor: bool = False, xor: bool = False, inputnots: Optional[Sequence[int]] = None, **kwargs)¶
OR or XOR gate element.
- Parameters
inputs – Number of inputs to gate.
nor – Draw invert bubble on output
xor – Draw as exclusive-or gate
inputnots – Input numbers (starting at 1) of inputs that have invert bubble
- Anchors:
out in[X] - for each input
- class schemdraw.logic.logic.Schmitt(*d, **kwargs)¶
Schmitt Trigger
- Anchors:
in out
- class schemdraw.logic.logic.SchmittAnd(*d, **kwargs)¶
Schmitt Trigger AND
- Anchors:
in1 in2 out
- class schemdraw.logic.logic.SchmittNot(*d, **kwargs)¶
Inverted Schmitt Trigger
- Anchors:
in out
- class schemdraw.logic.logic.Tgate(*d, **kwargs)¶
Transmission gate.
- Anchors:
in out c cbar
- logic_parser.logicparse(gateW: float = 2, gateH: float = 0.75, outlabel: Optional[str] = None) schemdraw.schemdraw.Drawing ¶
Parse a logic string expression and draw the gates in a schemdraw Drawing
Logic expression is defined by string using ‘and’, ‘or’, ‘not’, etc. for example, “a or (b and c)”. Parser recognizes several symbols and names for logic functions: [and, ‘&’, ‘∧’] [or, ‘|’, ‘∨’, ‘+’] [xor, ‘⊕’, ‘⊻’] [not, ‘~’, ‘¬’]
- Parameters
expr – Logic expression
gateH – Height of one gate
gateW – Width of one gate
outlabel – Label for logic output
- Returns
schemdraw.Drawing with logic tree