This unit connects digital electronics to how a CPU actually works internally.
⭐ 4.1 What is a Microprocessor?
A microprocessor is the brain of the computer, an IC that performs:
Examples:
-
8085 (8-bit, classic for exams)
-
8086 (16-bit)
-
i3, i5, i7 (modern CPUs)
⭐ 4.2 Basic Microprocessor Architecture
Major Components:
1️⃣ ALU (Arithmetic Logic Unit)
Performs:
-
Add, Subtract
-
AND, OR, NOT
-
Compare
2️⃣ Control Unit (CU)
-
Controls timing
-
Fetch, Decode, Execute instructions
-
Sends control signals to memory and I/O
3️⃣ Registers
High-speed small storage inside CPU:
-
Accumulator (A)
-
General registers (B, C, D, E, H, L)
-
Program Counter (PC)
-
Stack Pointer (SP)
-
Flag Register (Z, S, CY, P, AC flags)
⭐ 4.3 Instruction Cycle
Every instruction executes in three steps:
1️⃣ Fetch Cycle
-
PC → Address Bus
-
Memory → Instruction → CPU
-
PC = PC + 1
2️⃣ Decode Cycle
-
Instruction decoded by Control Unit
-
Identifies required operation
3️⃣ Execute Cycle
-
ALU performs operation
-
Result stored in Register/Memory
-
Flags updated
⭐ 4.4 Machine Cycle & T-States
Machine Cycle:
A part of instruction cycle (memory read, memory write, I/O read, etc.)
T-States:
Each machine cycle is divided into clock cycles.
Example (8085):
-
Memory Read Cycle = 3 T-states
-
Memory Write Cycle = 3 T-states
-
Opcode Fetch Cycle = 4 T-states
⭐ 4.5 Addressing Modes
Defines how data is accessed.
⭐ 4.6 Instruction Format
8085 uses:
-
1-byte instructions
-
2-byte instructions
-
3-byte instructions
Example:
MOV A, B → 1 byte
MVI A, 32H → 2 bytes
LDA 2050H → 3 bytes
⭐ 4.7 Interrupts
Interrupt = CPU’s attention signal.
Types:
-
Hardware – RST 7.5, RST 6.5, RST 5.5, INTR
-
Software – RST instruction
-
Maskable / Non-maskable
-
Vectored / Non-vectored
Example:
-
TRAP → Non-maskable, vectored
-
RST 7.5 → Maskable, vectored
⭐ 4.8 Pipelining
Modern CPUs use pipelines to speed up execution.
Typical stages (RISC pipeline):
-
IF – Instruction Fetch
-
ID – Instruction Decode
-
EX – Execute
-
MEM – Memory Access
-
WB – Write Back
Why pipelining is fast?
Because multiple instructions execute in parallel.
⭐ 4.9 Types of Pipelines
-
Superpipelining
(More pipeline stages) -
Superscalar Pipeline
(More than one instruction issued per cycle)
⭐ 4.10 Pipeline Hazards
These are problems that slow down pipelined execution.
1️⃣ Data Hazard
Occurs when one instruction depends on the result of the previous one.
Example:
2️⃣ Control Hazard
Occurs in branching.
Example:
Branch decision unknown → pipeline stalls.
3️⃣ Structural Hazard
Two instructions need the same hardware resource at the same time.
Solutions to hazards
-
Forwarding / Bypassing
-
Pipeline Stalling
-
Separate instruction & data memory
No comments:
Post a Comment