C4 02 - Cpu
C4 02 - Cpu
System Unit
Power Supply
Storage Devices
Motherboard
Peripherals
1 The Components of a Computer
System Unit
A case contains circuit boards, a power supply and storage
devices
Floppy disk drive
DVD-ROM drive
Display card
Motherboard
Hard disk drive
Main memory
A system unit
1 The Components of a Computer
Motherboard
The main circuit board in the system unit.
Provide sockets for CPU, memory chips and expansion slots.
Contain circuitry that connects the components together.
1 The Components of a Computer
Peripherals
Hardware devices connected to the system unit.
Monitor
Scanner
Broadband
modem Mouse
Speaker
Keyboard
USB flash
drive
Digital video
camera
Peripherals Printer Microphone
2 Central Processing Unit (CPU)
What is a CPU?
‘Brain’ of a computer.
Executes the instructions of a computer program.
Processes data to do a specific tasks.
The processing power of the CPU usually determines the overall
performance of a computer.
Most devices communicate with the CPU to carry out certain
tasks.
CPU communicates with other devices through bus lines.
Microprocessor in a personal
computer
CPU Simulator
https://tools.withcode.uk/cpu/
CPU of a mainframe computer
2 Central Processing Unit (CPU)
What is a CPU?
Major Components
Arithmetic and logic unit (ALU)
Control unit (CU)
Registers
2 Central Processing Unit (CPU)
+ OR
- AND
X
÷ NOT
2 Central Processing Unit (CPU)
Registers
Memory units inside a CPU.
Provide storage space for ALU and CU.
Small number of registers
Fastest way for a CPU to access data
Three types of register:
General purpose registers
Control registers
Status registers
2 Central Processing Unit (CPU)
Control Registers
Provide temporary memory for CU to control the operation of
instructions.
Major control registers:
Instruction Register (IR)
Program Counter (PC)
Memory Address Register (MAR)
Memory Data Register (MDR)
2 Central Processing Unit (CPU)
Control Registers
Instruction Register (IR)
Contains the instructions to be executed by the CPUs
Program Counter (PC)
Contains the memory address of the next instruction to be executed.
Memory Address Register (MAR) and Memory Data Register
(MDR)
Facilitate the communication of the CPU with the main memory
through the system bus.
MAR holds the address of the memory location.
MDR contains the data to be written into or read from the location
specified in MAR.
2 Central Processing Unit (CPU)
Control Registers
6. The instruction in
MDR is then
loaded into IR
for execution.
5. The main
memory returns
the addressed
data to MDR via
the data bus.
Status Registers
Contain a number of flag bits indicating the status after the
execution of instructions
Used in instructions of conditional testing and program branching
2 Central Processing Unit (CPU)
Status Registers
Essential flags in the status register of CPU 8088
O S Z P C
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Zero flag (Z): Set to 1 if the evaluated result is zero; set to 0 otherwise.
Sign flag (S): Set to 1 if the evaluated result is negative; set to 0 otherwise.
Parity flag (P): Set to 1 if the evaluated result is an odd parity.
Carry flag (C): Set to 1 if the evaluated result contains a carry; set to 0
otherwise.
Overflow flag (O): Set to 1 if the evaluated result has overflowed. (i.e. the
resulting value is too large to be stored in the memory unit)
2 Central Processing Unit (CPU)
System Bus
Also know as bus line
Physical wiring that connects the various components of a
computer system
Transmit data between the CPU and other components
Bus type Function
System Bus
Size of a bus = bus width
Bus width determines the number of bits of data the computer
can transmit at one time.
System Bus
System Bus
2 Central Processing Unit (CPU)
System Bus
Machine Cycle
Process of executing an instruction in a CPU
Sub-cycle Description
Machine Cycle
Machine Cycle
Interrupt Sub-cycle
At the end of the execution of an instruction, the CPU detects
whether an interrupt has occurred.
Word Length
Number of bits of data and instructions the CPU
can handle at one time
Advantage of longer word length:
More data can be processed in one time. A 64-bit CPU
More instructions can be included in the instruction set.
instruction set.
4 Measurement of CPU Speed
What is a multi-core processor?
Dual core
Contain two interconnected CPU cores working hand-in-hand.
Quad core
Intel Core 2 Duo processor
Contains four interconnected CPU cores
Main Memory
Accessible to the CPU of a computer without using other I/O
channels.
The memory chips are installed on the motherboard.
Used to store data
Used to store instructions that CPU will execute
2 major types:
Random access memory (RAM)
A RAM module
5 Main Memory
DRAM SRAM
Speed (clock rate) Lower Higher
Memory cards –
typical example of
flash memory
6 Other Memory
Cache Memory
High-speed memory
Store data and instructions that have been recently used by the
CPU
Integrated into a CPU or resided close to a CPU
Virtual Memory
Use of secondary storage as additional primary memory
Swapping
Enable data that is in RAM and not currently being used to be transferred to
the hard disk
free up room in RAM for other programs and data
When the data on the hard disk is needed
again, any other unused data is transferred
to the hard disk before the original data is
transferred back to RAM
Types of Computer
• Come in all sorts of shapes and sizes
• Do you know…
• What are desktop PCs and laptops
• mobile phone is a computer!
• Computer can be as large as a room?!
Embedded Systems
• A special-purpose computer encapsulated by a larger
system
• Single microchip that control many equipment
• Everyday mechanisms – e.g. wireless devices, cars, climate
control systems, traffic signals, and washing machines
• Complex systems – e.g. space mission controls, avionics, and
weapons systems
• Perform one or a few pre-defined tasks, with very
specific requirements
• Include task-specific hardware and mechanical parts not
usually found in a PC
• Optimized in size and cost (reduced)
• Mass-produced, benefiting from economies of scale