ALU 101 Control Signals and Flags 1 — Questions and Answers
Question 1: What does the Carry flag (CF) indicate after an ALU addition operation?
- The result is negative
- A carry-out occurred beyond the MSB of the result (Correct answer)
- The result equals zero
- An arithmetic overflow occurred in signed arithmetic
Correct answer: A carry-out occurred beyond the MSB of the result
The Carry flag is set when an addition generates a carry out of the most significant bit, indicating unsigned overflow.
Question 2: Which flag is set when the result of an ALU operation is exactly zero?
- Sign flag
- Overflow flag
- Zero flag (Correct answer)
- Parity flag
Correct answer: Zero flag
The Zero flag (ZF) is set by the ALU when all bits of the result are 0, used by conditional branch instructions.
Question 3: What is the purpose of the Overflow flag (OF) in ALU operations?
- To indicate unsigned carry-out
- To signal that a signed arithmetic result exceeded the representable range (Correct answer)
- To mark a parity error
- To indicate a divide-by-zero condition
Correct answer: To signal that a signed arithmetic result exceeded the representable range
The Overflow flag is set when signed addition or subtraction produces a result outside the two's complement range for the given word size.
Question 4: What do ALU control lines (operation select lines) determine?
- The clock frequency
- Which arithmetic or logic operation the ALU performs on its inputs (Correct answer)
- The bit width of the operands
- The number of pipeline stages
Correct answer: Which arithmetic or logic operation the ALU performs on its inputs
Control lines (opcode inputs) select the specific operation—such as ADD, AND, XOR, or shift—that the ALU executes on the current operands.
Question 5: The Sign flag (SF) in x86 architecture mirrors which bit of the ALU result?
- The LSB (bit 0)
- The second MSB
- The MSB (most significant bit) (Correct answer)
- The carry-out bit
Correct answer: The MSB (most significant bit)
The Sign flag is set equal to the MSB of the result, which indicates the sign in two's complement representation.
Question 6: What does the Parity flag indicate after an ALU result is computed?
- Whether the result is even or odd as a whole number
- Whether the number of set bits in the low byte of the result is even (Correct answer)
- Whether a carry was generated
- Whether the result has an overflow
Correct answer: Whether the number of set bits in the low byte of the result is even
The Parity flag is set when the low byte of the result contains an even number of 1-bits, used historically for simple error checking.
What does the Carry flag (CF) indicate after an ALU addition operation?