最新lab3复杂流水线实验报告Word格式文档下载.docx
《最新lab3复杂流水线实验报告Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《最新lab3复杂流水线实验报告Word格式文档下载.docx(9页珍藏版)》请在冰豆网上搜索。
2
3
4
5
6
7
8
9
ADDR1,R2,R3
IF
ID
EXE
MEM
WB
SUBR5,R1,R4
其中ADD指令中在MEM阶段的ALUout-555(R2+R3)前递到SUB指令的EXE阶段的upperinput。
(b)WriteasampleprogramthatforwardsbetweenEXEstageandWBstageonupperinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
NOP
其中ADD指令中在WB阶段的输出555(R2+R3)前递到SUB指令的EXE阶段的upperinput。
(c)WriteasampleprogramthatforwardsbetweenEXEstageandMEMstageonlowerinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
SUBR5,R4,R1
(d)WriteasampleprogramthatforwardsbetweenEXEstageandWBstageonlowerinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.
(e)WriteasampleprogramthatforwardsbetweenMEMstageandWBstage.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.
LWR1,0(R2)
SWR3,0(R1)
其中ADD指令在WB阶段的输出555(R2+R3)前递到SW指令的MEM阶段。
(f)WriteaprogramthatcausesLoadUseDelayStall.SeewhatdataistobemovedandnoticeexactlywhentherequiredDataispassedontothewaitinginstruction.Showitasanarrowonthefollowingdiagram.
LWR1,0(R3)
ADDR2,R1,R3
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____
10
11
12
13
LWR1,0(R2)
ADDIR1,R1,#1
SWR1,0(R2)
ADDIR2,R2,#4
SUBR4,R3,R2
BNEZR4,Loop1
ADDIR2,R0,0
14
15
16
17
18
19
20
21
22
23
24
25
26
FLUSHED
(b)Redothepart(a)withforwardingONandotherprocessorconfigurationissame.Totalclockcycles___
实验心得:
通过本次实验,我更加深刻的理解了流水线中的前递技术的实现,以及不同类型的指令在不同的阶段前递,方式也不同。
同时,我对branch指令数据冒险的解决也有了一个更加清晰的认识,branch类型主要通过循环内改写和循环展开这两种方式,通过不同的实例,清楚地知道不同情况下考虑策略的不同。
通过实验,更加清晰的理解了课上的理论内容,也对复杂流水化有了一个更加全面系统的认知,收获很大。