Download presentation
Presentation is loading. Please wait.
1
Midterm Thursday let the slides be your guide Topics: First Exam - definitely cache,.. Hamming Code External Memory & Buses - Interrupts, DMA & Channels, RAID,.. OS Support - Managing Resources, Scheduling, Memory Management,.. Pipelining - Phases, Gains, Hazards, Stalling,..
2
MIPS (RISC) Pipelining (We will use MIPS as a practical example of RISC Pipelining) (Microprocessor without Interlocked Pipeline Stages)
3
Recall Key Features of RISC —Limited and simple instruction set —Memory access instructions limited to memory registers —Operations are register to register —Large number of general purpose registers (and use of compiler technology to optimize register use) —Emphasis on optimising the instruction pipeline (& memory management) —Hardwired for speed (no microcode)
4
Pipelining Review Pipelining: — Break instruction cycle into n phases (one stage per phase) –e.g. Fetch, Decode, ReadOPs, Execute1, Execute2, WriteBack — Fetch a new instruction each phase — Maximum speed gain is n — Hazards reduce the ability to achieve a gain of n –Types of Hazards +Resource oHazard occurs when instruction needs a resource being used by another instruction +Data oRAW (hazard if read can occur before write has finished) oWAR (hazard if write can occur before read is finished) oWAW (hazard if writes occur in the unintended order) +Control oHazard occurs when a wrong fetch decision at a branch results in an extra instruction fetch and a pipeline flush — Stalling can always “fix” a hazard
5
Data Hazards Read after Write (RAW) – true dependency — A Hazard occurs if the Read occurs before the Write is complete –e.g. Reg 1 Reg 1 + Reg 2 {write occurs after execution} Reg 3 reg 1 – Reg 3 {read occurs before execution} Write after Read (WAR) – anti-dependency — A Hazard occurs if the Write occurs before the Read happens –e.g. Reg M(ptr) {2 memory accesses – long read} {M(ptr) & M(pc) are same loc} M(pc) Reg {1 memory access – short write} Write after Write (WAW) – output dependency — A Hazard occurs if the two Writes occur in the reverse order than intended –e.g. Reg A M(PTR) {2 memory accesses – long write} Reg A Reg B {0 memory accesses – short write}
6
Control Hazard Control Hazards occur when a wrong fetch decision results in a new instruction fetch and the pipeline being flushed Solutions include: — Multiple Pipeline streams — Prefetching the branch target — Using a Loop Buffer — Branch Prediction — Delayed Branch — Reordering of Instructions — Multiple Copies of Registers (backups)
7
MIPS Example MIPS is a good example of a RISC Architecture (relatively simple and real) We will look at how it is organized in terms of Data Paths, and And how its pipelining works
8
MIPS (RISC) Instructions (I type)(FP type) Similar to I and R type J (J type) B (I type)
9
MIPS Instructions
10
MIPS Instruction Formats
11
Basic MIPS Organization Note: Memory is shown as Instruction and Data Memories. This could be a) two memories, b) 2-port memory, or c) simply a model that allows us to picture the process (timing) moving basically from left to right.
12
MIPS Basic Data Paths with Controls Shown
13
MIPS Data Paths with Generation of Control Signals Note: This figure does not show J (jump) type instruction Data Paths
14
MIPS Data Paths with Control Signals (including paths for J-type instructions)
15
MIPS Pipeline Stages
16
MIPS Pipelined Data Paths IF | ID | EX | MEM | WB
17
MIPs Pipelined Machine with Controls IF | ID | EX | MEM | WB (64 bits) (142 bits) (107 bits) (71 bits)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.