0% found this document useful (0 votes)
15 views38 pages

C4 02 - Cpu

The document outlines the fundamental components of a computer, including the system unit, motherboard, CPU, and peripherals. It details the functions of the CPU, its major components like the ALU and CU, and the types of memory such as RAM and ROM. Additionally, it discusses CPU speed measurements, machine cycles, and the concept of embedded systems.

Uploaded by

chelsiezhou88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views38 pages

C4 02 - Cpu

The document outlines the fundamental components of a computer, including the system unit, motherboard, CPU, and peripherals. It details the functions of the CPU, its major components like the ALU and CU, and the types of memory such as RAM and ROM. Additionally, it discusses CPU speed measurements, machine cycles, and the concept of embedded systems.

Uploaded by

chelsiezhou88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

1 The Components of a Computer

 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

CPU Power supply

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?

The role of a CPU


2 Central Processing Unit (CPU)

 Major Components
 Arithmetic and logic unit (ALU)
 Control unit (CU)
 Registers
2 Central Processing Unit (CPU)

 Control Unit (CU)


 Keep track of the sequence of instructions being processed
 Monitors and coordinates all I/O operations and system units

How the ALU and the CU


execute an addition
instruction
2 Central Processing Unit (CPU)

 Arithmetic and Logic Unit (ALU)


 Perform arithmetic and logical operations
 Use registers to hold data during calculations
 Results are usually stored in a register called an accumulator (AX)

+ 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)

 General Purpose registers (GPRs)


 Mainly used by instructions of assembly and machine code
programs.
 Examples of general purpose registers:
 Accumulator (AX)
 Base register (BX)
 Counter (CX)
 Data register (DX)
2 Central Processing Unit (CPU)

 General Purpose registers (GPRs)


 Functions of GPRs and the corresponding examples

Example of assembly instructions


Function
Instruction Explanation

Load data from main


LOAD AX, 8 Store 8 in register AX.
memory into a register.

Store data temporarily in Add the value stored in CX to that


ADD BX, CX
arithmetic operations. in BX, and store the sum in BX.

Store the data in register AX to the


Store data from a register
STORE ANS, AX main memory address variable
into main memory.
ANS.
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.

4. MAR passes the


Execution process of program instructions
address to the
1. Control unit 2. Control unit sends a 3. PC copies the main memory
issues a READ control signal address of the via the address
command to to the main required bus.
load the next memory via the instruction to
instruction. control bus MAR.
2 Central Processing Unit (CPU)

 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

Data bus Transfer data and instructions.

Address Transfer the source address or the destination address of


bus data.

Indicate the direction of the data transfer and coordinate the


Control bus
timing of the event during transfer.

Functions of data bus, address bus and control bus


2 Central Processing Unit (CPU)

 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

Interconnection of computer units by system bus


2 Central Processing Unit (CPU)

 Von Neumann architecture


 Theoretical model published by John von Neumann in 1945
 Instructions and data area stored in the same memory as
binary values = stored program concept
 Instructions are executed sequentially – one instruction at a
time is fetched from the memory and passed to the CPU
3 Machine Cycle

 Machine Cycle
 Process of executing an instruction in a CPU

Sub-cycle Description

Read the next instruction from the main memory into


Fetch
instruction register (IR).

Decode Identify the operation code and operands in an instruction.

Interpret the operation code and perform the required


Execute
operation.

Sub-cycles of a machine cycle


3 Machine Cycle

 Machine Cycle

Process of a machine cycle


3 Machine Cycle

 Machine Cycle
 Interrupt Sub-cycle
 At the end of the execution of an instruction, the CPU detects
whether an interrupt has occurred.

1. CPU saves the


If have current process Interrupt CPU resumes the
End of execution of interrupt status served operation of the
an instruction 2. Handles the next instruction of
interrupt the active process
immediately
4 Measurement of CPU Speed
 Clock Rate
 Measure speed of CPU
 Measurement unit: megahertz (MHz) or gigahertz (GHz)
 1 hertz = 1 clock cycle per second

 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.

 More complicated instructions can be included in the

instruction set.
4 Measurement of CPU Speed
What is a multi-core processor?
 Dual core
 Contain two interconnected CPU cores working hand-in-hand.

 Provide better performance in decoding, instruction execution


and system bus management.
 Lower power consumption and lower clock rate.

 Quad core
Intel Core 2 Duo processor
 Contains four interconnected CPU cores

 Becomes more and more popular in


high-end servers and desktop computers.

Intel Quad Core processor


5 Main Memory

 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)

 Read-only memory (ROM)


5 Main Memory

 Random Access Memory (RAM)


 Temporarily hold the data and instructions of application software
and the operation system
 Volatile = all data stored in RAM disappears instantly after the
computer is turned off
 Access time is just a hundredth of hard disk
 Measurement units: bytes (B), kilobytes (KB), megabytes (MB),
gigabytes (GB), terabytes (TB)

A RAM module
5 Main Memory

 Random Access Memory (RAM)


 Two main streams:
 Dynamic random access memory (DRAM)

 Static random access memory (SRAM)

DRAM SRAM
Speed (clock rate) Lower Higher

Cost Lower Higher

Power consumption Higher than SRMA Lower than DRAM

Storage capacity Smaller Larger

Computer main memory, CPU cache, hard disk


Application
game console buffer, printer buffer, PDA

Characteristics of DRAM and SRAM


Example 5

The following dialogue boxes of a computer show the


capacity of RAM and the memory usage of various
computer applications.
5 Main Memory

 Read-only Memory (ROM)


 Store the permanent information supplied by the manufacturer
 Contain the bootstrap program which loads and initializes the
operation system of the computer.
 Store basic input/output system (BIOS)
 Non-volatile
 Variants of ROM:
 Erasable programmable ROM (EPROM)

 Electrically erasable programmable ROM (EEPROM)

A ROM chip installed


on a motherboard
5 Main Memory
Flash memory

 One type of EEPROM


 Data can be read from and written to it at very high speed.
 Can have a capacity of over 1 TB.
 Features of light weight and high durability make flash memory a
replacement of portable storage media such as a floppy disk, CD-R
and removable hard disk.

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

Acquires the data


Found and proceeds to the
Searches next task
CPU requests cache
an instruction memory first
or data in a very
short time Look up in the
Not
main memory
found
6 Other Memory

 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

You might also like