constructive computer architecture tutorial 6: five details of smips implementations andy wright
DESCRIPTION
Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright 6.S195 TA. Introduction. Lab 6 involves creating a 6 stage pipelined SMIPS processor from a 2 stage pipeline - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/1.jpg)
Constructive Computer Architecture
Tutorial 6:Five Details of SMIPS ImplementationsAndy Wright6.S195 TA
October 7, 2013 http://csg.csail.mit.edu/6.s195 T05-1
![Page 2: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/2.jpg)
Introduction
Lab 6 involves creating a 6 stage pipelined SMIPS processor from a 2 stage pipeline 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 T05-2http://csg.csail.mit.edu/6.s195
![Page 3: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/3.jpg)
6 stage SMIPS pipeline
October 7, 2013 T05-3http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
![Page 4: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/4.jpg)
5 Details
Processor StatePoisoning InstructionsASAP Prediction CorrectionPipeline FeedbackRemoving Pipeline Stages
October 7, 2013 T05-4http://csg.csail.mit.edu/6.s195
![Page 5: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/5.jpg)
5 Details
Processor StatePoisoning InstructionsASAP Prediction CorrectionPipeline FeedbackRemoving Pipeline Stages
October 7, 2013 T05-5http://csg.csail.mit.edu/6.s195
![Page 6: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/6.jpg)
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 addi(PC, RFile, Mem) = (PC+4, RFile’, Mem)
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 Imem: (PC) ->
( (PC, Rfile, Mem) -> (PC, RFile, Mem) )
October 7, 2013 T05-6http://csg.csail.mit.edu/6.s195
![Page 7: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/7.jpg)
Processor State
If your SMIPS processor from lab is not working: Was an instruction executed on the
wrong processor state? RAW hazards Not using the right PC in the execute stage
Was the wrong instruction executed? A wrong path instruction from branch
misprediction updated the processor state
October 7, 2013 T05-7http://csg.csail.mit.edu/6.s195
![Page 8: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/8.jpg)
Processor State
October 7, 2013 T05-8http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
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.
![Page 9: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/9.jpg)
5 Details
Processor StatePoisoning InstructionsASAP Prediction CorrectionPipeline FeedbackRemoving Pipeline Stages
October 7, 2013 T05-9http://csg.csail.mit.edu/6.s195
![Page 10: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/10.jpg)
Poisoning Instructions
Why poison? It’s a way to mark that an instruction should be killed at a later stage. This mark could be as simple as using
an invalid value in a maybe data type
Instructions are poisoned when epochs don’t matchWhy not kill in place?
October 7, 2013 T05-10http://csg.csail.mit.edu/6.s195
![Page 11: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/11.jpg)
Kill-In-Place Pipeline
October 7, 2013 T05-11http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Scoreboard entries need to be removed when instructions are killed.
![Page 12: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/12.jpg)
Kill-In-Place Pipeline
October 7, 2013 T05-12http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
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.
![Page 13: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/13.jpg)
Poisoning Pipeline
October 7, 2013 T05-13http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Poison Kill
![Page 14: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/14.jpg)
5 Details
Processor StatePoisoning InstructionsASAP Prediction CorrectionPipeline FeedbackRemoving Pipeline Stages
October 7, 2013 T05-14http://csg.csail.mit.edu/6.s195
![Page 15: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/15.jpg)
ASAP Prediction Correction
Different instructions that affect the program flow can be resolved at different times 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 T05-15http://csg.csail.mit.edu/6.s195
![Page 16: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/16.jpg)
ASAP Prediction Correction
October 7, 2013 T05-16http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
This is the general idea, we want Decode, RFetch, and Exec to be able to correct the PC
![Page 17: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/17.jpg)
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? More Epochs!
October 7, 2013 T05-17http://csg.csail.mit.edu/6.s195
![Page 18: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/18.jpg)
ASAP Prediction Correction
October 7, 2013 T05-18http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Decode, RFetch, and Exec each have their own epoch.
dEpoch rfEpoch
![Page 19: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/19.jpg)
ASAP Prediction Correction
October 7, 2013 T05-19http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Each epoch acts just like eEpoch does
![Page 20: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/20.jpg)
Correcting PC in Execute
October 7, 2013 T05-20http://csg.csail.mit.edu/6.s195
![Page 21: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/21.jpg)
Correcting PC in Execute
October 7, 2013 T05-21http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
123456
Mispredicted Write Back
![Page 22: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/22.jpg)
Correcting PC in Execute
October 7, 2013 T05-22http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
234561
Poisoning Write Back
![Page 23: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/23.jpg)
Correcting PC in Execute
October 7, 2013 T05-23http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
345612
Poisoning Write Back
![Page 24: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/24.jpg)
Correcting PC in Execute
October 7, 2013 T05-24http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
456123
Poisoning Killing
![Page 25: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/25.jpg)
Correcting PC in Execute
October 7, 2013 T05-25http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
561234
Executing Killing
![Page 26: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/26.jpg)
Correcting PC in Execute
October 7, 2013 T05-26http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
612345
Executing Killing
![Page 27: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/27.jpg)
Correcting PC in Execute
October 7, 2013 T05-27http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
123456
Executing Write Back
![Page 28: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/28.jpg)
Correcting PC in Decode
October 7, 2013 T05-28http://csg.csail.mit.edu/6.s195
![Page 29: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/29.jpg)
Correcting PC in Decode
October 7, 2013 T05-29http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
123456
Mispredicted Write Back
![Page 30: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/30.jpg)
Correcting PC in Decode
October 7, 2013 T05-30http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
234561
Killing Write Back
![Page 31: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/31.jpg)
Correcting PC in Decode
October 7, 2013 T05-31http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
34512
Decoding Write Back
![Page 32: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/32.jpg)
Correcting PC in Decode
October 7, 2013 T05-32http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
45123
Decoding Write Back
![Page 33: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/33.jpg)
Correcting PC in Decode
October 7, 2013 T05-33http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
51234
Decoding Write Back
![Page 34: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/34.jpg)
Correcting PC in Decode
October 7, 2013 T05-34http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
12345
Decoding Stall
![Page 35: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/35.jpg)
Correcting PC in Decode
October 7, 2013 T05-35http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem
fEpoch
PC
Redirect
dEpoch
23456
Decoding Write Back
1
![Page 36: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/36.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-36http://csg.csail.mit.edu/6.s195
![Page 37: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/37.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-37http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
123456
Executing Write Back
dEpoch
Decoding
fdEpoch
feEpoch
Fetch has local estimates of eEpoch and dEpochDecode has a local estimate of eEpoch
![Page 38: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/38.jpg)
Correcting PC in Decode and Execute
What if decode and execute see mispredictions in the same cycle? If execute sees a misprediction, then
the decode instruction is a wrong path instruction. The redirect coming from decode should be ignored.
October 7, 2013 T05-38http://csg.csail.mit.edu/6.s195
![Page 39: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/39.jpg)
Correcting PC in Decode and Execute
What if execute sees a misprediction, then decode sees one in the next cycle? The decode instruction will be a
wrong path instruction, so it should not try to redirect the PC
October 7, 2013 T05-39http://csg.csail.mit.edu/6.s195
![Page 40: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/40.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-40http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
123456
Mispredicted Write Back
dEpoch
Decoding
fdEpoch
feEpoch
Assume this instruction is a mispredicted jump instruction. It will be in the decode stage next cycle
![Page 41: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/41.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-41http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
234561
Poisoning Write Back
dEpoch
Killing
fdEpoch
feEpoch
The decode stage knows eEpoch, and recognizes this misprediction is a wrong path instruction. The decode stage kills this instruction.
![Page 42: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/42.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-42http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
34511
Poisoning Write Back
dEpoch
Decoding
fdEpoch
feEpoch
![Page 43: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/43.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-43http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
45123
Stalling Killing
dEpoch
Decoding
fdEpoch
feEpoch
![Page 44: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/44.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-44http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
51234
Executing Killing
dEpoch
Decoding
fdEpoch
feEpoch
![Page 45: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/45.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-45http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
12345
Executing Stalling
dEpoch
Decoding
fdEpoch
feEpoch
![Page 46: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/46.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-46http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
23456
Executing Write Back
dEpoch
Decoding
fdEpoch
feEpoch
1
![Page 47: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/47.jpg)
Correcting PC in Decode and Execute
What if decode sees a misprediction, then execute sees one in the next cycle? The decode instruction will be a
wrong path instruction, but it won’t be known to be wrong path until later
October 7, 2013 T05-47http://csg.csail.mit.edu/6.s195
![Page 48: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/48.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-48http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
123456
Executing Write Back
dEpoch
Mispredicted
fdEpoch
feEpoch
Assume this instruction is a mispredicted branch instruction. It will be in the execute stage next cycle
![Page 49: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/49.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-49http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
234561
Mispredicted Write Back
dEpoch
Killing
fdEpoch
feEpoch
The PC was just “corrected” to a different wrong path instruction
![Page 50: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/50.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-50http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
34511
Poisoning Write Back
dEpoch
Killing
fdEpoch
feEpoch
The PC was just corrected to a correct path instruction
![Page 51: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/51.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-51http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
4512
Stalling Write Back
dEpoch
Decoding
fdEpoch
feEpoch
The PC was just corrected to a correct path instruction
![Page 52: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/52.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-52http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
5123
Stalling Killing
dEpoch
Decoding
fdEpoch
feEpoch
The PC was just corrected to a correct path instruction
![Page 53: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/53.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-53http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
1234
Executing Stalling
dEpoch
Decoding
fdEpoch
feEpoch
The PC was just corrected to a correct path instruction
![Page 54: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/54.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-54http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
12345
Executing Stalling
dEpoch
Decoding
fdEpoch
feEpoch
The PC was just corrected to a correct path instruction
![Page 55: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/55.jpg)
Correcting PC in Decode and Execute
October 7, 2013 T05-55http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
feEpoch
PC
Redirect
123456
Executing Write Back
dEpoch
Decoding
fdEpoch
feEpoch
The PC was just corrected to a correct path instruction
![Page 56: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/56.jpg)
5 Details
Processor StatePoisoning InstructionsASAP Prediction CorrectionPipeline FeedbackRemoving Pipeline Stages
October 7, 2013 T05-56http://csg.csail.mit.edu/6.s195
![Page 57: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/57.jpg)
Pipeline Feedback
You can forward changes to the processor state to later instructions in the pipeline Forwarding PC state
Redirect fifo Epoch updates
Forwarding register file state Register file data Scoreboard entries
Forwarding memory state Covered later in class (maybe)
October 7, 2013 T05-57http://csg.csail.mit.edu/6.s195
![Page 58: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/58.jpg)
Pipeline Feedback
October 7, 2013 T05-58http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
![Page 59: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/59.jpg)
Pipeline Feedback
Better processor performance can be obtained by faster feedback 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 T05-59http://csg.csail.mit.edu/6.s195
![Page 60: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/60.jpg)
fEpoch and PC feedback
October 7, 2013 T05-60http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Normally updates to fEpoch and PC epoch have to pass through the redirect fifo. When IFetch sees entries in the redirect fifo, it makes the changes to fEpoch and PC
![Page 61: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/61.jpg)
fEpoch and PC feedback
October 7, 2013 T05-61http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem Epoch [0]
Epoch [1]
PC
Redirect
Changes to the Epoch can now be seen by IFetch in the same cycle that execute made the changes
![Page 62: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/62.jpg)
fEpoch and PC feedback
October 7, 2013 T05-62http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem Epoch [0]
Epoch [1]
PC
Redirect
The PC is still coming through the redirect fifo, so the epoch and the pc will get out of synch!
![Page 63: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/63.jpg)
fEpoch and PC feedback
October 7, 2013 T05-63http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMemEpoch
[0]
Epoch [1]
PC [1]
Make the PC an EHR too! Whenever Execute sees a misprediction, IFetch reads the correct next instruction in the same cycle!
PC [0]
![Page 64: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/64.jpg)
Pipeline Feedback
How can Register File and Scoreboard feedback be sped up?
October 7, 2013 T05-64http://csg.csail.mit.edu/6.s195
![Page 65: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/65.jpg)
RFile and SB feedback
October 7, 2013 T05-65http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Normally updates (writes) to the register file and updates (removes) to the scoreboard are seen in the next cycle.
![Page 66: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/66.jpg)
RFile and SB feedback
October 7, 2013 T05-66http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Bypass Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
A bypass register file will allow the result from a write to be read by RFetch in the same cycle.
![Page 67: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/67.jpg)
RFile and SB feedback
October 7, 2013 T05-67http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Bypass Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
In this case, the scoreboard is still stalling as much as before
![Page 68: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/68.jpg)
RFile and SB feedback
October 7, 2013 T05-68http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Bypass Register File
Pipeline Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
You can use a scoreboard that removes before searching (called a pipeline scoreboard because it is similar to pipeline fifo’s deq<enq behavior)
![Page 69: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/69.jpg)
5 Details
Processor StatePoisoning InstructionsASAP Prediction CorrectionPipeline FeedbackRemoving Pipeline Stages
October 7, 2013 T05-69http://csg.csail.mit.edu/6.s195
![Page 70: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/70.jpg)
Removing Pipeline Stages
You will create a 6 stage SMIPS pipeline in Lab 6 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?
October 7, 2013 T05-70http://csg.csail.mit.edu/6.s195
![Page 71: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/71.jpg)
Removing Pipeline Stages
October 7, 2013 T05-71http://csg.csail.mit.edu/6.s195
IFetch Decode WBExec
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
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?
![Page 72: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/72.jpg)
Removing Pipeline Stages
October 7, 2013 T05-72http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Replace CFFifos between stages with bypass fifos. The bypass fifos will act as wires when possible.
Bypass Fifos
![Page 73: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/73.jpg)
Removing Pipeline Stages
October 7, 2013 T05-73http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
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?
![Page 74: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/74.jpg)
Removing Pipeline Stages
October 7, 2013 T05-74http://csg.csail.mit.edu/6.s195
IFetch Decode WBRFetch Exec Memory
Register File
Scoreboard
DMemIMem eEpoch
fEpoch
PC
Redirect
Just change the types of fifos between Decode and RFetch and between RFetch and Exec.
![Page 75: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/75.jpg)
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 T05-75http://csg.csail.mit.edu/6.s195
![Page 76: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/76.jpg)
Conclusion
Processor State Most processor errors can be related to operating on
the wrong processor state
Poisoning Instructions Needed for lab 6
ASAP Prediction Correction This will be covered in more depth in lab 7.
Pipeline Feedback Can be used to speed up processors
Removing pipeline stages Can also be used to speed up processors
October 7, 2013 T05-76http://csg.csail.mit.edu/6.s195
![Page 77: Constructive Computer Architecture Tutorial 6: Five Details of SMIPS Implementations Andy Wright](https://reader036.vdocuments.us/reader036/viewer/2022062305/56815c5f550346895dca67f0/html5/thumbnails/77.jpg)
Questions?
October 7, 2013 T05-77http://csg.csail.mit.edu/6.s195