Professional Documents
Culture Documents
2
Chapter 2
CPU
Exchanges data with the memory and I/O.
Uses the following registers to exchange data with the memory.
Memory address register (MAR)
next. 3
Instruction register (IR)
5
Chapter 2
Basic Function
Execution of a program
Processing of Instruction consists of two
steps
Fetch
Execute
6
INSTRUCTION CYCLE
Two steps:
Fetch
Execute
7
FETCH CYCLE
Program Counter (PC) holds the address of
next instruction to be fetched.
Processor fetches instruction from memory location
pointed by PC
Increment PC
8
EXECUTE CYCLE
Processor interprets instruction and performs required
actions
Processor-memory
data transfer between CPU and main
memory
Processor -I/O
Data transfer between CPU and I/O
module
Data processing
Some arithmetic or logical operation on
data
Control
Alteration of sequence of execution
e.g. jump
Execution of an instruction may involve a combination of 9
above actions
EXAMPLE OF PROGRAM EXECUTION
10
INTERRUPTS
It’s a mechanism by which other modules (e.g. I/O)
may
interrupt normal processing of the processor.
Interruption of the normal sequence of execution
Provided to improve processing efficiency.
Common classes of interrupts
Program
e.g. overflow, division by zero
Timer
Generated by internal processor timer
Used in pre-emptive multi-tasking
I/O
from I/O controller
Hardware failure
e.g. power failure, memory parity error 11
INTERRUPT CYCLE
Added to instruction cycle
Processor checks for interrupt
Indicated by an interrupt signal
If no interrupt, fetch next instruction
If interrupt pending:
Suspend execution of current program
Save context
Set PC to starting address of interrupt handler
routine
Process interrupt
Restore context and continue interrupted
12
program
INSTRUCTION CYCLE WITH INTERRUPTS
13
TRANSFER OF CONTROL VIA INTERRUPTS
14
MULTIPLE INTERRUPTS
Two approaches to deal with multiple interrupts
Disable interrupts
Processor will ignore further interrupts
whilst processing one interrupt
Interrupts remain pending and are checked after first
interrupt has been processed
Interrupts handled in sequence as they occur
Define priorities
Low priority interrupts can be interrupted by higher
priority interrupts
When higher priority interrupt has been
processed, processor returns to previous interrupt 15
MULTIPLE INTERRUPTS – SEQUENTIAL
DISABLE INTERRUPTS
16
MULTIPLE INTERRUPTS – NESTED
PRIORITIZED INTERRUPTS
17
TIME SEQUENCE OF MULTIPLE INTERRUPTS
18
INTERCONNECTION STRUCTURES
A computer consists of a set of components
All the units must be connected
The collection of paths connecting various units
Interconnection structure
Different type of connection for different type of
unit
Memory
Input / Output
CPU
There are a number of possible
interconnection
structures, the most common are: 19
Single and multiple BUS structures
COMPUTER MODULES
20
MEMORY CONNECTION
Receives and sends data
Receives addresses (of locations)
21
INPUT/OUTPUT CONNECTION
Similar to memory from computer’s viewpoint
Output
Receive data from computer
Send data to peripheral
Input
Receive data from peripheral
Send data to computer
22
CPU CONNECTION
Reads instruction and data
Writes out data (after processing)
23
BUS INTERCONNECTION
What is a BUS ?
A communication pathway connecting two or more
devices
Consists of multiple lines, each line capable of transmitting
signals representing binary 1 or binary 0
24
34
DATA BUS
Carries data
Remember that there is no difference between
“data” and “instruction” at this level
Width is a key determinant of performance
8, 16, 32, 64 bit
25
ADDRESS BUS
26
CONTROL BUS
Control
and timing
information
Memory read/write signal
Interrupt request
Clock signals
27
Operation of bus
If one module wishes to send data to another,
it must
Obtain the use of the bus
Transfer data via the bus
30
Multiple Buses…
A High-speed Bus
Architecture
31
ELEMENTS OF BUS DESIGN
Basic design elements that serves to classify and
differentiate buses:
Bus Types
o Dedicated, Multiplexed
Method of Arbitration
Centralized, Decentralized
Timing
Synchronous, Asynchronous
Bus Width
Address, Data
32
ELEMENTS OF BUS DESIGN…
Bus Types
Dedicated Bus
Functionally dedicated bus
A bus line that is permanently assigned to one function
35
ELEMENTS OF BUS DESIGN…
Method of Arbitration...
Centralized
A single hardware device (bus controller/arbiter)
It may be part of the processor or separate module
Distributed
There is no central controller
Each module contains access control logic
36
ELEMENTS OF BUS DESIGN…
Timing
Buses use either synchronous timing or asynchronous
timing
Synchronous timing
Occurrence of events on the bus is determined by a clock
Control bus includes clock line
37
ELEMENTS OF BUS DESIGN…
Timing...
Synchronous timing
A simplified diagram for synchronous read and write timing
diagram
38
ELEMENTS OF BUS DESIGN…
Timing...
Asynchronous timing
The Occurrence of one event on the bus follows and depends
on the occurrence of a previous events
A simplified diagram for asynchronous read timing diagram
39
ELEMENTS OF BUS DESIGN…
Timing...
Asynchronous timing
A simplified diagram for write timing
asynchronous diagram
40
Processor Structure and Function
The architectural design of the CPU is Reduced instruction set computing
(RISC) and Complex instruction set computing (CISC).
RISC is a computer that only uses simple commands that can be divided into
several instructions that achieve low-level operation within a single CLK cycle.
41
RISC Vs CISC
It has no memory unit and uses a It has a memory unit to
separate hardware to implement implement complex.
instructions. has a microprogramming unit
has a hard-wired unit of instructions.
programming. It is an easy compiler design.
It is a complex compiler design. calculations are slow and
calculations are faster and more precise
precise. decoding of instructions is
decoding of instructions is simple. complex
Execution time is very less. Execution time is very high.
It does not require external memory It requires external memory
for calculations. for calculations.
Pipelining is easy. Pipelining does not function.
Code expansion can be a problem. Code expansion is not a
problem.
42
Applications of RISC and CISC
rt 1
pa
of
nd
E
43