\(2.4.\)Arthimetic Logic Unit

1.ALU intro

  The Arithmetic Logic Unit (ALU) is a crucial component in computers, responsible for executing various arithmetic and logic operations. Typically part of the CPU, it handles arithmetic operations such as addition, subtraction, multiplication, and division, as well as logic operations including AND, OR, NOT, and XOR, based on instructions provided.

2.ALU structure

  We can describe the ALU through the diagram below:

  • The ALU computes a function on the two inputs, and outputs the result.

  • f:one out of a family of pre-defined arithmetic and logical functions. It contains:

    • Arithmetic operations:integer addition, multiplication, division, ...
    • Logical operations: And, Or, Xor....

\(p.s.\)There is a interesting question towards ALU: Which operation should ALU operate? If we choose to ignore some operation in ALU, when we want to use it, we have to implement it in the software. This is also called a Hardware and Software trade off.