Computer Architecture (Copy)
Role of the Central Processing Unit (CPU)
- The CPU is the ‘brain’ of the computer, responsible for processing all instructions from programs and carrying out calculations.
- Functions include:
- Fetching instructions from memory
- Decoding instructions into understandable signals for execution
- Executing the instructions (e.g. performing calculations, moving data)
- Managing the flow of data between different parts of the computer
- CPU performance directly affects the overall speed and efficiency of a computer.
- The CPU operates using the fetch–decode–execute cycle.
What is a Microprocessor
- A microprocessor is a single integrated circuit (IC) containing all the essential CPU components.
- It is a miniaturized version of a CPU designed for compact systems.
- Found in:
- Personal computers (PCs)
- Embedded systems (washing machines, microwaves)
- Mobile devices
- Advantages:
- Small size → portable devices possible
- Low power consumption
- High speed for specific tasks
Von Neumann Architecture
- A computer architecture model where data and instructions share the same memory and pathways.
- Components:
- Arithmetic Logic Unit (ALU) – Performs all arithmetic (addition, subtraction, etc.) and logic (AND, OR, NOT) operations.
- Control Unit (CU) – Directs the flow of instructions and data within the CPU, controls other components.
- Registers – Small, high-speed storage locations inside the CPU:
- Program Counter (PC) – Holds the address of the next instruction to fetch.
- Memory Address Register (MAR) – Holds the address in memory where data/instructions will be fetched from or written to.
- Memory Data Register (MDR) – Holds the actual data/instruction fetched from or written to memory.
- Current Instruction Register (CIR) – Holds the current instruction being decoded/executed.
- Accumulator (ACC) – Temporarily stores the results of calculations from the ALU.
- Buses – Pathways for transmitting data and signals:
- Address Bus – Carries memory addresses (one way – CPU → RAM).
- Data Bus – Carries data between CPU, memory, and input/output devices.
- Control Bus – Carries control signals (e.g., Read/Write, clock signals).
The Fetch–Decode–Execute (FDE) Cycle
1. Fetch:
- The Program Counter (PC) sends the address of the next instruction to the MAR.
- The Address Bus sends this address to RAM.
- The CPU sends a Read signal via the Control Bus.
- The instruction is fetched from RAM into the MDR.
- The instruction is then moved from the MDR to the CIR.
- The PC is incremented to point to the next instruction.
2. Decode:
- The Control Unit decodes the instruction in the CIR into a series of control signals.
- Determines which parts of the CPU and memory will be used.
3. Execute:
- The appropriate components (ALU, registers, memory) carry out the instruction.
- If it’s a calculation, the ALU processes it and stores the result in the ACC.
- If it’s a data transfer, the Data Bus is used to move data to/from memory.
Cores, Cache, and Clock Speed
Cores:
- A core is an independent processing unit inside a CPU.
- A single-core CPU can only process one instruction at a time, while multi-core CPUs can handle multiple instructions simultaneously.
- More cores = potential for better multitasking and faster execution of parallel tasks.
Cache:
- Small, very fast memory inside the CPU used to store frequently accessed instructions/data.
- Levels:
- L1 Cache – Smallest but fastest, directly built into the core.
- L2 Cache – Larger but slightly slower, may be shared between cores.
- L3 Cache – Larger and slower than L1/L2, shared between all cores.
- Larger cache → fewer accesses to slower main memory → improved performance.
Clock Speed:
- Measured in GHz (gigahertz).
- Indicates how many clock cycles the CPU can complete per second.
- Higher clock speed → more instructions executed per second.
- Limited by heat generation and power consumption.
Instruction Set
- The instruction set is the complete list of commands the CPU can execute.
- Written in machine code (binary) and corresponds to specific operations.
- Examples:
- Load data from memory
- Add numbers in two registers
- Compare two values
- Each CPU has its own instruction set (e.g., x86, ARM).
Embedded Systems
- Definition: A computer system designed for a specific dedicated function.
- Differences from general-purpose computers:
- Purpose-built for one task rather than multiple tasks.
- Often smaller, cheaper, and more power-efficient.
- Common examples:
- Domestic appliances (microwave ovens, washing machines)
- Cars (engine control units, airbags)
- Security systems (CCTV, alarms)
- Lighting control systems
- Vending machines
- Advantages:
- Reliable for specific function
- Low power consumption
- Smaller and cheaper than general-purpose PCs
- Disadvantages:
- Cannot easily be reprogrammed for new tasks
- Limited functionality compared to general-purpose computers
