Combinational Circuits (Adders, Decoders, MUX, ALU)

Context: FIT1047_MOC · output = pure function of current inputs (no memory) · gates from Transistors and Logic Gates assembled into arithmetic hardware · contrast Sequential Circuits (Latches, Flip-Flops, Registers)

Quick Revision

  • 🎯 Objective: four building blocks ➔ adder (arithmetic), decoder (1-of- activation), MUX (input selection), ALU (all ops in parallel + MUX picks by op-code).
  • ⚡ Key Constraint: half adder = XOR (result) + AND (carry); full adder adds a carry-IN — chaining full adders = ripple-carry adder.

📝 Core

1. Adders

  • Half adder (2 one-bit inputs) ➔ Result , Carry-out — read straight off (Number Systems (Binary and Hexadecimal)).
  • Full adder (3 inputs: , carry-in) ➔ handles ; built from two half adders + OR.
  • Ripple-carry adder ➔ chain full adders, each carry-out feeding the next carry-in ⟹ adds two -bit numbers.

2. Decoder

  • Job ➔ activate exactly ONE of outputs based on an -bit input: input ⟹ only high.
  • Table (2-bit), , , — one-hot output.

3. Multiplexer (MUX)

  • Job ➔ SELECT one of several inputs onto one output; built as decoder (choose) + AND gates (gate the chosen line) + OR (combine).
  • Duality ➔ decoder activates an output line; MUX selects an input line — the two directions of “1-of-”.

4. ALU (Arithmetic-Logic Unit)

  • Role ➔ fundamental computation block of every CPU (modern CPUs/GPUs carry many).
  • Operations ➔ integer add/subtract (sometimes multiply), comparisons, bitwise AND/OR/NOT, shifts.
  • Interface ➔ inputs: two -bit operands + an op-code; outputs: -bit result + status (overflow/error).
  • Trick ➔ compute ALL operations in parallel, then a MUX selects the wanted result by op-code (lecture example: , , , : comparison).

⚠️ Common Mistakes

  • 💡 Half vs full adder ➔ the difference is exactly the carry-IN input; a ripple chain needs FULL adders everywhere except (optionally) position 0.
  • 💡 ALU doesn’t “choose then compute” ➔ it computes everything and selects — that’s why the MUX is the punchline of the whole week.

🧠 Active Recall