CACS155 Microprocessor and Computer Architecture

Microprocessor and Computer ArchitectureUnit 18 min read

Microprocessors & Architecture: Basics, CPU, Buses, and Memory Hierarchy

Unit 1 of Microprocessor and Computer Architecture introduces the foundational concepts of microprocessors, their internal architecture, bus organization, memory hierarchy, and the distinction between microprocessors and microcontrollers. This note covers definitions, functional blocks, real-world applications, and com


Core Concepts: What is a Microprocessor?

A microprocessor is the central processing unit (CPU) of a computer, implemented on a single integrated circuit (chip). It performs arithmetic, logical, and control operations to execute instructions from programs.

Key Definitions

  • CPU (Central Processing Unit): The "brain" of a computer that fetches, decodes, executes, and stores instructions.
  • Microprocessor: A CPU on a single chip (e.g., Intel 8085, ARM Cortex).
  • Microcontroller: A microprocessor with built-in memory, I/O peripherals, and timers (e.g., Arduino, PIC microcontrollers).

Why the Distinction Matters?

Feature Microprocessor Microcontroller
Purpose General-purpose computing Embedded systems (e.g., washing machines, cars)
Memory External (RAM/ROM) Internal (Flash, EEPROM)
Peripherals None (requires external chips) Built-in (ADC, timers, UART)
Power Consumption Higher (e.g., desktop PCs) Lower (e.g., IoT devices)
Example Intel 8085, ARM Cortex Arduino Uno, ESP32

Internal Architecture of a Microprocessor

The 8085 microprocessor (a classic example) consists of functional blocks that work together to execute instructions.

Functional Blocks of 8085

Control UnitALURegistersBus Interfacedata/control flow
Functional blocks of 8085 microprocessor with key interactions (ALU performs operations; Control Unit manages signals).

Key Registers and Their Functions

Register Size (bits) Function
A (Accumulator) 8 Holds operands for ALU operations (e.g., ADD B).
PC (Program Counter) 16 Points to the next instruction in memory.
SP (Stack Pointer) 16 Points to the top of the stack (used for PUSH/POP operations).
PSW (Program Status Word) 8 Contains flags (Zero, Carry, Sign, etc.) to reflect ALU results.
IR (Instruction Register) 8 Holds the current instruction being executed.

Worked Example: Flag Register After SUB B Given:

  • A = 45H, B = 67H
  • Instruction: SUB B (Subtract B from A)

Steps:

  1. A - B → 45H - 67H = 1EH (with Borrow).
  2. Flags Set:
    • Zero Flag (Z): 0 (Result ≠ 00H).
    • Carry Flag (CY): 1 (Borrow occurred).
    • Sign Flag (S): 1 (Result is negative in signed interpretation).
    • Parity Flag (P): 0 (Odd number of 1s in 1EH).

Final PSW: 1 0 1 0 0 0 1 0 (Binary: A2H in hex).


Bus Organization in 8085

The 8085 uses three buses to communicate with memory and I/O devices:

  1. Address Bus (16 lines): Carries memory/I/O addresses (64KB addressable).
  2. Data Bus (8 lines): Transfers data between CPU, memory, and I/O.
  3. Control Bus: Handles signals like READ, WRITE, RESET, INTR.

Real-World Analogy:

  • Address Bus: Like a postal address telling where to deliver a letter (data).
  • Data Bus: The letter itself being transported.
  • Control Bus: Traffic signals ensuring smooth delivery.

Memory Hierarchy: Speed vs. Cost Tradeoff

Computers use a memory hierarchy to balance speed, capacity, and cost.

Memory Type Speed (ns) Capacity (Bytes) Cost (per GB) Volatility Usage Example
Registers 0.5 32-64 Very High Volatile CPU internal storage
Cache (L1/L2) 1-10 KB-MB High Volatile Frequently used instructions
RAM (DRAM) 50-100 GB Moderate Volatile Main memory (e.g., laptop RAM)
ROM 50-200 MB-GB Low Non-volatile BIOS, firmware
SSD 10,000-100,000 TB Low Non-volatile Operating system storage
HDD 1,000,000+ TB Very Low Non-volatile Bulk data storage

In the Real World

  1. eSewa (Nepal):

    • Idea Used: Microprocessor-based payment processing.
    • How? The eSewa server uses high-speed microprocessors (e.g., Intel Xeon) to handle thousands of transactions per second. The memory hierarchy ensures fast access to frequently used transaction records (cached in RAM), while historical data is stored in SSDs/HDDs.
  2. Pathao (Ride-Hailing App):

    • Idea Used: Microcontroller in IoT devices + Microprocessor in backend servers.
    • How?
      • Driver App (Microcontroller): ESP32 (low-power, built-in Wi-Fi) tracks location and sends updates.
      • Server (Microprocessor): Cloud servers (e.g., AWS) use pipelining and parallel processing to match drivers to riders in milliseconds.
  3. NTC (Nepal Telecom) Network:

    • Idea Used: Bus organization in routers.
    • How? Routers (e.g., Cisco ASR) use address/data/control buses to forward packets. The address bus determines the destination IP route, while the data bus transmits the packet payload.

Instruction Cycle, Machine Cycle, and T-States

1. Instruction Cycle

The fetch-decode-execute cycle repeated for every instruction:

  1. Fetch: Get instruction from memory (using PC).
  2. Decode: Interpret instruction (using IR).
  3. Execute: Perform operation (ALU or I/O).
  4. Store: Save result (if needed).

2. Machine Cycle

A machine cycle is one complete operation (e.g., fetch, memory read/write).

  • Fetch Cycle: CPU reads instruction from memory.
  • Execute Cycle: CPU reads/writes data from/to memory.

3. T-States (Clock Cycles)

The 8085 uses a clock signal divided into T-states (each T-state = 1 clock cycle).

  • Example: MVI A, 32H (Move immediate value to A) takes 3 machine cycles (10 T-states).
T1-T4Fetch instruction(MVI A, 32H) from memoT5Decode instruction(CPU internal)T6-T8Execute (prepareto write)T9-T10Write 32H toAccumulator (A)
T-states breakdown for the instruction `MVI A, 32H` (total 10 T-states).

Worked Example: Tracing MVI A, 32H

T-State Operation
1-4 Fetch instruction from memory
5 Decode MVI A, 32H
6-8 Fetch operand 32H from memory
9-10 Write 32H to Accumulator (A)

Microprocessor vs. Microcontroller: A Comparative Table

Feature Microprocessor (e.g., 8085) Microcontroller (e.g., Arduino)
Flexibility General-purpose (runs OS) Dedicated tasks (no OS)
Memory External (RAM/ROM) Internal (Flash, EEPROM)
Peripherals None (requires external chips) Built-in (ADC, timers, UART)
Power Higher (e.g., desktop PCs) Lower (e.g., battery-powered devices)
Example Use Case PCs, servers Washing machines, drones

Exam Tip

  1. Definitions First: Always define key terms (e.g., "A microprocessor is a CPU on a single chip...").
  2. Draw Diagrams: For bus organization, memory hierarchy, or 8085 architecture, label every component.
  3. Flag Register Questions: For SUB, ADD, or CMP, list all flags (Zero, Carry, Sign, Parity) with justification.
  4. Real-World Links: Connect theory to apps like eSewa (memory hierarchy), Pathao (microcontrollers), or NTC (bus organization).
  5. T-State Calculation: Memorize common instructions:
    • MVI (Move Immediate): 10 T-states.
    • ADD B: 4 T-states.
    • JMP: 10 T-states.

Final Note: This unit is the foundation for all microprocessor topics. Master the 8085 architecture, bus signals, and memory hierarchy—they appear in every subsequent unit!

Based on the TU BCA syllabus for Microprocessor and Computer Architecture (CACS155), unit 1.

Discussion

Loading…