Intuition The ONE core idea
An ALU is a single box that quietly computes every operation (add, subtract, AND, OR…) at the same time, then lets a tiny switch pick the one answer you asked for. Everything in the parent note is just spelling out how that "compute-everything-then-pick" box is wired from single-bit gates.
Before you can read the parent note, you must be able to read its language . Below is every symbol and idea it silently assumes, built in the order that each one leans on the one before it. Start at line one — nothing is assumed.
A bit is one wire that is either 0 (low voltage, "off") or 1 (high voltage, "on"). That is the entire alphabet of the hardware — no other symbols exist inside a chip.
To hold bigger numbers we put several bits side by side . Reading them like ordinary place-value digits — but with powers of 2 instead of 10 — gives a whole number.
n -bit number
n bits in a row, written b n − 1 … b 1 b 0 . The rightmost bit b 0 is worth 2 0 = 1 , the next 2 1 = 2 , then 2 2 = 4 , and so on. Its plain (unsigned) value is
value = ∑ i = 0 n − 1 b i 2 i
The big Σ ("sigma") just says "add up all the terms as i runs from 0 to n − 1 ." We need it because writing b 0 2 0 + b 1 2 1 + … every time is tiring.
0101
Bits (left to right) are 0 , 1 , 0 , 1 , so b 3 b 2 b 1 b 0 = 0101 .
0 ⋅ 8 + 1 ⋅ 4 + 0 ⋅ 2 + 1 ⋅ 1 = 5
That is why the parent note writes A = 0101 ( 5 ) — the ( 5 ) is the decimal value.
A , B , F and the subscript notation
A and B are the two n -bit numbers going into the ALU; F is the n -bit answer coming out . A subscript picks one bit out of the bundle: A 2 means "bit number 2 of A " (the wire worth 2 2 ). The very top bit A n − 1 is the most-significant bit (MSB) — worth the most; A 0 is the least-significant bit (LSB) .
Intuition Why bundle bits into letters?
A 4-bit ALU has dozens of wires. Instead of naming each one, we say "A " for the whole input bundle and use A i when we must talk about a single wire. It is the difference between saying "the bus" and "seat 14C."
A_i reveal checkbit number i of the bundle A , the wire whose place-value is 2 i .
The parent note writes formulas like a i ⊕ b i ⊕ c i . Those symbols are logic gates — tiny circuits that take 0/1 inputs and give a 0/1 output. Here is each one, its rule, and its picture.
Definition The four gate symbols
AND — written as a dot a ⋅ b or just ab . Output 1 only if both inputs are 1. Think: both switches closed.
OR — written a + b . Output 1 if at least one input is 1. (This + is not arithmetic plus — context tells them apart.)
XOR — written a ⊕ b . Output 1 if the inputs differ (exactly one is 1). "eXclusive OR."
NOT — written with a bar, a . Flips the bit: 0 = 1 , 1 = 0 .
Intuition Why XOR is the "odd-count / difference" gate
Look at its truth table: it fires only when the two inputs disagree. Chain three of them, a ⊕ b ⊕ c , and the output is 1 exactly when an odd number of the three inputs are 1. That "parity" behaviour is precisely what a sum bit needs (see §5), which is why the parent note reaches for XOR and not AND.
a + b means add"
Why it feels right: + always meant addition in maths class.
The fix: inside a logic expression + is OR (1 + 1 = 1 , not 2 ). Arithmetic addition is a whole circuit (the adder), never a single symbol. Watch the context: gate formula ⇒ OR; number equation ⇒ add.
a ⊕ b reveal checkXOR — outputs 1 when the two inputs differ.
The bar over B means NOT — flip every bit of B (0↔1).
When you add digits, sometimes a column overflows into the next — that spill is the carry . In decimal, 7 + 5 = 12 writes 2 and carries 1. Binary does the same, just sooner: 1 + 1 = 10 writes 0, carries 1.
c i is the carry coming into bit position i . c 0 is the carry into the very first (rightmost) column — usually 0. c n is the carry out of the top bit — it "falls off the end" and becomes the Carry flag.
Intuition Why carries must chain
Bit 0 can't finish until it hands its carry to bit 1, which hands to bit 2… This left-flowing chain is the whole reason a Ripple Carry Adder exists — and why a Carry Lookahead Adder tries to compute the carries early instead of waiting.
The parent's magic line is A − B = A + B + 1 . To believe it you need to know how negatives are stored.
Definition Two's complement
To represent − x in n bits: take x , flip every bit (x ), then add 1. Equivalently, the MSB now carries a negative weight − 2 n − 1 instead of + 2 n − 1 .
So a 4-bit pattern's signed value is
value = − b 3 ⋅ 2 3 + b 2 ⋅ 2 2 + b 1 ⋅ 2 1 + b 0 ⋅ 2 0
The range for 4 bits is [ − 8 , 7 ] — remember that; it is why Example 1 in the parent overflows.
Worked example Negating 2 in 4 bits
2 = 0010 . Flip: 1101 . Add 1: 1110 . And indeed 1110 = − 8 + 4 + 2 = − 2 . ✓
This is exactly the trick the subtractor uses. See Two's Complement for the full story.
Intuition Why flip-and-add-one gives subtraction
If B + 1 is − B , then A + B + 1 is A + ( − B ) = A − B . The adder never knew it did subtraction — we just fed it the negated bits. One XOR bank flips B ; one forced carry-in supplies the "+1." (That forced carry-in is why c 0 was allowed to be nonzero in §3.)
Negate x in two's complement reveal checkflip every bit (x ) then add 1.
Now every symbol in the parent's core equations is defined, so they read like plain English:
Definition Multiplexer (MUX)
A multiplexer is a switch: it has several data inputs, a few select lines S , and one output. The number on S chooses which input reaches the output. With k select lines you can pick among 2 k inputs.
Intuition Why the ALU needs a MUX
The adder and the logic gates all run at once — every answer exists simultaneously on separate wires. The MUX is the little switch that points at the drawer you asked for and hands you that one answer. That is the "compute-everything-then-pick" idea from the very top. Full details in Multiplexer .
The bundle of select lines is the S you see in F = MUX ( S , … ) . In practice these select lines are driven by the Datapath and Control Unit .
The parent produces four extra one-bit outputs that describe the result. Now that carries and the MSB are defined, each is readable:
Naming wires A B F subscripts
Multiplexer picks one result
Read a 4-bit pattern like 0110 as a decimal number 0 ⋅ 8 + 1 ⋅ 4 + 1 ⋅ 2 + 0 ⋅ 1 = 6 .
State the rule for AND, OR, XOR, NOT AND=1 iff both 1; OR=1 iff at least one 1; XOR=1 iff they differ; NOT flips the bit.
Explain why a ⊕ b ⊕ c is the sum bit XOR outputs 1 when an odd number of inputs are 1 — exactly what a sum column needs.
Negate a number in two's complement flip every bit then add 1 (x + 1 ).
Say what c 0 and c n mean c 0 = carry into the first column (can force the "+1"); c n = carry off the top, becomes the Carry flag.
Explain what a multiplexer does routes one of several inputs to a single output, chosen by the select lines S .
Tell C apart from V C = carry out of MSB (unsigned overflow); V = c n ⊕ c n − 1 (signed overflow, sign corrupted).
Interpret the MSB F n − 1 two ways unsigned: worth + 2 n − 1 ; signed two's complement: worth − 2 n − 1 , so MSB=1 means negative.