Chapt12Processor Structure and Function.ppt

AhmedJaha 17 views 43 slides Jul 27, 2024
Slide 1
Slide 1 of 43
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43

About This Presentation

Processor Structure and Function


Slide Content

Computer Organization and
Architecture
Designing For Performance
William Stallings
Seventh Edition

Team #5
 -12.1 Processor Organization
 -12.2 Register Organization
 -12.3 Instruction Cycle
 -12.4 Instruction Pipelining/ Dealing with
Branches

12.1 Processor Organization
Fetch Instruction
Interpret instruction
Fetch Data
Process Data
Write Data

Remember….
The processor needs to store some data
temporally.
It must remember the location of the last
instruction so that it can know where to get
the next instruction.
It needs to store instructions and data
temporally while an instruction is being
executed.

CPU with System Bus

CPU Internal Structure

Register Organization
User-visible registers
Control and status registers

User Visible Registers
General Purpose
Data
Address
Condition Codes

General Purpose Registers
Data
Accumulator
Addressing
Segment pointers
Index registers
Stack Pointer

Control & Status Registers
Program Counter
Instruction Decoding Register
Memory Address Register
Memory Buffer Register

Program Status Word
Sign
Zero
Carry
Equal
Overflow
Interrupt enable/disable
Supervisor

Example Register Org.

Instruction Cycle
It is the time in which a single
instruction is fetched from memory,
decoded, and executed
An Instruction Cyclerequires the
following subcycle:

Instruction Cycle
Fetch
Read next instruction from memory into the
processor
Indirect Cycle (Decode Cycle)
May require memory access to fetch operands,
therefore more memory accesses.
Interrupt
Save current instruction and service the interrupt
Execute
Interpret the opcode and perform the indicated
operation

Instruction Cycle
Fetch
Execute
Fetch
Execute
Indirect
Fetch
Execute
Interrupt
Fetch
Execute
IndirectInterrupt

Data Flow (Fetch Diagram)
PC
Control
Unit
PC MARMAR
MemoryMemory
Control
Unit
MBR
Memory
IR MBR

Data Flow (Indirect Diagram)
MBR
MARMAR
Memory
Control
Unit
Memory
MBR
Memory

Data Flow (Execute)
May take many forms
Depends on instruction being executed
May include
Memory read/write
Input/Output
Register transfers
ALU operations

Data Flow (Interrupt Diagram)
Control
Unit
PC
MBR
PC
Control
Unit
MARMAR
Memory
MBR
MemoryMemory
Control
Unit
Control
Unit
PC

12.4 Instruction Pipelining
Instruction processing is subdivided:
-Fetch/ Execute instruction
Pipeline has two independent stages:
1
st
Stage –Fetch an instruction and buffers it.
2
nd
Stage –Temporarily free until first stage passes it the
buffered instruction.
While the second stage is executing the instruction, the
first stage fetches and buffers the next instruction.
Instruction prefetch or fetch overlap.
-Purpose? To speed up instruction execution.

Two-Stage Instruction Pipeline

Instruction Processing
Fetch instruction (FI)
Decode instruction (DI)
Calculate operands (CO)
Fetch operands (FO)
Execute instruction (EI)
Write operand (WO)
Successive instructions in a program sequence
will overlap in execution.

Timing Diagram for Instruction
Pipeline Operation

Six-Stage CPU
Instruction
Pipeline
The logic needed for
pipelining to
account for
branches, interrupts,
and arising
problems.

Alternative Pipeline Depiction

RISC
Pipeline
1.Instruction fetch
2.Instruction decode and register fetch
3.Execute
4.Memory Access
5.Register write back

Branches
Branch-group of instructions
Branch Instructions –(Jump Instruction)
One of it’s operands is the address of the
next instruction to be executed.

Branches
Two Types of Branch Instructions
Unconditional –Branch always happens
Conditional –Branch only happens if certain
condition is met.
The PC is updated to the address specified in
the operand of the conditional branch
instruction.
A conditional branch instruction is similar
to an if statement.

Conditional Branch Instructions
Condition Codes
BRP X
Branch to location X if result is positive
BRZ X
Branch to location X if result is zero
BRE R1,R2,X
Branch to location X if contents of R1 = R2

Conditional Branch Instructions

Dealing with Branches
A major problem in designing an instruction
pipeline is assuring a steady flow of
instructions to the initial stages of the
pipeline.
Since conditional branches alter the steady
flow of instructions, we must come up with
ways to execute them efficiently.

Dealing with Branches
5 Approaches to Dealing with Conditional
Branches
Multiple Streams
Delayed Branch
Prefetch Branch target
Loop Buffer
Branch Prediction

Dealing with Branches
•Multiple Streams (IBM 370/168 and IBM 3033)
Pipeline fetches both instructions.
Leads to contention delays, and branches
can lead to too many streams.
•Delayed Branch
Branch Instruction occurs later than desired.
•Prefetch Branch Target (360/91 IBM)
The target of the branch is prefetched, along
with the instruction following the branch, so if
the branch is taken this will speed up
performance.

Dealing with Branches
Loop buffer ( Motorola 68010)
Memory containing the n most recently fetched
instructions.
Useful with if-then and if-then-else statements,
as well as loops
Branch Prediction
Different techniques are used to predict whether
the branch will be taken or not
If the prediction is correct this will speed up
performance

Dealing with Branches

Intel Pentium Branch
The prediction of whether a jump will
occur or not, is based on the branch’s
previous behavior. There are four
possible states that depict a branch’s
disposition to jump:
Stage 0: Very unlikely a jump will
occur
Stage 1: Unlikely a jump will occur
Stage 2: Likely a jump will occur
Stage 3: Very likely a jump will occur

Intel Pentium Branch
It is actually believed
that Pentium’s original
algorithm for branch
prediction was
incorrect. (Left)

Research
http://www.it.jcu.edu.au/Subjects/cp1300/resources/lectno
tes/system/fde.html
http://dr-pisit.com/csc331/Lec10-CPU&Pipeline.pdf
http://en.wikipedia.org/wiki/Instruction_pipelining
http://www.itreviews.co.uk/hardware/h738.htm

Review Questions
1. What are the major components of a processor?
2. What is the function of the ALU?
3. What is the function of the control unit?
4. What are the two roles that registers in the processor
perform?
5. What are bits set by the processor hardware as a result
of operations?
6. What is an instruction cycle?
7. What are the four subcycle of an instruction cycle?

8. Is the fetch or execute cycle the same for all CPU?
9. What is the sequence of an interrupt cycle?
10. What is the main purpose for instruction pipelining?
11. How can you make the pipelining more efficient?
12. What is a condition code?
13. What is another name for a branch instruction?

Answers
1.Arithmetic and Logic Unit (ALU) and the Control Unit (CU).
2.The ALU does the actual computation or processing of data.
3.The control unit controls the movement of data and
instructions into and out of the processor and controls the
operations of the ALU.
4.User-visible registers, and control and status registers.
5.Condition codes.
6.It is the time in which a single instruction is fetched from
memory, decoded, and executed.
7.Fetch, Indirect (if any) , execute, and interrupt (if any).

8.No, it depends on the CPU’s design.
9.PC MBR
Address of Stack MAR
MAR Memory
PC Memory
Control Unit request memory write via Control Bus
PC is loaded with address of Interrupt handler
10.To speed up the instruction execution rate.
11.To gain further speedup, the pipeline must have more stages
for decomposition.
12.A statement that if true will allow the branch to be
executed.
13.A jump instruction.
Tags