Tải bản đầy đủ (.pdf) (63 trang)

kiến trúc máy tính phạm minh cường chương ter4 part2 the processorsinhvienzone com

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.4 MB, 63 trang )

Computer Architecture
Chapter 4: The Processor Part 2

Dr. Phạm Quốc Cường
Adapted from Computer Organization the Hardware/Software Interface – 5th

Computer Engineering – CSE – HCMUT
CuuDuongThanCong.com

/>
1


Single-cycle Datapath

Chapter 4 — The Processor — 2
CuuDuongThanCong.com

/>

(Multi-cycle) Pipelined Datapath
• Up to five instruction will be in execution in
one clock cycle
• Separate the datapath into five pieces:
– IF: Instruction fetch
– ID: Instruction decode and register file read
– EX: Execution and address calculation
– MEM: Data memory access
– WB: Write back
3
CuuDuongThanCong.com



/>

Five Stage Datapath

4
CuuDuongThanCong.com

/>

Instructions Execution

5
CuuDuongThanCong.com

/>

Pipeline registers
• Need registers between stages
– To hold information produced in previous cycle

Chapter 4 — The Processor — 6
CuuDuongThanCong.com

/>

Pipeline Operation
• Cycle-by-cycle flow of instructions through the
pipelined datapath
– “Single-clock-cycle” pipeline diagram

• Shows pipeline usage in a single cycle
• Highlight resources used

– c.f. “multi-clock-cycle” diagram
• Graph of operation over time

• We’ll look at “single-clock-cycle” diagrams for
load & store
Chapter 4 — The Processor — 7
CuuDuongThanCong.com

/>

IF for Load, Store, …

Chapter 4 — The Processor — 8
CuuDuongThanCong.com

/>

ID for Load, Store, …

Chapter 4 — The Processor — 9
CuuDuongThanCong.com

/>

EX for Load

Chapter 4 — The Processor — 10

CuuDuongThanCong.com

/>

MEM for Load

Chapter 4 — The Processor — 11
CuuDuongThanCong.com

/>

WB for Load

Wrong
register
number
Chapter 4 — The Processor — 12
CuuDuongThanCong.com

/>

Corrected Datapath for Load

Chapter 4 — The Processor — 13
CuuDuongThanCong.com

/>

EX for Store


Chapter 4 — The Processor — 14
CuuDuongThanCong.com

/>

MEM for Store

Chapter 4 — The Processor — 15
CuuDuongThanCong.com

/>

WB for Store

Chapter 4 — The Processor — 16
CuuDuongThanCong.com

/>

Multi-Cycle Pipeline Diagram
• Form showing resource usage

Chapter 4 — The Processor — 17
CuuDuongThanCong.com

/>

Multi-Cycle Pipeline Diagram
• Traditional form


Chapter 4 — The Processor — 18
CuuDuongThanCong.com

/>

Single-Cycle Pipeline Diagram
• State of pipeline in a given cycle

Chapter 4 — The Processor — 19
CuuDuongThanCong.com

/>

Pipelined Control (Simplified)

Chapter 4 — The Processor — 20
CuuDuongThanCong.com

/>

Pipelined Control
• Control signals derived from instruction
– As in single-cycle implementation

Chapter 4 — The Processor — 21
CuuDuongThanCong.com

/>

Pipelined Control


Chapter 4 — The Processor — 22
CuuDuongThanCong.com

/>

Data Hazards in ALU Instructions
• Consider this sequence:
sub
and
or
add
sw

$2, $1,$3
$12,$2,$5
$13,$6,$2
$14,$2,$2
$15,100($2)

• We can resolve hazards with forwarding
– How do we detect when to forward?

Chapter 4 — The Processor — 23
CuuDuongThanCong.com

/>

Dependencies & Forwarding


Chapter 4 — The Processor — 24
CuuDuongThanCong.com

/>

Detecting the Need to Forward
• Pass register numbers along pipeline
– e.g., ID/EX.RegisterRs = register number for Rs sitting in
ID/EX pipeline register

• ALU operand register numbers in EX stage are given
by
– ID/EX.RegisterRs, ID/EX.RegisterRt

• Data hazards when
1a. EX/MEM.RegisterRd = ID/EX.RegisterRs
1b. EX/MEM.RegisterRd = ID/EX.RegisterRt
2a. MEM/WB.RegisterRd = ID/EX.RegisterRs
2b. MEM/WB.RegisterRd = ID/EX.RegisterRt
Chapter 4 — The Processor — 25
CuuDuongThanCong.com

/>
Fwd from
EX/MEM
pipeline reg
Fwd from
MEM/WB
pipeline reg



×