lab3复杂流水线实验报告.docx
- 文档编号:3696845
- 上传时间:2022-11-24
- 格式:DOCX
- 页数:9
- 大小:20.67KB
lab3复杂流水线实验报告.docx
《lab3复杂流水线实验报告.docx》由会员分享,可在线阅读,更多相关《lab3复杂流水线实验报告.docx(9页珍藏版)》请在冰豆网上搜索。
lab3复杂流水线实验报告
Lab3复杂流水化实验
Experiment1:
Tostudythebasicsofforwarding.ForalltheprogramspleaseselectStallDetectionandForwardingshouldbeON.
(a)WriteasampleprogramthatforwardsbetweenEXEstageandMEMstageonupperinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
Instruction
1
2
3
4
5
6
7
8
9
ADDR1,R2,R3
IF
ID
EXE
MEM
WB
SUBR5,R1,R4
IF
ID
EXE
MEM
WB
其中ADD指令中在MEM阶段的ALUout-555(R2+R3)前递到SUB指令的EXE阶段的upperinput。
(b)WriteasampleprogramthatforwardsbetweenEXEstageandWBstageonupperinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
Instruction
1
2
3
4
5
6
7
8
9
ADDR1,R2,R3
IF
ID
EXE
MEM
WB
NOP
IF
ID
EXE
MEM
WB
SUBR5,R1,R4
IF
ID
EXE
MEM
WB
其中ADD指令中在WB阶段的输出555(R2+R3)前递到SUB指令的EXE阶段的upperinput。
(c)WriteasampleprogramthatforwardsbetweenEXEstageandMEMstageonlowerinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
Instruction
1
2
3
4
5
6
7
8
9
ADDR1,R2,R3
IF
ID
EXE
MEM
WB
SUBR5,R4,R1
IF
ID
EXE
MEM
WB
其中ADD指令中在MEM阶段的ALUout-555(R2+R3)前递到SUB指令的EXE阶段的upperinput。
(d)WriteasampleprogramthatforwardsbetweenEXEstageandWBstageonlowerinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
Instruction
1
2
3
4
5
6
7
8
9
ADDR1,R2,R3
IF
ID
EXE
MEM
WB
NOP
IF
ID
EXE
MEM
WB
SUBR5,R4,R1
IF
ID
EXE
MEM
WB
其中ADD指令中在WB阶段的输出555(R2+R3)前递到SUB指令的EXE阶段的upperinput。
(e)WriteasampleprogramthatforwardsbetweenMEMstageandWBstage.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.
Instruction
1
2
3
4
5
6
7
8
9
LWR1,0(R2)
IF
ID
EXE
MEM
WB
SWR3,0(R1)
IF
ID
EXE
MEM
WB
其中ADD指令在WB阶段的输出555(R2+R3)前递到SW指令的MEM阶段。
(f)WriteaprogramthatcausesLoadUseDelayStall.SeewhatdataistobemovedandnoticeexactlywhentherequiredDataispassedontothewaitinginstruction.Showitasanarrowonthefollowingdiagram.
Instruction
1
2
3
4
5
6
7
8
9
LWR1,0(R3)
IF
ID
EXE
MEM
WB
ADDR2,R1,R3
IF
ID
EXE
EXE
MEM
WB
BRANCHHAZARDS.(LabExperiment2)
(a)Letusnowstudysomebranchhazard.FirstofallmakesurethattheAggressivebranchingoptionisOFF,StallDetectionisONandForwardingisON.SelectAlwaysFlushoptionfromthebranchPolicyandwritethefollowingprogram.Doesthisprogramworkproperly.Ifnotmodifytheprogramsothatitworksproperly.Itfills10memorylocationsmemorywithavalue222.Checkwhatshouldbethevaluesofalltheregistersifthisprogramworkistoproperly(nousefulinstructionturningintoNOPorgettingflushed).CarefullynotetheuseofSLTIinstructioninthefollowingloop.
ADDIR3,R0,0
ADDIR1,R0,0
ADDIR2,R0,222
Loop:
AddiR1,R1,4
SWR2,100(R1)
ADDIR3,R3,1
SLTIR5,R3,10
BNEQR5,R0,loop
ADDIR7,R1,10
ADDIR8,R2,5
ADDIR2,R2,100
(i)CalculatetheCPIforthisprogram.61/65
(ii)Whatchangescanwemaketothisprogramsothatitworksproperly(usefulinstructions
aftertheprogramdonotflush)可以在BNEQ跳转后面加3条ADDR0,R0,R0
(iii)RunthesameprogramwithPredictNToptioninBranchPolicy.Whatdifferencedoyousee
whenloopcompletes.
PredictNT:
循环执行完了顺序执行了剩下3条语句。
AlwaysFlush:
循环执行完了依然将剩下3条语句flush掉了。
(b)ThisproblemissimilartoproblemA-1attheendofthebook.(ExerciseA-1.)
Notethatyouneedtocalculatetheoffsetintheactualprogramintermsofnumberofinstructions.
Offset=-6
(A)ProcessorConfiguration.StallDetectionON.,Forwarding:
OFF,AggressiveBranching:
YES,BranchPolicy:
AlwaysFlush.Runtheaboveprogramandfillthefollowingtablefortheinstructionsintheloopbodyforfirst2or3iterations.TotalClockcyclestoruntheprogram____
1
2
3
4
5
6
7
8
9
10
11
12
13
LWR1,0(R2)
IF
ID
EXE
MEM
WB
ADDIR1,R1,#1
IF
ID
ID
ID
EXE
MEM
WB
SWR1,0(R2)
IF
IF
IF
ID
ID
ID
EXE
MEM
WB
ADDIR2,R2,#4
IF
IF
IF
ID
EXE
MEM
WB
SUBR4,R3,R2
IF
ID
ID
ID
EXE
BNEZR4,Loop1
IF
IF
IF
ID
ADDIR2,R0,0
IF
ADDIR3,R0,0
14
15
16
17
18
19
20
21
22
23
24
25
26
LWR1,0(R2)
IF
ID
EXE
MEM
WB
ADDIR1,R1,#1
IF
ID
ID
ID
EXE
MEM
WB
SWR1,0(R2)
IF
IF
IF
ID
ID
ID
EXE
MEM
WB
ADDIR2,R2,#4
IF
IF
IF
ID
EXE
MEM
SUBR4,R3,R2
MEM
WB
IF
ID
ID
BNEZR4,Loop1
ID
ID
EXE
MEM
WB
IF
IF
ADDIR2,R0,0
FLUSHED
IF
ID
EXE
MEM
WB
ADDIR3,R0,0
(b)Redothepart(a)withforwardingONandotherprocessorconfigurationissame.Totalclockcycles___
1
2
3
4
5
6
7
8
9
10
11
12
13
LWR1,0(R2)
IF
ID
EXE
MEM
WB
IF
ID
EXE
MEM
ADDIR1,R1,#1
IF
ID
EXE
EXE
MEM
WB
IF
ID
EXE
SWR1,0(R2)
IF
ID
ID
EXE
MEM
WB
IF
ID
ADDIR2,R2,#4
IF
IF
ID
EXE
MEM
WB
IF
SUBR4,R3,R2
IF
ID
EXE
MEM
WB
BNEZR4,Loop1
IF
ID
ID
EXE
MEM
WB
ADDIR2,R0,0
IF
IF
ID
EXE
MEM
WB
ADDIR3,R0,0
14
15
16
17
18
19
20
21
22
23
24
25
26
LWR1,0(R2)
WB
IF
ID
EXE
MEM
WB
ADDIR1,R1,#1
EXE
MEM
WB
IF
ID
EXE
EXE
MEM
WB
SWR1,0(R2)
ID
EXE
MEM
WB
IF
ID
ID
EXE
MEM
WB
ADDIR2,R2,#4
IF
ID
EXE
MEM
WB
IF
IF
ID
EXE
MEM
SUBR4,R3,R2
IF
ID
EXE
EXE
WB
IF
ID
EXE
BNEZR4,Loop1
IF
ID
ID
EXE
MEM
WB
IF
ID
ADDIR2,R0,0
IF
IF
ID
EXE
MEM
WB
IF
ADDIR3,R0,0
实验心得:
通过本次实验,我更加深刻的理解了流水线中的前递技术的实现,以及不同类型的指令在不同的阶段前递,方式也不同。
同时,我对branch指令数据冒险的解决也有了一个更加清晰的认识,branch类型主要通过循环内改写和循环展开这两种方式,通过不同的实例,清楚地知道不同情况下考虑策略的不同。
通过实验,更加清晰的理解了课上的理论内容,也对复杂流水化有了一个更加全面系统的认知,收获很大。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- lab3 复杂 流水线 实验 报告