ALU Micro-Operations

🧮 ⚙️ 💻

The fundamental building blocks of CPU computation

01001000 01100101 01101100 01101100 01101111 00100000 01000011 01010000 01010101
1/10

Introduction to ALU Micro-Operations

🔍 The Arithmetic Logic Unit (ALU) performs micro-operations, which are the smallest and most basic operations executed directly by the hardware on binary data stored in CPU registers.

🧮 Arithmetic

Mathematical operations on binary data

🔌 Logic

Bit-level logical operations using logic gates

↔️ Shift

Shifting bits left or right

🔄 Data Transfer

Moving data between registers

2/10

🧮 Arithmetic Micro-Operations

These deal with mathematical operations on binary data.

Addition

R3 ← R1 + R2

0101 (5) + 0011 (3) = 1000 (8)
Subtraction

R3 ← R1 – R2 (done using 2's complement)

0101 (5) – 0011 (3) = 0010 (2)
⬆️
Increment

R1 ← R1 + 1

0101 (5) → 0110 (6)
⬇️
Decrement

R1 ← R1 – 1

0101 (5) → 0100 (4)
3/10

🔌 Logic Micro-Operations

These perform bit-level logical operations using logic gates.

AND

R3 ← R1 AND R2

0101 AND 0011 = 0001
OR

R3 ← R1 OR R2

0101 OR 0011 = 0111
XOR (Exclusive OR)

R3 ← R1 XOR R2

0101 XOR 0011 = 0110
¬
NOT (Complement)

R1 ← NOT R1

0101 → 1010
4/10

↔️ Shift Micro-Operations

These shift the bits of a binary number left or right.

⬅️
Logical Shift Left (LSL)

Shifts all bits left, fills 0 in the rightmost bit

0101 (5) → 1010 (10)
➡️
Logical Shift Right (LSR)

Shifts all bits right, fills 0 in the leftmost bit

0101 (5) → 0010 (2)
🔄➡️
Arithmetic Shift Right (ASR)

Preserves the sign bit for signed numbers

🔄
Rotate Left/Right

Bits rotate around instead of being lost

5/10

🔄 Data Transfer Micro-Operations

These move data from one register to another without processing.

Transfer

R2 ← R1

Move data from one register to another

⬇️
Load from memory

R1 ← M[1000]

Load data from memory address 1000 into register R1

⬆️
Store to memory

M[1000] ← R1

Save data from register R1 to memory address 1000

💡 Data transfer operations are essential for moving data between different components of the CPU and between the CPU and memory.

6/10

🚩 Status Flags from ALU Operations

After executing micro-operations, the ALU updates flags in the status register:

🚩

Zero (Z)

Set if result = 0

💼

Carry (C)

Set if an arithmetic operation generates a carry out

Sign (S)

Set if result is negative (MSB = 1)

⚠️

Overflow (O)

Set if signed result exceeds range

📝 Status flags are crucial for conditional branching and decision-making in programs.

7/10

In Summary

Micro-operations are the building blocks of all computations in the CPU.

  • The ALU executes arithmetic, logic, shift, and transfer operations using control signals from the control unit.
  • These operations update status flags, which guide the CPU for further decisions.
  • Together, they form the foundation of instruction execution in modern processors.
01001101 01101001 01100011 01110010 01101111 01101111 01110000 01100101 01110010 01100001 01110100 01101001 01101111 01101110 01110011
8/10

👉 ALU Micro-Operations

🔍 A micro-operation is the smallest operation the CPU can perform on data stored in registers.

  • They happen at the register transfer level (RTL)
  • They are atomic (cannot be broken into smaller steps)
  • Together, micro-operations form the basis for executing instructions like addition, comparison, or memory load

🔄 Register Transfer

Move data between registers or memory

🧮 Arithmetic

Basic math operations

🔌 Logical

Bit-level operations

↔️ Shift

Move bits left or right

9/10

⚙️ How ALU Executes Micro-Operations

1️⃣
Fetch Data

Operands come from registers into ALU input registers (A & B)

2️⃣
Select Operation

The Control Unit tells ALU what to do (add, AND, shift, etc.)

3️⃣
Perform Operation

ALU uses adders, logic gates, or shifters to process data

4️⃣
Store Result

Result goes into a result register or back to memory

In short: Micro-operations are the tiny steps that ALU performs — moving data, doing arithmetic, applying logic, and shifting bits. The Control Unit tells ALU which micro-operation to do, and results are stored back for the CPU to continue execution.

10/10