An ALU needs to compute A − B. Given that no subtraction circuit exists in the design, how does it perform the operation?
AIt routes the operands to a separate subtraction unit outside the ALU
BIt computes NOT(A) + B + 1 using the adder
CIt computes A + NOT(B) + 1 using the adder, exploiting two's complement negation
DIt cannot perform subtraction without a dedicated subtractor circuit
Subtraction uses the adder by exploiting two's complement: −B = NOT(B) + 1, so A − B = A + NOT(B) + 1. The ALU inverts the second operand (bitwise NOT) and sets carry-in to 1. This is why understanding two's complement is a prerequisite for the ALU — subtraction, negation, and comparison all reduce to addition with a complemented input. Option B has the operands reversed.
Question 2 Multiple Choice
A high-level language statement `if (a < b)` is compiled and executed on a CPU. What does the ALU actually do to evaluate this condition?
AIt reads the values of a and b from memory and compares their addresses
BIt performs a − b, discards the numeric result, and checks the negative and overflow flags
CIt uses a dedicated comparison circuit separate from the arithmetic path
DThe control unit evaluates the condition directly without invoking the ALU
Comparison is implemented as subtraction: the ALU computes a − b, and the control unit reads the resulting status flags. For signed integers, the negative flag (MSB of result) and the overflow flag together determine whether a < b. The numeric result is discarded. This shows how the ALU's flag outputs — not just its data output — are central to the processor's ability to implement any conditional logic.
Question 3 True / False
The ALU's function-select inputs determine which operation (ADD, AND, OR, etc.) is performed on the current clock cycle.
TTrue
FFalse
Answer: True
The ALU simultaneously computes multiple operations on the input operands — the AND gate, OR gate, and adder all produce outputs in parallel. A multiplexer at the output selects which result to pass through based on the function-select code sent by the control unit. So the select inputs do determine which operation's result is used, though all operations run in parallel internally.
Question 4 True / False
The ALU decides which arithmetic or logic operation to perform based on the instruction currently being executed.
TTrue
FFalse
Answer: False
The ALU has no knowledge of the current instruction or the program being executed. It is a purely combinational circuit: it takes operands and a function-select code as inputs and produces a result. It is the *control unit* that decodes the instruction and generates the appropriate function-select signals sent to the ALU. The ALU simply executes whatever operation the control unit requests — it has no agency or instruction-awareness of its own.
Question 5 Short Answer
Why can an ALU perform subtraction using only an adder circuit, and why does this require two's complement representation?
Think about your answer, then reveal below.
Model answer: In two's complement, the negation of B is NOT(B) + 1. Therefore A − B = A + (NOT(B) + 1) = A + NOT(B) + 1, which is just an addition with the second operand bitwise-inverted and carry-in set to 1. The adder handles this naturally by inverting B's bits and enabling carry-in. This works *because* two's complement is designed so that negation is a bitwise inversion plus 1 — a property that doesn't hold for sign-magnitude or one's complement representations.
The key insight is that two's complement wasn't just chosen to represent negatives — it was chosen specifically because it makes subtraction free once you have an adder. This is why the ALU needs no separate subtraction hardware. The same trick extends to comparisons, which also reduce to subtraction, making the adder the computational workhorse behind arithmetic, subtraction, and branching conditions.