Microprocessor

Microprocessor (CPU)

What is a Microprocessor?

A Microprocessor is the central processing unit (CPU) of a computer system, built on a single integrated circuit (IC) chip.
It performs all computational tasks, decision-making, and control operations.

You can think of it as the “brain” of the computer that processes all data and executes instructions stored in memory.

Examples:

  • Intel 8085, 8086
  • Intel Core i5, i7
  • AMD Ryzen 5
  • ARM processors (used in smartphones)

Main Components of CPU

  1. ALU (Arithmetic Logic Unit)
  2. CU (Control Unit)
  3. MU (Memory Unit) or Registers

1. Arithmetic Logic Unit (ALU)

Definition:
The ALU is the part of the CPU responsible for all mathematical and logical operations. It takes input data from registers or memory, processes it, and sends the result back.

Functions of ALU:

Arithmetic Operations:

  • Addition → 5 + 3 = 8
  • Subtraction → 9 - 4 = 5
  • Multiplication → 2 × 6 = 12
  • Division → 12 ÷ 3 = 4
  • Increment / Decrement → X = X + 1, X = X - 1

Logical Operations:

  • AND – Returns 1 if both bits are 1.
    Example: 1 AND 1 = 1, 1 AND 0 = 0
  • OR – Returns 1 if any bit is 1.
    Example: 1 OR 0 = 1
  • NOT – Inverts the bit.
    Example: NOT 1 = 0
  • XOR – Returns 1 if bits are different.
    Example: 1 XOR 0 = 1
  • Comparison – Checks if A > B, A = B, or A < B.

Example

If you want to add two numbers stored in registers R1 = 10 and R2 = 20,
→ The ALU performs: R3 = R1 + R2
→ Result (30) is stored in register R3.

2. Control Unit (CU)

Definition:
The Control Unit manages and coordinates all the operations inside the CPU.
It tells the ALU, Memory Unit, and Input/Output devices what to do and when to do it.

It does not process data itself but ensures that all components work together correctly.

Main Functions of CU:

  1. Fetching:
    CU fetches instructions from memory (using Program Counter).
    Example: Fetch instruction ADD R1, R2.
  2. Decoding:
    CU interprets the fetched instruction — e.g., it understands that this means add contents of R1 and R2.
  3. Execution Control:
    CU sends control signals to ALU to perform the addition.
  4. Storing Result:
    CU directs the result to be stored in the specified register or memory location.

Example

Suppose you write a small program to calculate A + B:

  1. CU fetches the instruction ADD A, B from memory.
  2. CU decodes it (understands what to do).
  3. CU signals ALU to perform addition.
  4. ALU adds A and B.
  5. CU then stores the result in memory or a register.

3. Memory Unit (MU)

Definition:
The Memory Unit stores data, instructions, and results temporarily or permanently.
It acts as the storage space for everything the CPU needs to process.

Types of Memory:

TypeDescriptionExample
Primary Memory (Main Memory)Directly accessible by CPURAM, ROM
Secondary MemoryLong-term data storageHard disk, SSD
Cache MemoryHigh-speed temporary storageL1, L2, L3 cache
RegistersSmall, fastest memory inside CPUAX, BX (in Intel CPUs)

Example

When you run a program:

  1. Instructions are stored in RAM.
  2. CU fetches them one by one.
  3. ALU executes them.
  4. Intermediate results may be stored in registers temporarily.
  5. Final output is stored back in RAM or disk.

4. How CPU Works (Step-by-Step Cycle)

This process is known as the Instruction Cycle or Fetch–Decode–Execute Cycle.

StepDescriptionExample
FetchCU fetches instruction from memory.Fetch “ADD R1, R2”
DecodeCU interprets what needs to be done.Understand that it’s an addition command.
ExecuteALU performs the operation.Add the data in R1 and R2.
StoreResult is saved in register or memory.Store sum in R3.

Other CPU Components

ComponentDescription
RegistersHigh-speed storage for temporary data (like R1, R2, Accumulator).
Program Counter (PC)Holds the address of the next instruction to execute.
Instruction Register (IR)Stores the current instruction being executed.
Bus SystemTransfers data and signals between CPU, memory, and devices (Data Bus, Address Bus, Control Bus).

Summary Table

UnitFull FormFunctionExample
ALUArithmetic Logic UnitPerforms arithmetic & logical operationsAddition, Comparison
CUControl UnitControls and coordinates CPU activitiesFetch–Decode–Execute
MUMemory UnitStores data, instructions, and resultsRAM, Cache
RegistersTemporary data storage inside CPUAX, BX
PCProgram CounterTracks next instructionNext step pointer

Example (Real-Life Analogy)

Imagine a teacher (CU) in a classroom:

  • CU (teacher) reads the question (instruction) from the book (memory).
  • The teacher asks a student (ALU) to solve it.
  • The student (ALU) does the calculation and gives the answer.
  • The teacher writes the answer back in the notebook (memory).

This is exactly how your CPU works!

Primary and Secondary Memory

Microprocessor (CPU) Read More »