ALU 101 study materials
ALU 101 study resources

ALU 101: Arithmetic Logic Unit Fundamentals

ALU 101 · Work through your exam, one topic at a time.

All guide sections

Arithmetic Logic Unit Fundamentals

What the ALU is and does

The arithmetic logic unit is the combinational circuit that performs integer arithmetic and bitwise logic on operands supplied by the datapath. Candidates should be comfortable with the ALU's role as a function unit: a set of operations selected by control lines, with result and status outputs. Know the standard operation menu - add, subtract, increment/decrement, AND, OR, XOR, NOT, shift left/right, arithmetic shift, and comparison - and understand that subtraction is normally implemented as addition of the two's complement.

Status and flags

Learn what each flag means and when it is meaningful: carry (unsigned overflow / borrow), overflow (signed result out of range), zero, negative/sign, and sometimes parity. A frequent trap is confusing carry with overflow: adding 0xFF + 0x01 in 8-bit gives carry = 1, zero = 1, but overflow = 0, because signed 0xFF is -1 and -1 + 1 = 0 is representable.

Traps to watch

  • Assuming flags are always updated: many architectures only update flags for selected instructions.
  • Forgetting that logical shifts fill with zeros while arithmetic right shifts replicate the sign bit.
  • Treating the ALU as sequential - it is combinational; state lives in registers.
  • Assuming a subtract borrow flag equals unsigned carry-inverted without checking the architecture's convention.

Rule of thumb

For an n-bit adder: carry-out indicates unsigned overflow; signed overflow occurs when the carry into the sign bit differs from the carry out of the sign bit (equivalently, when two same-sign operands produce an opposite-sign result).

Worked example: 8-bit two's complement, 0x7F + 0x01 = 0x80. Result sign flips from positive to negative while operands were positive, so overflow = 1; carry-out = 0. The value 0x80 is -128, which is correct only if you interpret it as signed wraparound - hence the overflow flag.