Lesson Objective

By the end of this lesson, you should be able to:

  • Understand the purpose of the Central Processing Unit (CPU)
  • Describe the function of the CPU as fetch, decode, execute
  • Identify and explain common CPU components and their characteristics
  • Understand what affects CPU performance
  • Define embedded systems

What is the CPU?

The Central Processing Unit (CPU) is the part of a computer that performs calculations, processes data and controls the other components in the computer system. It is the 'brain' of the computer.

Key Points

The CPU does the following:

  • Executes program instructions
  • Processes data
  • Manages hardware components
  • Located on the motherboard

The Fetch-Decode-Execute Cycle

The CPU follows a continuous cycle to process instructions:

1. Fetch

The CPU fetches the next instruction from main memory (RAM) into its internal registers.

2. Decode

The CPU decodes the instruction to understand what needs to be done.

3. Execute

The CPU executes the instruction (e.g. performs a calculation, moves data, etc.).

Fetch-Decode-Execute Cycle Diagram

Image: Diagram showing the continuous cycle of fetching, decoding, and executing instructions.

Advertisement.

CPU Components

Von Neumann Architecture

Von Neumann architecture serves as the foundation for most of the computers we use today. The architecture is named after the mathematician John von Neumann, who designed the specification for the first programmable computer in 1954.

In Von Neumann architecture, both data and software instructions are stored in computer memory (RAM). This is referred to as The Stored Program Concept, which is a design that allows programs themselves to be stored in memory, not just data.

Fetch-Decode-Execute Cycle Diagram

Control Unit (CU)

Function: Coordinates all activities inside the CPU

  • Controls the fetch-decode-execute cycle
  • Sends control signals to other components
  • Manages the flow of data

Arithmetic Logic Unit (ALU)

Function: Performs calculations and logical operations

  • Arithmetic operations (add, subtract, multiply, divide)
  • Logical operations (AND, OR, NOT)
  • Comparison operations (greater than, less than, equal to)

Registers

Function: Small, fast memory locations within the CPU

  • Program Counter (PC): Holds memory address of next instruction
  • Memory Address Register (MAR): Holds address of data to be fetched
  • Memory Data Register (MDR): Temporarily holds data being transferred
  • Accumulator: Stores results of calculations
  • Current instruction register (CIR): Stores the currently decoded instruction.

Cache

Function: Very fast memory inside the CPU

  • Stores frequently used data and instructions
  • Much faster than RAM but smaller in size
  • L1, L2, L3 cache levels (L1 is fastest but smallest)

Buses

Function: Transfers data, addresses, command signals.

  • Data Bus: Transfers data between CPU and memory.
  • Address Bus: Carries memory addresses.
  • Control Bus: Carries control signals.

Clock

Function: Sends out regular pulses (clock cycles). It synchronizes the timing of various hardware components. It also determines the CPU's processing speed.

Advertisement.

CPU Performance Factors

The speed of a CPU (central processing unit) can be influenced by several factors:

Clock Speed

Definition: The number of cycles per second (measured in Hz)

  • Higher clock speed = more instructions per second
  • Measured in GHz (gigahertz)
  • Example: 3.5 GHz = 3.5 billion cycles per second

Number of Cores

Definition: Multiple processing units within one CPU

  • Dual-core = 2 cores, Quad-core = 4 cores
  • More cores allow parallel processing
  • Each core can process instructions independently

Cache Size

Definition: Amount of fast memory within the CPU

  • Larger cache = faster access to frequently used data
  • Reduces need to access slower RAM
  • Typical sizes: 4MB, 8MB, 16MB

Lesson Summary

  • CPU: The 'brain' of the computer that executes instructions
  • Fetch-Decode-Execute: The continuous cycle the CPU follows
  • Components: Control Unit, ALU, Registers, Cache
  • Performance Factors: Clock speed, number of cores, cache size
  • Embedded Systems: Specialized computers built into devices for specific tasks