Half adders
Add 1 and 1 in binary and the answer already needs two digits, 10. An event counter starts there: two event channels each supply one bit, A and B, and a half adder adds them. Its outputs are S (sum) and K (carry).
Follow each input row through both gates: the XOR gate gives S and the AND gate gives K. In the table, the coloured 1s are the rows where each output is on.
| A | B | S | K |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Read the outputs as a two-bit total
1 + 1 needs two binary digits. For A = B = 1, the total is 2 = 10₂: K = 1 and S = 0. Read the two outputs as KS, not SK.
1 A = 1 and B = 0. Give S and K.
2 Which input row gives K = 1? Why is S 0 in that row?
3 Why can a half adder not add a carry from the column before?
- 1S = 1, K = 0: 1 + 0 = 1
- 2A = 1, B = 1: 1 + 1 = 2 = 10₂, so the 1 goes to K and S = 0
- 3it has only two inputs, A and B: there is no carry-in input
Full adders
Longer numbers need carrying, as in column addition. A full adder accepts A, B and a carry-in C from the lower binary column. Two half adders and an OR gate produce its sum and carry-out.
Follow A and B into the first half adder, then its P on into the second with C; both carries meet at the OR gate. The table records P, K1 and K2 on the way to S and K.
| A | B | C | P | K1 | K2 | S | K |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 |
Use the intermediate outputs to check each row
- 1First half adder: P = A XOR B and K1 = A AND B.
- 2Second half adder: S = P XOR C and K2 = P AND C.
- 3Carry-out: K = K1 OR K2. On every row, A + B + C = 2K + S.
With A = B = C = 1: P = 0, K1 = 1, K2 = 0, so KS = 11₂ = 3. In a multi-bit adder, each carry-out feeds the next higher column’s carry-in.
Write S as a sum-of-products
One AND term for each row where S = 1, written in that row’s colour. Then join the terms with OR.
A sum-of-products uses one AND term for each output-1 row. For the sum, rows 001, 010, 100 and 111 give:
1 A = 1, B = 0, C = 1. Find P, K1, K2, S and K.
2 Write the sum-of-products term for the row A = 0, B = 1, C = 0.
3 In row 011, which carry, K1 or K2, makes K = 1?
- 1P = 1, K1 = 0, K2 = 1, S = 0, K = 1: 1 + 0 + 1 = 2 = 10₂
- 2(NOT A)B(NOT C)
- 3K2: P = 1 and C = 1, so K2 = 1 (K1 = 0)
Combinational and sequential logic
An adder forgets an event the moment its input pulse ends, but a counter must remember it. A combinational circuit calculates from its current inputs. A sequential circuit also depends on its previous state. The event counter needs both.
Two parts of the counter, one question for each: does the same input always give the same result?
| Part of the counter | What determines its result? | Same input, same result? |
|---|---|---|
| Adder | Current A, B and carry-in. | Yes, after signals settle. |
| Stored count bit Q | Current controls and the bit already stored. | No: a hold control preserves either 0 or 1. |
What happens when the pulse ends
Read each line in time order: before, event on, event off. The adder output follows the pulse; the stored Q keeps it.
| Time | Set control | Q before | Q after |
|---|---|---|---|
| Before event | 0 | 0 | 0 |
| Event asserted | 1 | 0 | 1 |
| Event removed | 0 | 1 | 1 |
The adder’s output changes back when its input pulse disappears. Storage keeps a bit showing that the event occurred. Later controls can reset or change it.
How feedback keeps a stored bit
- 1Part of the output feeds back into the storage circuit’s input.
- 2When the controls request hold, the feedback keeps the existing stable state.
- 3A flip-flop stores one binary digit.
1 Is a half adder combinational or sequential? Give the reason.
2 After the events in the diagram, the reset control is set to 1 for one step. What is Q now?
3 What part of a storage circuit lets it keep a bit after the input pulse has gone?
- 1combinational: its outputs depend only on the current A and B
- 20: reset makes the stored bit 0
- 3feedback: part of the output is fed back to the input
SR latches
The simplest memory is two gates that feed each other. This SR latch uses two cross-coupled NOR gates. Its controls are active high: S = 1 sets Q, and R = 1 resets Q.
Each NOR output feeds back into the other gate: that loop holds Q. The table gives what each pair of S and R does to it.
| S | R | Next Q | Operation |
|---|---|---|---|
| 0 | 0 | Previous Q | Hold |
| 1 | 0 | 1 | Set |
| 0 | 1 | 0 | Reset |
| 1 | 1 | Invalid | Both outputs forced to 0 |
Set, then hold: follow the feedback
Follow the latch through time
One row for each moment. Read S and R, then use the table above to find Q after.
| S | R | Q before | Q after | What happens | |
|---|---|---|---|---|---|
| t1 | 1 | 0 | 0 | 1 | S = 1: set, Q becomes 1 |
| S = 1: set, Q becomes 1 | |||||
| t2 | 0 | 0 | 1 | 1 | S = R = 0: hold; feedback keeps Q = 1 |
| S = R = 0: hold; feedback keeps Q = 1 | |||||
| t3 | 0 | 1 | 1 | 0 | R = 1: reset, Q becomes 0 |
| R = 1: reset, Q becomes 0 | |||||
| t4 | 0 | 0 | 0 | 0 | S = R = 0: hold; feedback keeps Q = 0 |
| S = R = 0: hold; feedback keeps Q = 0 | |||||
| t5 | 1 | 0 | 0 | 1 | S = 1: set, Q becomes 1 |
| S = 1: set, Q becomes 1 | |||||
- With S = R = 1, Q and Q̅ are both 0: they are no longer complements.
- Releasing both controls together can leave the stored state unpredictable. Avoid this combination.
1 Q = 1. Then S = 0 and R = 1. What is Q after?
2 Q = 0 and S = R = 0. What happens to Q?
3 Why is S = R = 1 not used on a NOR SR latch?
- 10: reset
- 2it holds: Q stays 0
- 3Q and Q̅ are both 0, so they are not complements, and releasing both together can leave an unpredictable state
JK flip-flops
A counter needs a bit that changes only when the clock ticks, and can flip on its own. This JK flip-flop updates on the rising clock edge (0 → 1); between rising edges, Q holds its state. J and K are read together with previous Q.
| J | K | Next Q at rising edge |
|---|---|---|
| 0 | 0 | Previous Q: hold |
| 0 | 1 | 0: reset |
| 1 | 0 | 1: set |
| 1 | 1 | NOT previous Q: toggle |
Toggle means a change at each active edge
With J = K = 1, Q changes at every rising edge (↑) and holds in between.
The same rules, one clock event at a time. Read J and K only at a rising edge; every other event leaves Q alone.
| J | K | Q before | Q after | What decided it | |
|---|---|---|---|---|---|
| 0 → 1 | 1 | 1 | 0 | 1 | rising edge, J = 1, K = 1: toggle |
| rising edge, J = 1, K = 1: toggle | |||||
| stays 1 | 1 | 1 | 1 | 1 | no edge: Q holds |
| no edge: Q holds | |||||
| 1 → 0 | 1 | 1 | 1 | 1 | falling edge is not active: Q holds |
| falling edge is not active: Q holds | |||||
| 0 → 1 | 1 | 1 | 1 | 0 | rising edge, J = 1, K = 1: toggle |
| rising edge, J = 1, K = 1: toggle | |||||
| 0 → 1 | 1 | 0 | 0 | 1 | rising edge, J = 1, K = 0: set |
| rising edge, J = 1, K = 0: set | |||||
| 0 → 1 | 0 | 0 | 1 | 1 | rising edge, J = 0, K = 0: hold |
| rising edge, J = 0, K = 0: hold | |||||
| 0 → 1 | 0 | 1 | 1 | 0 | rising edge, J = 0, K = 1: reset |
| rising edge, J = 0, K = 1: reset | |||||
| Clock event | J | K | Q before | Q after |
|---|---|---|---|---|
| 0 → 1 | 1 | 1 | 0 | 1 |
| Stays 1 | 1 | 1 | 1 | 1 |
| 1 → 0 | 1 | 1 | 1 | 1 |
| 0 → 1 | 1 | 1 | 1 | 0 |
| 0 → 1 | 1 | 0 | 0 | 1 |
| 0 → 1 | 0 | 0 | 1 | 1 |
| 0 → 1 | 0 | 1 | 1 | 0 |
Use a JK flip-flop as a counter bit
When each event makes one rising edge, setting J = K = 1 makes Q alternate 0, 1, 0, 1. JK replaces SR’s problem with both controls asserted by a defined toggle operation.
1 Q = 0 and J = K = 1. Give Q after each of three rising edges.
2 Q = 1, J = 0 and K = 1. What is Q after the next rising edge?
3 Q = 0, J = 1 and K = 0, but the clock only falls from 1 to 0. What is Q after?
- 11, 0, 1: it toggles each time
- 20: reset
- 30: a falling edge is not the active edge, so Q holds
Boolean laws and De Morgan
A circuit with fewer gates is cheaper and faster, and Boolean algebra finds it on paper. Boolean algebra uses + for OR, · for AND, and NOT for complement. These are logic operations on 0 and 1, not ordinary addition.
Each identity is true for every value of A, B and C. Name the law you use at each step of a simplification.
| Law | Identity |
|---|---|
| Identity / annulment | A + 0 = A; A · 1 = A; A + 1 = 1; A · 0 = 0 |
| Idempotence / complement | A + A = A; A · A = A; A + NOT A = 1; A · NOT A = 0 |
| Double negation | NOT(NOT A) = A |
| Commutative / associative | A + B = B + A; (A + B) + C = A + (B + C), also for AND |
| Distributive | A(B + C) = AB + AC; A + BC = (A + B)(A + C) |
| Absorption | A + AB = A; A(A + B) = A |
Apply De Morgan’s laws
A NOT around a whole bracket is hard to simplify until De Morgan’s laws move it inside.
NOT(A + B) = NOT A · NOT B
The gates draw the first law: a NAND gives the same output as two NOTs feeding an OR.
Reverse the same laws to build an equivalent circuit: A · B · C = NOT(NOT(A · B) + NOT C). Brackets show how far each NOT extends.
Factoring works the same way: take out the shared A, and two laws finish the job.
A truth table proves a law on every row: the two output columns for De Morgan match.
| A | B | NOT(A · B) | NOT A + NOT B |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
1 Simplify A + A · B. Name the law.
2 Use De Morgan to write NOT(A + B) with no NOT around a bracket.
3 Simplify NOT(NOT A · NOT B).
- 1A: absorption
- 2NOT A · NOT B
- 3A + B: De Morgan gives NOT(NOT A) + NOT(NOT B), then double negation
Truth table, expression and circuit
The same logic can be given as a circuit, an expression or a truth table, and you need to move between all three. Watch the brackets: a NOT outside brackets inverts the complete bracket result. This circuit uses a three-input AND.
Circuit to expression, and back
- 1Circuit → expression: start at X. Its NOT follows R = P OR N. Substitute P = A AND B AND C and N = NOT A, keeping the brackets.
- 2Expression → circuit: build the inner AND and NOT, join them with OR, then invert its output.
Table → expression: one term for each row where X = 1
| A | B | C | P | N | R | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 0 | 1 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 | 0 |
- 1Find the rows where X = 1.
- 2AND that row’s inputs. Write NOT for an input that is 0.
- 3Join the terms with OR.
Preserve the operators of a given expression unless asked to simplify.
1 A = 0, B = 1, C = 1. Find P, N, R and X.
2 Write the term for the row A = 1, B = 0, C = 1.
3 Why is X = 0 in row 111?
- 1P = 0, N = 1, R = 1, X = 0
- 2A(NOT B)C
- 3P = A AND B AND C = 1, so R = 1 and the final NOT gives X = 0
Karnaugh-map layout
With four inputs, A to D, the counter’s enable decision X has a 16-row truth table, and a pattern is hard to spot in a list that long. A Karnaugh map lays the same 16 outputs out as a grid in which neighbouring cells differ in one input only, so a pattern becomes a shape you can see.
Gray order is 00, 01, 11, 10
AB labels the rows; CD labels the columns. Write every output, including 0. The labels change one bit at a time: ordinary binary order 00, 01, 10, 11 would break that rule.
Each numbered row below is the numbered cell on the map.
| Truth-table inputs ABCD | Map address | X | |
|---|---|---|---|
| 1 | 0010 | AB = 00, CD = 10: top right | 1 |
| 2 | 1111 | AB = 11, CD = 11: third row, third column | 1 |
| 3 | 0110 | AB = 01, CD = 10: second row, last column | 0 |
| 4 | 1000 | AB = 10, CD = 00: bottom left | 1 |
For the reverse direction, read a cell’s row and column labels together to recover ABCD, then put its X in the matching binary-order truth-table row.
1 Where on the map does the input 1001 go? What is its X?
2 Which input ABCD is in the second row, second column? What is its X?
3 Name the two cells that are next to the top-left cell across the edges of the map.
- 1AB = 10, CD = 01: bottom row, second column; X = 0
- 20101; X = 0
- 3top right (AB = 00, CD = 10) and bottom left (AB = 10, CD = 00)
Grouping and simplification
Loop neighbouring 1s: any input that changes inside a loop drops out. Group adjacent 1s into rectangles of 1, 2, 4, 8 or 16 cells; choose the largest useful groups, cover every 1, and never include a 0.
Group the 1s into two loops: the blue one wraps round both edges of the map to join the four corners; the violet one is a square of four.
Write the term for each group
In each loop, find the inputs that are the same in every cell: they make the term.
| Group | Keep fixed inputs; drop changing inputs |
|---|---|
| Blue: four corners, joined across both edges | B = 0 and D = 0 → (NOT B)(NOT D). Drop A and C, which vary. |
| Violet: lower-right square of four | A = 1 and C = 1 → AC. Drop B and D, which vary. |
- The bottom-right cell is in both groups: overlap is allowed.
- Each four-cell group removes two changing inputs.
- The two groups cover all seven 1s. The shared cell still gives one output 1.
Join the terms into a sum-of-products
- Write each loop’s product term, then join the terms with +.
- A three-cell group, a diagonal group or a rectangle containing a 0 changes the function.
- A smaller valid loop can leave unnecessary inputs in a term.
1 In the violet group, which two inputs change?
2 A different map has 1s in only two cells: AB = 11 with CD = 01, and AB = 11 with CD = 11. Write the term for that pair.
3 Why must a group never contain a 0?
- 1B and D
- 2ABD: A = 1, B = 1 and D = 1 stay fixed; C changes
- 3the term would then give 1 for an input whose output is 0, so the function would change
Checking a simplified design
A smaller circuit is useful only if it keeps every truth-table output. Build P = (NOT B)(NOT D) and T = AC, joined by X = P OR T. Then compare all 16 input combinations with the original X.
Blue 1s come from the blue loop’s term P; violet 1s from the violet loop’s term T.
| ABCD | Original X | P | T | New X |
|---|---|---|---|---|
| 0000 | 1 | 1 | 0 | 1 |
| 0001 | 0 | 0 | 0 | 0 |
| 0010 | 1 | 1 | 0 | 1 |
| 0011 | 0 | 0 | 0 | 0 |
| 0100 | 0 | 0 | 0 | 0 |
| 0101 | 0 | 0 | 0 | 0 |
| 0110 | 0 | 0 | 0 | 0 |
| 0111 | 0 | 0 | 0 | 0 |
| ABCD | Original X | P | T | New X |
|---|---|---|---|---|
| 1000 | 1 | 1 | 0 | 1 |
| 1001 | 0 | 0 | 0 | 0 |
| 1010 | 1 | 1 | 1 | 1 |
| 1011 | 1 | 0 | 1 | 1 |
| 1100 | 0 | 0 | 0 | 0 |
| 1101 | 0 | 0 | 0 | 0 |
| 1110 | 1 | 0 | 1 | 1 |
| 1111 | 1 | 0 | 1 | 1 |
- 1Each row agrees: new X = original X on all 16 rows.
- 2Row 1010 makes both terms 1, but X is still a single 1.
- 3Row 0111 makes neither term 1, so X = 0.
Connect X to the counter
The checked X now decides whether the counter counts.
- X is a combinational decision: it can be worked out again from the current A to D.
- Connect X to both J and K. At each rising edge, X = 0 holds Q and X = 1 toggles Q.
- The counter bit is sequential: its next Q also needs the old Q and the active clock edge.
1 For the input 1110, give P, T and the new X.
2 Which input makes both P and T equal to 1?
3 Why compare all 16 rows instead of testing one input?
- 1P = 0, T = 1, X = 1
- 21010 only
- 3one matching row does not show that every other row matches; the two circuits are equal only if all 2⁴ outputs agree