Top Banner
Pipelining II Andreas Klappenecker CPSC321 Computer Architecture
31

Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Dec 19, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Pipelining II

Andreas KlappeneckerCPSC321 Computer

Architecture

Page 2: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Basic Idea

Page 3: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Non-Pipelined vs. Pipelined Execution

Page 4: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Pipelining - Ideal Preconditions Instruction set design

ideally, instructions are of equal length few instruction formats memory operands only in load and stores aligned data: only one memory access per load

Sources of problems instructions with variable lengths (memory

needs to be accessed multiple times) unaligned data (multiple memory accesses to

obtain single data item)

Page 5: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Hazards Structural Hazards

hardware cannot support the combination of instructions in the same clock cycle

e.g. accessing the memory at the same time Control Hazards

need to make decision based on results of one instruction while other is still executing

e.g. branching Data Hazards

instruction depends on results of instruction still in pipeline

Page 6: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Control Hazards Solutions:

stalling: delay by one cycle to wait for result

prediction: predict the result delayed decision: rearrange and

perform operations first that do not harm

Page 7: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Stall on Branch Assume that all branch computations

are done in stage 2 Delay by one cycle to wait for the result

Page 8: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Branch Prediction

Page 9: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Delayed Branch

Page 10: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Single Cycle Datapath

Page 11: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Problems Write back data to register file

may create data hazard Selection of the next PC

may create a control hazard Solutions:

have a separate data path for each instruction (not really, you got to be kidding!)

chop data path into small pieces keep everything that belongs together into one

piece introduce registers to separate the stages

Page 12: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Pipelined Version

Pipeline separation registers, width varies

Page 13: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 14: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 15: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 16: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 17: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 18: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Store Word Instruction fetch: as before decode & register file read: as before execute and address calculation: as

before forwarding of register contents to EX/MEM

pipelining register Memory access

send data and address to memory Last step: nothing happens

Page 19: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 20: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 21: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Summary Some instructions do not require the

complete datapath No information transfer from one

pipeline stage to another is possible, except through pipeline registers

Everything that happened in any previous stage will be overwritten

Correction for store required: Where is the information on the write register?

Page 22: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 23: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 24: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 25: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 26: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 27: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 28: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 29: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.
Page 30: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Pipeline Control Data is traveling along the pipeline

stages All data belonging to one instruction

must be kept within that stage Information transfer only through

pipeline registers Control information must travel with

the instruction

Page 31: Pipelining II Andreas Klappenecker CPSC321 Computer Architecture.

Outlook Control for pipelined architecture Effect of various hazards Superscalar architectures

issue multiple instructions per cycle Dynamic pipeline scheduling

rescheduling of instructions by hardware to avoid pipeline stalls

Intel architectures