Constructive Computer Architecture Tutorial 6 Five Details of

  • Slides: 77
Download presentation
Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright 6. S

Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright 6. S 195 TA October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -1

Introduction Lab 6 involves creating a 6 stage pipelined SMIPS processor from a 2

Introduction Lab 6 involves creating a 6 stage pipelined SMIPS processor from a 2 stage pipeline n This requires a lot of attention to architectural details of the processor, especially at the points of interaction between the stages. This tutorial will cover some details of the SMIPS architecture that will be useful for the current and future labs October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -2

6 stage SMIPS pipeline Register File f. Epoch IFetch PC October 7, 2013 Redirect

6 stage SMIPS pipeline Register File f. Epoch IFetch PC October 7, 2013 Redirect Decode IMem RFetch Scoreboard Exec e. Epoch http: //csg. csail. mit. edu/6. s 195 Memory WB DMem T 05 -3

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -4

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -5

Processor State The processor state is (PC, RFile, Mem) Instructions can be seen as

Processor State The processor state is (PC, RFile, Mem) Instructions can be seen as functions of a processor state that return the new processor state n addi(PC, RFile, Mem) = (PC+4, RFile’, Mem) w RFile’ is RFile updated with the result of the addi instruction The instruction memory can be seen as a function of PC that returns Instructions n October 7, 2013 Imem: (PC) -> ( (PC, Rfile, Mem) -> (PC, RFile, Mem) ) http: //csg. csail. mit. edu/6. s 195 T 05 -6

Processor State If your SMIPS processor from lab is not working: n Was an

Processor State If your SMIPS processor from lab is not working: n Was an instruction executed on the wrong processor state? w RAW hazards w Not using the right PC in the execute stage n Was the wrong instruction executed? w A wrong path instruction from branch misprediction updated the processor state October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -7

Processor State Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec

Processor State Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Green blocks make up the processor state. All other state elements make sure the right processor state is used to compute instructions, and to make sure the right instructions are executed. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -8

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -9

Poisoning Instructions Why poison? It’s a way to mark that an instruction should be

Poisoning Instructions Why poison? It’s a way to mark that an instruction should be killed at a later stage. n This mark could be as simple as using an invalid value in a maybe data type Instructions are poisoned when epochs don’t match Why not kill in place? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -10

Kill-In-Place Pipeline Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec

Kill-In-Place Pipeline Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Scoreboard entries need to be removed when instructions are killed. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -11

Kill-In-Place Pipeline Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec

Kill-In-Place Pipeline Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Both Exec and WB try to call sb. remove(). This will cause Exec to conflict with WB. Also, the scoreboard implementation doesn’t allow out-of-order removal. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -12

Poisoning Pipeline Register File f. Epoch IFetch Redirect Decode RFetch Scoreboard Exec Memory Poison

Poisoning Pipeline Register File f. Epoch IFetch Redirect Decode RFetch Scoreboard Exec Memory Poison PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 WB Kill DMem T 05 -13

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -14

ASAP Prediction Correction Different instructions that affect the program flow can be resolved at

ASAP Prediction Correction Different instructions that affect the program flow can be resolved at different times n n n Absolute Jumps – Decode Register Jumps – RFetch Branches – Exec You can save cycles on each misprediction by correcting the PC once you have computed what the next PC should have been. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -15

ASAP Prediction Correction Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard

ASAP Prediction Correction Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem This is the general idea, we want Decode, RFetch, and Exec to be able to correct the PC October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -16

ASAP Prediction Correction How is this actually done? How do you keep from allowing

ASAP Prediction Correction How is this actually done? How do you keep from allowing wrong path instructions to update the PC? How do you keep track of everything? How? n October 7, 2013 More Epochs! http: //csg. csail. mit. edu/6. s 195 T 05 -17

ASAP Prediction Correction Register File f. Epoch IFetch PC Redirect Decode IMem Scoreboard RFetch

ASAP Prediction Correction Register File f. Epoch IFetch PC Redirect Decode IMem Scoreboard RFetch d. Epoch rf. Epoch Exec e. Epoch Memory WB DMem Decode, RFetch, and Exec each have their own epoch. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -18

ASAP Prediction Correction Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard

ASAP Prediction Correction Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Each epoch acts just like e. Epoch does October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -19

Correcting PC in Execute October 7, 2013 http: //csg. csail. mit. edu/6. s 195

Correcting PC in Execute October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -20

Correcting PC in Execute Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard 4 RFetch 3 Exec Mispredicted PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 2 1 Memory WB Write Back DMem T 05 -21

Correcting PC in Execute Register File f. Epoch 1 IFetch Redirect 6 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 1 IFetch Redirect 6 Decode Scoreboard 5 RFetch 4 Exec Poisoning PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 3 2 Memory WB Write Back DMem T 05 -22

Correcting PC in Execute Register File f. Epoch 2 IFetch Redirect 1 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 2 IFetch Redirect 1 Decode Scoreboard 6 RFetch 5 Exec Poisoning PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 4 3 Memory WB Write Back DMem T 05 -23

Correcting PC in Execute Register File f. Epoch 3 IFetch Redirect 2 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 3 IFetch Redirect 2 Decode Scoreboard 1 RFetch 6 Exec 5 Memory Poisoning PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 4 WB Killing DMem T 05 -24

Correcting PC in Execute Register File f. Epoch 4 IFetch Redirect 3 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 4 IFetch Redirect 3 Decode Scoreboard 2 RFetch 1 Exec 6 Memory Executing PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 5 WB Killing DMem T 05 -25

Correcting PC in Execute Register File f. Epoch 5 IFetch Redirect 4 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 5 IFetch Redirect 4 Decode Scoreboard 3 RFetch 2 Exec 1 Memory Executing PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 6 WB Killing DMem T 05 -26

Correcting PC in Execute Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard

Correcting PC in Execute Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard 4 RFetch 3 Executing PC October 7, 2013 IMem e. Epoch http: //csg. csail. mit. edu/6. s 195 2 1 Memory WB Write Back DMem T 05 -27

Correcting PC in Decode October 7, 2013 http: //csg. csail. mit. edu/6. s 195

Correcting PC in Decode October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -28

Correcting PC in Decode Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard

Correcting PC in Decode Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard 4 RFetch 3 Exec Mispredicted PC October 7, 2013 IMem 2 1 Memory WB Write Back d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -29

Correcting PC in Decode Register File f. Epoch 1 IFetch Redirect 6 Decode Scoreboard

Correcting PC in Decode Register File f. Epoch 1 IFetch Redirect 6 Decode Scoreboard 5 RFetch 4 Exec Killing PC October 7, 2013 IMem 3 2 Memory WB Write Back d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -30

Correcting PC in Decode Register File f. Epoch 2 IFetch Redirect 1 Decode RFetch

Correcting PC in Decode Register File f. Epoch 2 IFetch Redirect 1 Decode RFetch Scoreboard 5 Exec Decoding PC October 7, 2013 IMem 4 3 Memory WB Write Back d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -31

Correcting PC in Decode Register File f. Epoch 3 IFetch Redirect 2 Decode Scoreboard

Correcting PC in Decode Register File f. Epoch 3 IFetch Redirect 2 Decode Scoreboard 1 RFetch Exec Decoding PC October 7, 2013 IMem 5 4 Memory WB Write Back d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -32

Correcting PC in Decode Register File f. Epoch 4 IFetch Redirect 3 Decode Scoreboard

Correcting PC in Decode Register File f. Epoch 4 IFetch Redirect 3 Decode Scoreboard 2 RFetch 1 Exec Decoding PC October 7, 2013 IMem 5 Memory WB Write Back d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -33

Correcting PC in Decode Register File f. Epoch 5 IFetch Redirect 4 Decode Scoreboard

Correcting PC in Decode Register File f. Epoch 5 IFetch Redirect 4 Decode Scoreboard 3 RFetch 2 Exec 1 Memory Decoding PC October 7, 2013 IMem WB Stall d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -34

Correcting PC in Decode Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard

Correcting PC in Decode Register File f. Epoch 6 IFetch Redirect 5 Decode Scoreboard 4 RFetch 3 Exec Decoding PC October 7, 2013 IMem 2 1 Memory WB Write Back d. Epoch http: //csg. csail. mit. edu/6. s 195 DMem T 05 -35

Correcting PC in Decode and Execute October 7, 2013 http: //csg. csail. mit. edu/6.

Correcting PC in Decode and Execute October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -36

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch Redirect 5 Decode 4 RFetch Decoding PC IMem Scoreboard 3 Exec 2 Memory Executing d. Epoch fe. Epoch 1 e. Epoch WB Write Back DMem Fetch has local estimates of e. Epoch and d. Epoch Decode has a local estimate of e. Epoch October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -37

Correcting PC in Decode and Execute What if decode and execute see mispredictions in

Correcting PC in Decode and Execute What if decode and execute see mispredictions in the same cycle? n October 7, 2013 If execute sees a misprediction, then the decode instruction is a wrong path instruction. The redirect coming from decode should be ignored. http: //csg. csail. mit. edu/6. s 195 T 05 -38

Correcting PC in Decode and Execute What if execute sees a misprediction, then decode

Correcting PC in Decode and Execute What if execute sees a misprediction, then decode sees one in the next cycle? n October 7, 2013 The decode instruction will be a wrong path instruction, so it should not try to redirect the PC http: //csg. csail. mit. edu/6. s 195 T 05 -39

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch Redirect 5 Decode 4 RFetch Decoding PC IMem Scoreboard 3 Exec Mispredicted d. Epoch fe. Epoch 2 1 Memory WB Write Back DMem Assume this instruction is a mispredicted jump instruction. It will be in the decode stage next cycle October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -40

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch Redirect 6 Decode 5 RFetch Killing PC IMem Scoreboard 4 Exec Poisoning d. Epoch fe. Epoch 3 2 Memory WB Write Back DMem The decode stage knows e. Epoch, and recognizes this misprediction is a wrong path instruction. The decode stage kills this instruction. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -41

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch Redirect 1 Decode RFetch Decoding PC October 7, 2013 IMem Scoreboard 5 Exec Poisoning d. Epoch fe. Epoch http: //csg. csail. mit. edu/6. s 195 4 3 Memory WB Write Back DMem T 05 -42

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 3 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 3 IFetch Redirect 2 Decode 1 RFetch Decoding PC October 7, 2013 IMem Scoreboard Exec 5 Memory Stalling d. Epoch fe. Epoch http: //csg. csail. mit. edu/6. s 195 4 WB Killing DMem T 05 -43

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 4 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 4 IFetch Redirect 3 Decode 2 RFetch Decoding PC October 7, 2013 IMem Scoreboard 1 Exec Memory Executing d. Epoch fe. Epoch http: //csg. csail. mit. edu/6. s 195 5 WB Killing DMem T 05 -44

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 5 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 5 IFetch Redirect 4 Decode 3 RFetch Decoding PC October 7, 2013 IMem Scoreboard 2 Executing d. Epoch fe. Epoch http: //csg. csail. mit. edu/6. s 195 1 Memory WB Stalling DMem T 05 -45

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch Redirect 5 Decode 4 RFetch Decoding PC October 7, 2013 IMem Scoreboard 3 Executing d. Epoch fe. Epoch http: //csg. csail. mit. edu/6. s 195 2 1 Memory WB Write Back DMem T 05 -46

Correcting PC in Decode and Execute What if decode sees a misprediction, then execute

Correcting PC in Decode and Execute What if decode sees a misprediction, then execute sees one in the next cycle? n October 7, 2013 The decode instruction will be a wrong path instruction, but it won’t be known to be wrong path until later http: //csg. csail. mit. edu/6. s 195 T 05 -47

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch Redirect 5 Decode 4 RFetch Mispredicted PC IMem Scoreboard 3 Executing d. Epoch fe. Epoch 2 1 Memory WB Write Back DMem Assume this instruction is a mispredicted branch instruction. It will be in the execute stage next cycle October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -48

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch Redirect 6 Decode 5 RFetch Killing PC IMem Scoreboard 4 Exec Mispredicted d. Epoch fe. Epoch 3 2 Memory WB Write Back DMem The PC was just “corrected” to a different wrong path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -49

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 1 IFetch Redirect 1 Decode RFetch Killing PC IMem Scoreboard 5 Exec Poisoning d. Epoch fe. Epoch 4 3 Memory WB Write Back DMem The PC was just corrected to a correct path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -50

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 2 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 2 IFetch Redirect 1 Decode RFetch Decoding PC IMem Scoreboard Exec Stalling d. Epoch fe. Epoch 5 4 Memory WB Write Back DMem The PC was just corrected to a correct path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -51

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 3 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 3 IFetch Redirect 2 Decode 1 RFetch Decoding PC IMem Scoreboard Exec Memory Stalling d. Epoch fe. Epoch 5 WB Killing DMem The PC was just corrected to a correct path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -52

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 4 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 4 IFetch Redirect 3 Decode 2 RFetch Decoding PC IMem Scoreboard 1 Executing d. Epoch fe. Epoch Memory WB Stalling DMem The PC was just corrected to a correct path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -53

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 5 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 5 IFetch Redirect 4 Decode 3 RFetch Decoding PC IMem Scoreboard 2 Executing d. Epoch fe. Epoch 1 Memory WB Stalling DMem The PC was just corrected to a correct path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -54

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch

Correcting PC in Decode and Execute Register File fd. Epoch fe. Epoch 6 IFetch Redirect 5 Decode 4 RFetch Decoding PC IMem Scoreboard 3 Executing d. Epoch fe. Epoch 2 1 Memory WB Write Back DMem The PC was just corrected to a correct path instruction October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -55

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -56

Pipeline Feedback You can forward changes to the processor state to later instructions in

Pipeline Feedback You can forward changes to the processor state to later instructions in the pipeline n Forwarding PC state w Redirect fifo w Epoch updates n Forwarding register file state w Register file data w Scoreboard entries n Forwarding memory state w Covered later in class (maybe) October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -57

Pipeline Feedback Register File f. Epoch IFetch PC October 7, 2013 Redirect Decode IMem

Pipeline Feedback Register File f. Epoch IFetch PC October 7, 2013 Redirect Decode IMem RFetch Scoreboard Exec e. Epoch http: //csg. csail. mit. edu/6. s 195 Memory WB DMem T 05 -58

Pipeline Feedback Better processor performance can be obtained by faster feedback n EHRs can

Pipeline Feedback Better processor performance can be obtained by faster feedback n EHRs can be used to make state updates appear to happen in less than a cycle How can Epoch and PC feedback be sped up? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -59

f. Epoch and PC feedback Register File f. Epoch IFetch PC Redirect Decode IMem

f. Epoch and PC feedback Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Normally updates to f. Epoch and PC epoch have to pass through the redirect fifo. When IFetch sees entries in the redirect fifo, it makes the changes to f. Epoch and PC October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -60

f. Epoch and PC feedback Register File Epoch [1] IFetch PC Redirect Decode IMem

f. Epoch and PC feedback Register File Epoch [1] IFetch PC Redirect Decode IMem RFetch Scoreboard Exec Epoch [0] Memory WB DMem Changes to the Epoch can now be seen by IFetch in the same cycle that execute made the changes October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -61

f. Epoch and PC feedback Register File Epoch [1] IFetch PC Redirect Decode IMem

f. Epoch and PC feedback Register File Epoch [1] IFetch PC Redirect Decode IMem RFetch Scoreboard Exec Epoch [0] Memory WB DMem The PC is still coming through the redirect fifo, so the epoch and the pc will get out of synch! October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -62

f. Epoch and PC feedback Register File Epoch [1] IFetch PC [1] Scoreboard Decode

f. Epoch and PC feedback Register File Epoch [1] IFetch PC [1] Scoreboard Decode IMem RFetch Exec PC [0] Epoch [0] Memory WB DMem Make the PC an EHR too! Whenever Execute sees a misprediction, IFetch reads the correct next instruction in the same cycle! October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -63

Pipeline Feedback How can Register File and Scoreboard feedback be sped up? October 7,

Pipeline Feedback How can Register File and Scoreboard feedback be sped up? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -64

RFile and SB feedback Register File f. Epoch IFetch PC Redirect Decode IMem RFetch

RFile and SB feedback Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Normally updates (writes) to the register file and updates (removes) to the scoreboard are seen in the next cycle. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -65

RFile and SB feedback Bypass Register File f. Epoch IFetch PC Redirect Decode IMem

RFile and SB feedback Bypass Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem A bypass register file will allow the result from a write to be read by RFetch in the same cycle. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -66

RFile and SB feedback Bypass Register File f. Epoch IFetch PC Redirect Decode IMem

RFile and SB feedback Bypass Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem In this case, the scoreboard is still stalling as much as before October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -67

RFile and SB feedback Bypass Register File f. Epoch IFetch PC Redirect Decode IMem

RFile and SB feedback Bypass Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Pipeline Scoreboard Exec e. Epoch Memory WB DMem You can use a scoreboard that removes before searching (called a pipeline scoreboard because it is similar to pipeline fifo’s deq<enq behavior) October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -68

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages

5 Details Processor State Poisoning Instructions ASAP Prediction Correction Pipeline Feedback Removing Pipeline Stages October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -69

Removing Pipeline Stages You will create a 6 stage SMIPS pipeline in Lab 6

Removing Pipeline Stages You will create a 6 stage SMIPS pipeline in Lab 6 n n n October 7, 2013 6 is a lot of stages and may not be necessary How much work would it be to turn it into a shorter pipeline? Say 4 stages? How much work would it be to shift work from one pipeline stage to another? http: //csg. csail. mit. edu/6. s 195 T 05 -70

Removing Pipeline Stages Register File f. Epoch Redirect Scoreboard IFetch Decode Exec PC IMem

Removing Pipeline Stages Register File f. Epoch Redirect Scoreboard IFetch Decode Exec PC IMem e. Epoch WB DMem Say you want a 4 stage pipeline where Decode does RFetch and Exec does Memory. How do you make this machine with as little work as possible? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -71

Removing Pipeline Stages Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Bypass

Removing Pipeline Stages Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Bypass Fifos Scoreboard Exec e. Epoch Memory WB DMem Replace CFFifos between stages with bypass fifos. The bypass fifos will act as wires when possible. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -72

Removing Pipeline Stages Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard

Removing Pipeline Stages Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Now you want to move RFetch to the Exec stage to reduce the amount of time stalled for RAW hazards. How much work is this? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -73

Removing Pipeline Stages Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard

Removing Pipeline Stages Register File f. Epoch IFetch PC Redirect Decode IMem RFetch Scoreboard Exec e. Epoch Memory WB DMem Just change the types of fifos between Decode and RFetch and between RFetch and Exec. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -74

Removing Pipeline Stages The 6 stage pipeline is very flexible. You can try out

Removing Pipeline Stages The 6 stage pipeline is very flexible. You can try out many different stage configurations in FPGA synthesis to see how your IPS (Instructions Per Seconds) changes. October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -75

Conclusion Processor State n Most processor errors can be related to operating on the

Conclusion Processor State n Most processor errors can be related to operating on the wrong processor state Poisoning Instructions n Needed for lab 6 ASAP Prediction Correction n This will be covered in more depth in lab 7. Pipeline Feedback n Can be used to speed up processors Removing pipeline stages n October 7, 2013 Can also be used to speed up processors http: //csg. csail. mit. edu/6. s 195 T 05 -76

Questions? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -77

Questions? October 7, 2013 http: //csg. csail. mit. edu/6. s 195 T 05 -77