DigitalLogic ComputerOrganization L18 PipelinedProcessorP2 Handout
DigitalLogic ComputerOrganization L18 PipelinedProcessorP2 Handout
COMPUTER ORGANIZATION
Lecture 18: Pipelined Microprocessor (P2)
ELEC3010
ACKNOWLEGEMENT
2
COVERED IN THIS COURSE
❑ Binary numbers and logic gates
❑ Boolean algebra and combinational logic
❑ Sequential logic and state machines
❑ Binary arithmetic
Digital logic
❑ Memories
4
REVIEW: DATA HAZARD PROBLEM
5
REVIEW: COMPILER INSERTS NOPS (SOLUTION 1)
6
EXAMPLE: DATA HAZARDS
❑ How many NOPs need to be inserted to avoid data
hazards in the following instruction sequence
8
SOLUTION 3: HW FORWARDING (BYPASSING)
10
PIPELINED MICROPROCESSOR W/O FORWARDING
11
PIPELINED PROCESSOR WITH FORWARDING
12
FORWARDING IN ACTION
13
FORWARDING IN ACTION
14
FORWARDING IN ACTION
15
HW FORWARDING
16
EXAMPLE: DATA HAZARDS W/O FORWARDING
❑ Identify all data hazards in the following instruction
sequences by circling each source register that is read
before the updated value is written back
17
EXAMPLE: DATA HAZARDS W/ FORWARDING
❑ Identify all data hazards in the following instruction
sequences by circling each source register that is read
before the updated value is written back
LW R1, 0(R2)
OR R4, R1, R3
SUB R5, R2, R1
19
DATA HAZARDS CAUSED BY LOAD
20
LOAD INSTRUCTIONS AND FORWARDING
21
SOLUTION 2: HW STALLS THE PIPELINE
22
SOLUTION 3: DELAY SLOTS
23
EXAMPLE 1: FILLING THE LOAD DELAY SLOT
24
EXAMPLE 2: FILLING THE LOAD DELAY SLOT ?
The ADDI instruction cannot be moved to the delay slot due to data dependence on AND
25
THE PROBLEM WITH BRANCHES
26
THE PROBLEM WITH BRANCHES
27
CONTROL HAZARD
28
REDUCING THE BRANCH DELAY
29
EVALUATING BRANCH CONDITION IN ID STAGE
30
BRANCH DELAY SLOT
31
FILLING THE BRANCH DELAY SLOT WITH A NOP
32
FILLING THE BRANCH DELAY SLOT
33
BRANCH TARGET ADDRESS (PC+2+OFF)
34
CAN YOU DO IT?
35
BEFORE NEXT CLASS
• Next time:
More Pipelined Microprocessor
36