Logic Gates and Circuits
Logic Gates and Combinational Circuits
Binary inputs and outputs
A logic gate applies a rule to one or more binary inputs and produces a binary output. Each input and output is a bit: either 0 or 1. Gates can be connected so that one gate’s output becomes another gate’s input; this creates a combinational circuit whose final output depends on its inputs.
The four gates covered here are AND, OR, exclusive OR (XOR), and NOT.
The four basic gates
AND
An AND gate outputs 1 only when both inputs are 1. In every other case, it outputs 0.
For inputs A and B:
A=0, B=0 → output 0
A=0, B=1 → output 0
A=1, B=0 → output 0
A=1, B=1 → output 1
Symbolically, its output is A∧B.
OR
An OR gate outputs 1 when at least one input is 1. It outputs 0 only when both inputs are 0. This is an inclusive OR: two inputs of 1 still produce 1.
A=0, B=0 → output 0
A=0, B=1 → output 1
A=1, B=0 → output 1
A=1, B=1 → output 1
Symbolically, its output is A∨B.
Exclusive OR (XOR)
An XOR gate outputs 1 when exactly one of its two inputs is 1.Ifbothinputsarethesame,theoutputis0$.
A=0, B=0 → output 0
A=0, B=1 → output 1
A=1, B=0 → output 1
A=1, B=1 → output 0
Symbolically, its output is A⊕B. XOR resembles OR, except that the input pair (1,1) produces 0 rather than 1.
NOT
A NOT gate, also called an inverter, takes one input and flips it:
Input 0 → output 1
Input 1 → output 0
Symbolically, the output is ¬A.
Key distinction: AND requires both inputs to be 1; OR requires at least one; XOR requires exactly one; NOT reverses a single input.
Reading and drawing gate diagrams
Logic gates are represented by symbols with input wires and an output wire. The descriptions below refer to common ANSI-style symbols; conventions can vary, but the logic performed by each gate stays the same.
AND: Typically drawn with a flat input side and a rounded output side. It has two inputs and one output.
OR: Typically has a curved input side and a pointed, curved output side. It has two inputs and one output.
XOR: Resembles an OR gate with an extra curved line near the input side. It has two inputs and one output.
NOT: Typically drawn as a triangle with a small circle, or “bubble,” at its output. It has one input and one output. The bubble indicates inversion.
Wires carry bits between gates. A gate’s output can feed one or more later gates, allowing gates to be connected in stages.
Combining gates into a circuit
A circuit can be evaluated by working from the input wires toward the final output. Each gate performs its operation on the bits arriving at its inputs, and its output is then passed to the next gate.
Consider a circuit with eight inputs, grouped as four pairs:
The first pair goes into an AND gate.
The second pair goes into an XOR gate.
The third pair goes into an OR gate.
The fourth pair goes into an AND gate.
The outputs of the first AND and the XOR feed another AND gate.
The outputs of the OR and the fourth AND feed another OR gate.
Those two intermediate outputs feed an XOR gate.
The XOR output feeds a NOT gate, producing the final result.
If the inputs are a,b,c,d,e,f,g,h, the circuit can be expressed as
The nested operations show the circuit’s hierarchy: the lower-level gates are evaluated first, and their results are then combined by higher-level gates.
Evaluating example inputs
With all inputs set to 0, each of the four bottom gates outputs 0. The next AND produces 0, and the next OR also produces 0. Their XOR produces 0, which the final NOT flips to 1. Thus, the final output is 1.
With all inputs set to 1, the four bottom gates output 1, 0, 1, and 1, respectively. The intermediate AND produces 0, while the intermediate OR produces 1. Their XOR produces 1, and the final NOT flips it to 0. Thus, the final output is 0.
For another example, use the inputs (1,0,1,0,1,0,1,0):
The bottom outputs are 0 from AND, 1 from XOR, 1 from OR, and 0 from AND.
The intermediate AND receives 0 and 1, so it outputs 0.
The intermediate OR receives 1 and 0, so it outputs 1.
The next XOR receives 0 and 1, so it outputs 1.
The final NOT flips that result to 0.
Using truth tables to evaluate circuits
A truth table lists input combinations and the corresponding outputs. It can show the behavior of an individual gate or of a whole circuit.
For a two-input gate, there are four possible input pairs: (0,0), (0,1), (1,0), and (1,1). A truth table for an eight-input circuit must cover 28=256 possible input combinations.
For the NOT gate, there are only two possible inputs, 0 and 1. Its truth table records that each input is inverted.
A bottom-up method
Truth tables and circuit diagrams both work best when calculations proceed from the inputs toward the final output:
List the circuit’s input bits.
Calculate the outputs of the gates connected directly to those inputs.
Use those outputs as inputs to the next layer of gates.
Continue layer by layer until reaching the final gate.
Record the final output for that input combination.
For the eight-input circuit, the four bottom-gate outputs are calculated first. The two intermediate outputs come next, followed by the XOR and then the NOT.
Keeping intermediate results in separate columns makes the work easier to check. For example, a table might track the outputs of the bottom AND, XOR, OR, and AND gates, followed by the outputs of the intermediate AND and OR, then the final XOR and NOT. This avoids repeatedly recalculating earlier gates.
Truth tables for intermediate gates
A gate’s two-input rule can be reused wherever that gate appears. For example, once the four possible AND input pairs and their outputs are recorded, the same rule applies to every AND gate in the circuit. The same is true for OR and XOR. A separate two-case table describes NOT.
For a small circuit, it can be practical to compute each input combination by hand. As the number of inputs grows, the number of combinations grows exponentially: a circuit with n binary inputs has 2n possible input combinations. Breaking the circuit into layers helps organize the calculation, while a complete truth table records the final output for every possible input.

Ask anything
We've read this whole study set, so questions about it get the best answers.