You are on page 1of 18

Central Processing Unit (CPU)

Objectives
a) Understand core functions of “CPU
components”
b) Explain data transfer to and from memory

c) Identify CPU’s Program Execution cycle

Source: Feleke Merin (Dr. –Eng.) 1


Computer hardware (subsystems)

Source: Feleke Merin (Dr. –Eng.) 2


Central Processing Unit (CPU)

• CPU performs operations on data.


1. ALU 2. Control Unit 3. A set of registers

Source: Feleke Merin (Dr. –Eng.) 3


CPU (contd.)

Arithmetic Logic Unit


Arithmetic Logic Unit performs the f/g operations:
• Arithmetic operations: • Logical operations:
– Increment – NOT
– Decrement – AND
– Add – OR
– Subtract – XOR
– Multiply
– Divide

Source: Feleke Merin (Dr. –Eng.) 4


CPU (contd.)

Registers
 Fast stand-alone storage locations that hold
data temporarily in CPU.

 A special, high-speed storage area within the


CPU. All data must be represented in a register
before it can be processed.
 For example, if two numbers are to be multiplied,
both numbers must be in registers, and the result is
also placed in a register.

Source: Feleke Merin (Dr. –Eng.) 5


CPU (contd.)

Registers (contd.)
 Types
– PC (Program Counter)
• Keep track of the instruction currently being
executed.
• Incremented after execution of the instruction.
– Instruction Register
• Store the instruction currently being executed
– Data Registers
• Hold data before it can be processed

Source: Feleke Merin (Dr. –Eng.) 6


CPU (contd.)

Registers (contd.)
• The power and speed of a CPU determined by
– the number of registers that a CPU has and
– the size of each (number of bits)

– For example a 32-bit CPU is one in which


each register is 32 bits wide. Therefore, each
CPU instruction can manipulate 32 bits of
data.

Source: Feleke Merin (Dr. –Eng.) 7


CPU (contd.)

Control Unit
• Like the part of the human brain, control unit
controls the operation of each part of the body.

• Controlling is achieved through wires (from


Control unit to ALU) that can be on/off.
• 4 wires  16 operations

Source: Feleke Merin (Dr. –Eng.) 8


Main Memory

• Main memory –
– a collection of storage locations,
– each with a unique identifier called the address.

• Word-
– Data are transferred to and from memory in
groups of bits called words.
– The number of bits that can be stored in one
CPU register in a computer.

Source: Feleke Merin (Dr. –Eng.) 9


Main Memory (contd.)

Source: Feleke Merin (Dr. –Eng.) 10


Program Execution

• General–purpose computers use a set of


instructions called a program to process data.
• Both the program and the data are stored in
memory.
• The CPU uses repeating machine cycles to
execute instructions in the program, one by one.
• A simplified cycle consists of:
1. Fetch
2. Decode
3. Execute

Source: Feleke Merin (Dr. –Eng.) 11


Steps of a cycle

Source: Feleke Merin (Dr. –Eng.) 12


Machine Cycle

1.Fetch
– IRMemory[PC]
– PC++
2.Decode
– [IR] gets decoded by control unit
3.Execute
– Control unit sends the task-orders to other
components.

Source: Feleke Merin (Dr. –Eng.) 13


Contents of memory and register before execution

 IRMemory[070]
PC++
Source: Feleke Merin (Dr. –Eng.) 14
Contents of memory and registers after each cycle

 R1Memory[200]
 IRMemory[071]
PC++

Source: Feleke Merin (Dr. –Eng.) 15


Contents of memory and registers after each cycle

 R2Memory[201]
 IRMemory[072]
PC++

Source: Feleke Merin (Dr. –Eng.) 16


Contents of memory and registers after each cycle

 R3R1+R2
 IRMemory[073]
PC++

Source: Feleke Merin (Dr. –Eng.) 17


Contents of memory and registers after each cycle

 Memory[202]R3
 IRMemory[074]
PC++

Source: Feleke Merin (Dr. –Eng.) 18

You might also like