2025 26 2b

Computer Organization and Architecture2025-267 marksArithmetic & logic unit design

Explain the design of an Arithmetic and Logic Unit. Describe various arithmetic and logical operations performed by ALU.

Explain the design of an Arithmetic and Logic Unit. Describe various arithmetic and logical operations performed by ALU.

Quick answer

The ALU is a combinational circuit that performs arithmetic and logic micro-operations on two $n$-bit inputs. The design is made one bit at a time. Each bit has a 1-bit slice, and $n$ slices are joined side by side. The carry of one slice goes to the next.

        A_i        B_i
         |          |
         |   +------+------+
         |   | logic for B  |<-- S1 S0 (select B, B', 0, 1)
         |   +------+------+
         |          |
      +--+----------+--+
      |   full adder    |<-- C_i
      +--+--------------+--> C_i+1
         |
      +--+------------------+
      | logic gates AND,OR, |<-- S3 S2 (select)
      | XOR, NOT on A_i,B_i |
      +--+------------------+
         |
      [4:1 MUX] --> F_i

The arithmetic part is a parallel adder. A set of gates on the $B$ input decides what the adder sees. They can pass $B$, pass $\overline{B}$, or pass all 0s or all 1s. With the carry input $C_0$, this gives the different operations.

Select$C_0$Operation
pass $B$0$F = A + B$ (add)
pass $B$1$F = A + B + 1$ (add with carry)
pass $\overline{B}$1$F = A - B$ (subtract)
pass $\overline{B}$0$F = A - B - 1$
pass 01$F = A + 1$ (increment)
pass all 1s0$F = A - 1$ (decrement)
pass 00$F = A$ (transfer)

The logic part applies a gate to each bit pair separately. It gives AND, OR, XOR and complement (NOT). No carry moves between the bits.

A multiplexer (MUX) in each slice chooses between the arithmetic result and the logic result, using the select lines. The ALU also gives status flags: carry $C$, sign $S$, zero $Z$ and overflow $V$. Overflow is $V = C_n \oplus C_{n-1}$, the XOR of the last two carries.

Operations performed

  • Arithmetic: addition, subtraction, increment, decrement and transfer.
  • Logical: AND, OR, XOR, NOT.
  • Shift: logical shift and arithmetic shift left or right, and rotate.

The control unit gives the select code that picks the operation. The result goes to a register, and the flags are stored in the status register for conditional branches.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.

Up nextExplain floating point arithmetic operations. Perform floating point addition using IEEE 7