Logic circuits
| English | Chinese | Pinyin |
|---|---|---|
| logic circuit | 逻辑电路 | luó jí diàn lù |
| Boolean expression | 布尔表达式 | bù ěr biǎo dá shì |
| truth table | 真值表 | zhēn zhí biǎo |
| sum of products | 积之和 | jī zhī hé |
| problem statement | 问题陈述 | wèn tí chén shù |
Wiring gates into circuits
- A logic circuit 逻辑电路 is a network of gates that carries out a Boolean expression 布尔表达式.
- You must move freely between four forms: problem → expression → circuit → truth table 真值表.
- Let's practise each direction.
Expression → circuit
- Draw one gate per operator and wire them up.
- For $X = (A \cdot B) + \overline{C}$: an AND on $A, B$; a NOT on $C$; an OR combining the two results.

Half adder
Wire XOR and AND to the same two inputs: XOR gives the sum bit, AND gives the carry. Click A and B.
Logic circuits
gates combine into circuits
Each gate has a fixed rule; chaining them builds every circuit — start with one gate.
For $X = (A \cdot B) + \overline{C}$ with $A=1, B=1, C=1$, what is $X$?
$A \cdot B = 1$, and $\overline{C} = 0$. $X = 1 + 0 = 1$.
Circuit → truth table
- For $n$ inputs there are $2^n$ rows — list every input combination.
- For each row, work out each gate's output in turn until you reach the final output.
- e.g. 2 inputs → 4 rows; 3 inputs → 8 rows.
How many rows does a truth table have for a circuit with 3 inputs?
$2^n$ rows; for 3 inputs, $2^3 = 8$.
How many rows for 4 inputs?
$2^4 = 16$ rows.
Truth table → expression (sum of products 积之和)
- For each row that outputs 1, write an AND of the inputs (put NOT on any input that is 0 in that row).
- OR those terms together.
- Example: a table that is 1 only on $(A{=}0,B{=}1)$ and $(A{=}1,B{=}0)$ gives $\overline{A}B + A\overline{B}$ — which is $A \text{ XOR } B$.

Gates wired together to carry out a Boolean expression
In the sum-of-products method, for each row whose output is 1 you write:
Each 1-row becomes an AND term (NOT the 0 inputs); you then OR all those terms together.
In sum-of-products, you OR together one AND-term for every row whose output is 1.
Each output-1 row becomes an AND term (NOT-ing the 0 inputs); ORing those terms gives an expression that is 1 on exactly those rows.
From a problem statement 问题陈述
- Turn the English into Boolean first:
- "A and B" → $A \cdot B$ · "A or B (or both)" → $A + B$
- "exactly one of A and B" → $A \text{ XOR } B$
- "neither A nor B" → $A \text{ NOR } B$ · "not both" → $A \text{ NAND } B$
Match each English phrase to the single gate that implements it.
both = AND, differ = XOR, neither = NOR, not-both = NAND.
You've got it
- a circuit = one gate per operator, wired up (expression ↔ circuit)
- a truth table has $2^n$ rows for $n$ inputs
- sum of products: OR together an AND-term for each output-1 row (NOT the 0 inputs)
- problem → Boolean: exactly one = XOR, neither = NOR, not both = NAND