2IC30 · Topic 01
Digital Logic Foundations
Gates, truth tables, Boolean algebra and minimisation — the language all hardware is built from.
Logic gates & truth tables
A logic gate is a tiny circuit that takes 1-bit inputs (0 or 1) and produces a 1-bit output. The basic gates: NOT (¬a): flips the bit. AND (a·b): 1 only if both inputs are 1. OR (a+b): 1 if at least one input is 1. A truth table lists the output for every combination of inputs.
Derived gates appear constantly: a b AND OR NAND NOR XOR 0 0 0 0 1 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 0 NAND = NOT(AND), NOR = NOT(OR), XOR = 1 when inputs differ. Notation: AND = a·b = a∧b; OR = a+b = a∨b; NOT = ¬a = a'.
Gates are built from relays (early) or transistors (modern, billions per chip — Moore's law). Field-effect transistors are voltage-controlled, hence more energy efficient. Each gate also restores signal levels: as long as the output voltage falls inside the required input range, small noise and voltage loss are corrected automatically — this is why digital logic is reliable and immune to cumulative analogue error. For n inputs a truth table has 2 n rows, and there are 2 (2^n) possible functions — already 65 536 functions for 4 inputs. Regularity, abstraction and hierarchy are needed to manage that explosion.
Every adder, multiplexer, memory cell and ALU in your phone is ultimately gates. A 64-bit addition would need a truth table of 2 64 rows — at a billion rows/second that is over 500 years, so engineers never enumerate it; they compose small reusable blocks.
Logic gates & truth tables worked examples
1 questions
Common mistakes
- Confusing NAND/NOR (they are negations of AND/OR, not of each other).
- Writing XOR as OR — XOR is 0 when both inputs are 1.
- Mixing notations: a+b is OR, not arithmetic addition.
Exam tips
- Memorise all 6 gate truth tables cold — Q2 always opens with truth tables.
- When asked to draw a circuit, label every wire; partial credit follows clear intermediate signals.
Memory aids
- AND = A ll needed; OR = O ne is enough.
- XOR = e X clusive = 'different' detector.
Logic gates & truth tables practice
2 questions
Boolean algebra & De Morgan
Boolean algebra is the set of rules for simplifying logic expressions, just like ordinary algebra simplifies numbers. Two values: 1 (true) and 0 (false).
Key laws (each has an AND/OR dual — swap ∧↔∨ and 0↔1): Identity: x∨0 = x, x∧1 = x Zero/One: x∨1 = 1, x∧0 = 0 Idempotence: x∨x = x, x∧x = x Complement: x∨¬x = 1, x∧¬x = 0 Double negation: ¬(¬x) = x Commutativity, Associativity Distributivity: x∧(y∨z) = (x∧y)∨(x∧z), and dually x∨(y∧z) = (x∨y)∧(x∨z) Absorption: x∨(x∧y) = x, x∧(x∨y) = x Complement-absorption: x∨(¬x∧y) = x∨y De Morgan : ¬(x∨y) = ¬x∧¬y and ¬(x∧y) = ¬x∨¬y
Boolean algebra and propositional logic are two views of the same structure. A complete subset of rules (idempotence, zero, identity, double-negation, excluded-middle/contradiction in red on the slides) can derive all the others. De Morgan is what lets you convert between minterm/AND-OR and maxterm/OR-AND forms, and between AND-OR and NAND-NAND implementations.
Compilers and hardware synthesis tools apply exactly these laws to shrink circuits — fewer gates means less silicon, less power, less delay.
Boolean algebra & De Morgan worked examples
2 questions
Common mistakes
- De Morgan flips the connective AND negates each term — students forget to change ∧↔∨.
- Distributing wrong: x∨(y∧z) = (x∨y)∧(x∨z), NOT x∨y∧x∨z without brackets.
- Assuming '+' distributes over '·' the same way as numbers — in Boole BOTH distributivities hold.
Exam tips
- Show each rewrite step with the rule name — graders give marks per justified step.
- De Morgan is the single most-used law on the exam; practise pushing negations inward.
Memory aids
- De Morgan: 'break the line, change the sign' — ¬ over a bar, flip ∧↔∨.
- Dual = mirror world: swap AND↔OR and 0↔1.
Boolean algebra & De Morgan practice
2 questions
Combinational circuits & normal forms
A circuit is combinational if its output depends only on the current inputs (no memory, no feedback loops). Given a truth table you can always build one.
Two systematic ways to write any function: Minterm : one product (AND) term per row where the output is 1. If a=1,b=0,c=1 gives 1, its minterm is a∧¬b∧c. Maxterm : one sum (OR) term per row where the output is 0. If a=0,b=1,c=0 gives 0, its maxterm is a∨¬b∨c. Disjunctive Normal Form (DNF) = OR of all minterms. Conjunctive Normal Form (CNF) = AND of all maxterms. Both are canonical (unique) but verbose.
Rules to read terms off a truth table: Minterm (row where f=1): input 0 → take ¬variable, input 1 → take variable, AND them. Maxterm (row where f=0): input 0 → take variable, input 1 → take ¬variable, OR them. Constraints on a valid combinational circuit: no cycles (an input must not depend directly or indirectly on its own output), and two gate outputs must never be wired together .
DNF/CNF are the front door to logic synthesis and to SAT solvers used in verification, AI planning and chip testing.
Combinational circuits & normal forms worked examples
1 questions
Common mistakes
- Swapping the minterm/maxterm read-off rule (minterm uses 1-rows, maxterm uses 0-rows).
- For maxterms, forgetting that a 1-input becomes the COMPLEMENT inside the OR.
- Building from the wrong rows — always re-check which value (0 or 1) you are encoding.
Exam tips
- The exam often asks specifically for CNF or DNF — read which one!
- A maxterm CNF of f equals the De Morgan of the minterm DNF of ¬f; use this as a cross-check.
Memory aids
- mi N term → rows where output is o N e, joined by OR.
- ma X term → rows where output is 0, joined by AND.
Combinational circuits & normal forms practice
2 questions
Karnaugh maps & minimisation
A Karnaugh map (K-map) is a grid that rearranges a truth table so that physically adjacent cells differ in exactly one input bit. Grouping adjacent 1s lets you read off a minimal formula by eye.
For 4 variables, label columns ab and rows cd in Gray-code order 00, 01, 11, 10 (only one bit changes between neighbours). The map wraps around: top↔bottom and left↔right edges are adjacent. Group rectangular blocks of 1s of size 2 N ×2 M (1,2,4,8…). Bigger groups = simpler terms. Each group drops the variable(s) that change inside it. Cover every 1 with as few, as large groups as possible (groups may overlap). Maxterm/dual approach: group the 0s instead to get a minimal product-of-sums.
Don't-cares (X) are input combinations that cannot occur or whose output is irrelevant; you may treat each X as 0 or 1 — whichever enlarges your groups — giving smaller circuits. Different valid groupings can yield equally minimal but different expressions; there is not always a single 'right' answer. 'Optimal' usually means fewest gate inputs overall, so double-check both the minterm and maxterm solution and pick the cheaper.
K-maps are the by-hand version of the Quine–McCluskey / Espresso algorithms inside every chip-design toolchain.
Karnaugh maps & minimisation worked examples
1 questions
Common mistakes
- Writing the column/row headers in binary 00,01,10,11 instead of Gray 00,01,11,10 — neighbours then differ in two bits and grouping breaks.
- Forgetting wrap-around adjacency on the edges and corners.
- Making non-rectangular or non-power-of-two groups.
- Not using don't-cares to grow groups.
Exam tips
- The exam dictates the layout ('put ab on top, cd on the left') — follow it exactly or lose marks.
- Circle/label each cluster on the map; graders trace your groups.
- Always sanity-check with the dual (group the 0s).
Memory aids
- Gray order chant: 'zero-zero, zero-one, one-one, one-zero'.
- Bigger blocks → shorter terms; cover all 1s, minimise the count.
Karnaugh maps & minimisation practice
2 questions
Functional completeness, MUX & PLA
A set of gate types is functionally complete if you can build every Boolean function using only those gates.
Facts to know: {AND, OR, NOT} is complete (min/maxterm forms prove it). {AND, NOT} and {OR, NOT} are each complete (build the missing one via De Morgan). {NAND} alone is complete; {NOR} alone is complete. (NOT = a NAND a; AND, OR follow.) A multiplexer (MUX) picks one of several data inputs using select lines: 2-input f = a0∧¬s ∨ a1∧s. A 4-input MUX is built from three 2-input MUXes or directly. A MUX is a universal function block : feed constants/inputs to its data lines and it realises any function of the select variables. A PLA (Programmable Logic Array) = an AND-array (forming minterms) feeding an OR-array (summing them); 'programming' removes unwanted connections. Two-level AND-OR is equivalent to NAND-NAND.
Because two-level AND-OR equals NAND-NAND (and OR-AND equals NOR-NOR), any minimised K-map expression maps directly to a uniform NAND (or NOR) implementation — important since NAND/NOR are the cheapest gates in CMOS. The parity function is a classic case where two-level logic needs an exponential number of gates, but a tree of n−1 XOR gates does it in log₂n depth.
FPGAs implement logic as lookup tables (essentially MUX-based universal blocks); PLAs/PALs were the ancestors of today's programmable logic.
Functional completeness, MUX & PLA worked examples
1 questions
Common mistakes
- Claiming {AND, OR} is complete — it is NOT (you cannot make NOT).
- Forgetting a single NAND or NOR suffices for everything.
- Mixing up MUX select wiring when cascading.
Exam tips
- 'Implement using only NAND gates' is a recurring Q2 part — practise the AND-OR→NAND-NAND conversion.
- Know one-line proofs that NAND and NOR are universal.
Memory aids
- NAND & NOR are the 'one-gate wonders' — each alone builds everything.
- MUX = a hardware if-then-else .
Functional completeness, MUX & PLA practice
2 questions