You are on page 1of 24

DIGITAL LOGIC AND

COMPUTER ORGANIZATION
Lecture 19: Pipelined Microprocessor (P3)
ELEC3010
ACKNOWLEGEMENT

I would like to express my special thanks to Professor Zhiru Zhang


School of Electrical and Computer Engineering, Cornell University
and Prof. Rudy Lauwereins, KU Leuven for sharing their teaching
materials.

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

❑ Instruction set architecture


❑ Processor organization Computer
❑ Caches and virtual memory
❑ Input/output Organization
❑ Advanced topics
3
PIPELINE CONTROL UNIT (CU)

4
PIPELINE CONTROL REQUIREMENTS
❑ Generate control signals for each stage
▪ IF: PCJ
▪ EX: MB, F
▪ MEM: MW, MD
▪ WB: LD
❑ Detect forwarding conditions and generate MUX control
signals
❑ Detect data hazards and insert pipeline bubbles
▪ Assumes no load delay slot defined in ISA
❑ Assume branch delay slot defined in ISA
5
GENERATING CONTROL FOR EACH STAGE

6
FORWARDING UNIT (PARTIAL)

7
R-TYPE TO R-TYPE FORWARDING

8
ANOTHER EXAMPLE: R-TYPE TO R-TYPE FORWARDING

9
R-TYPE TO R-TYPE FORWARDING CONDITIONS

❑ MEM➞EX
▪ MEM.DR == (EX.SA || EX.SB)

❑ WB➞EX
▪ WB.DR == (EX.SA || EX.SB) and
▪ MEM.DR != (EX.SA || EX.SB)

❑ WB➞ID
▪ WB.DR == (ID.SA || ID.SB)
10
R-TYPE TO BRANCH FORWARDING

11
PIPELINE WITH FWDING + BRANCH HW IN ID

12
DATA HAZARDS REQUIRING BUBBLES

❑ Occur when instructions are too close together for


forwarding to work
❑ Requires adding bubbles in the pipeline
❑ Data hazard conditions to detect and handle
▪ Load followed by R-type
▪ Load followed by I-type ALU instruction
▪ Load followed by Load
▪ Load followed by Store
▪ Load followed by Branch
▪ ALU instruction followed by Branch

13
CAN YOU DO IT?
❑ Assume HW forwarding and NO delay slot for load
❑ 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 R2, 0(R1)
ADDI R3, R2, 1
BEQ R2, R1, X
SW R3, 4(R1)
X: some inst

14
LOAD FOLLOWED BY R-TYPE INSTRUCTION

15
LOAD FOLLOWED BY R-TYPE INSTRUCTION

16
LOAD FOLLOWED BY R-TYPE INSTRUCTION

17
LOAD FOLLOWED BY R-TYPE INSTRUCTION

18
LOAD FOLLOWED BY R-TYPE INSTRUCTION

19
LOAD FOLLOWED BY R-TYPE INSTRUCTION

20
HAZARD DETECTION UNIT (PARTIAL)

21
PIPELINE WITH DATAPATH AND CONTROL

22
LOAD FOLLOWED BY BRANCH INSTRUCTION

23
BEFORE NEXT CLASS

• H&H 8-8.3
• Next time:
Caches

24

You might also like