北邮大三计算机体系结构实验三DLX处理器程序设计Word文档格式.docx
《北邮大三计算机体系结构实验三DLX处理器程序设计Word文档格式.docx》由会员分享,可在线阅读,更多相关《北邮大三计算机体系结构实验三DLX处理器程序设计Word文档格式.docx(15页珍藏版)》请在冰豆网上搜索。
加法运算
Finish:
;
****Finish,writeresultintostdout
sdResult,f4
addir14,r0,PrintPar
trap5;
系统中断,输出结果
addir2,r2,4
subir20,r20,1
bnezr20,Loop
****End
trap0
2、运行结果
*ClX*Standard*I/O
MM
InpOt・■・
Canesi
Vector=2.0000004000000£
i.0000003OOODOO10.000(0012.00000014.00000016.OC000013.00000020OOOOOO22.OOOOOO24.OOOOOO26.OOOCCO2S.00000030.000000OCOOOOl
Tot呂1'
381Cyclefs]CKKUted
IDexecutedb^1S1Instructors)
2liubudiorf^currentinPipeline.
Hardwareconfiguration:
M&
fno<
v$ize:
32763Etptesf^ddEM-Stag^s;
Krequired2fmiJEX-Stagss:
1,requiredCycles:
5fdivEXSkgei;
1,requiredCycle氏IS
Forwa心gdibbled
Stalis:
RAW曲险130(34.12^Of汕C/cl詢WAW0[0.00^ofallCycles]Stiucturdsials:
0[0.00^ofalCycles]Controlsials:
15宠ofalCydes]Trapstals:
54(14.172ofalCycles)Totel;
199Stdh)(52.23%ofdC^des]
Ccndition^lEr^rjches):
Tota1:
16(8.84^ofallIralructionsLthereof:
taken;
15(93.753fofalcondBranches]nottakers1(6.25^;
ofallcond.Eranches]
Load—/Store-Instruetions;
ToUl:
43(27.073;
ofallnstiuc?
tions]Lthereof:
Loads;
33(67.35^o(Lodd-/Stoinstructions]Stores;
16(32.65^ofLoad-/Slor^lnstrucliorra]
Floatin?
pointsta^aiastrnGtions'
TohI;
16(8L84%ofdillnstructions],thereof;
AddKioris:
1B(100OD^ofFloathgportstagemt]Mullplicalions:
0口即莒ofFloatingpointstageJDivisions:
0(0,00琴ofFloatingpointstagerid.)
Traps:
Trape18阳94鬼ofallInstiucbonc]
5.1程序相关性分析结果
(1)观察程序中出现的数据/控制/结构相关。
指出程序中出现上述现象的指令组合。
产生34.12%的数据相关。
当对当前指令的操作数寄存器进行操作的时候,前几条指令的运算结果还未写回结果寄存器,由此产生数据相关。
5utir20120Q-1brczrZOddtoiLoac咖QhO
OdluD^ectLd1[i2J
HII2^e=li:
jr2(i2)
c^dMUO
没有产生结构相关。
产生3.94%的控制相关。
系统按照预测成功来执行指令,执行一条指令后马上将其下一条指令trap读进来。
addiUOkIOM
IFIDIin£
<
Ih-EM训
IniorTTutiQnabouttrap0焉5
卜ii-
trap0x5
IF
ID
Adr.:
data-Firisti+Owfi
Code:
0x+4ODOCO5
T«
rminatsd5uccmsUII\j
FirstCycle:
-13
LastCycle:
-G
TotalCycles:
B
Cycles:
-13(4)
TeiminatedsuccesEfu^
IMAFl<
PC(=data.Fmish+OxG]
IRE制gnflMAR](=0^44000005)
PC<
PC+4[=datQFinisbu-Oxc)
3Stallh)becauseof
Trap-Pi[»
line'
ClMring!
C}*clts:
-9[1]
TerminsledsuccessfullySystemcallexecuteiNqStalbrequired.
(2)考察增加浮点运算部件对性能的影响。
3个浮点运算部件
1个浮点运算部件
Total'
3S1Cyclefi]executed
IDexecutedby131lnstrudion(sl
"
lr*$tructicn[sjcurrent^inPipelhe
Total:
381Qcle阖exectiled.IDexficuledby1A1lnstiuction[s].
21nsltuction[s)(WHtpinPipelrie.
Hardwarecanfi^uratidin;
Memory沁;
32760B^esfaddEX-S^g?
$;
\requiredCycles;
?
fmulEX^tcges;
1*reqiiredCycles;
5FdivEX-Stages;
1requiredCycles;
19Forwaningdisabled.
Hardwareconfiguration:
Memcrpsi2e:
3276&
faddE^-Stages:
3,requiiedCyclBS:
2fmiulE^!
-S(ages:
3,requiredCyclesbfdivEX-Stages:
3,raquliedC^desc19Forwardingdisabled.
Stalls:
RAWstalk:
1I^D(341^qIallCycles)
WAV/stab:
0[0.0[Kofdiodes)
StructuralC(0.00^ofallCycles)
Control15(3.54^ofallC^les]
Trap肘Is:
54(1^.17^ofdlCyder)ToM139St<
s](52.23^ofallCydn]
RAWJtalls:
130(3412^of引QnjI&
s]VXAW曲11笙0(0.00^ofallCycles}Stiuctualstalls0(0.00/=.ofallCycles]ControltfaM15(3,94鴛ofdllTrap琴lais;
54(14.17^aFaJICyclas)Total:
199记2骥ofallCycles]
ConditionalBranches)'
Tolal;
1E肌S4鬻ofdlInsbucbonsJ,thereof:
Ukenc15(33.^ofdlcortd.Broiches)not滋bit1[E.25强ofallcond陥rich品
Conditiona1Branches)■
Totat16(8l84£
ofalInstruction^,theneol:
就前;
15(9275%ofdlconiBrarahNliwilakar1|E.25需ofallcond.Dranohet)
Load-/Store-1nstruetions:
43(2707%of旨1ImtructiontLthsrecr:
Loads'
33[67.3E^ofLoadVSlcr&
dn^tructions)
Stores16〔32,65盥atLoBckStor»
4rutiuctions]
Load-/Store-Instrue11ons:
Tout49(27.07^ofallln$bud»
ns)Lthereof:
Losdc33(67.35^ofLo詁/Stated阳buctions]
Stores;
1&
[3266%dLoad-ZSla&
lnsliuctkint)
Floatingpointstageinstructions:
Total:
16他94當of^llInstructions),thereof:
Additions:
16(10000^ofFloaiingpoinistagerist)Muitiplcations;
0(0.00^ofFloatingpointstageirot)Divisioi^0(0.00^ofFloatingpointstageinst.)
Floatingpointstageinstru匚tiizins:
Totat16(3別常ofallr>
struclian$]Hthereof;
Addtions:
16(100.00^ofFloatingpointstageinst)MultiplicatBns:
0(000%ofFloatingpentstagsinst.]Divisions;
0[Cl0宓ofFloatingpoint就mgeinst.]
Tups:
1BR94塔ddlnrtvictian$]
Tr^ps:
1「卩9必cfallIn汕uuliss]
同一段代码执行相同步,但是经过对比发现浮点运算部件的多少对于程序执行效率并没有什么影响,浮点运算部件的多少对统计结果都不造成影响,可能是由于
该程序不存在争用浮点运算部件资源的情况
(3)考察增加forward部件对性能的影响。
不使用forward部件使用forward部件
使用forward部件之后执行相同的代码用的时钟周期比不使用forward部件少了大约100个时钟周期,由于没有结构相关,所以使用forward部件主要使得RAW0关明显减少了,占总的时钟周期比例也减少了,对控制相关没有什么影响。
总之,使用forward部件后,总的时钟周期减少,数据相关减少,流水线的性能得到很大的改善。
(4)观察转移指令在转移成功和转移不成功时候的流水线开销。
Condition-alBranches):
TDial16(884^ofallInstructions),thereof:
taken:
15(93.75^ofalcondBranches)
nottaken;
1(6.25Mofallcond.Btanchts)
在本次实验中转移成功的几率比较大,进行16次转移只有一次转移不成功的,
因为系统按照预测成功来执行指令,当判断转移不成功时,系统对trap指令进行的操作被全部作废,转而去执行跳转到的指令。
4.2双精度浮点加法求和代码清单及注释说明
1、双精度浮点加法求和源代码
.align2
PrintfPar:
.wordPrintfFormat
r:
.space200
r为保存相加结果的向量空间.text
.globalmain
addir1,r0,0;
r1计数相加的次数
adduir4,r0,8;
r4为常数8
loop:
;
循环计算向量相加结果
subir2,r1,20;
r1=20时,跳转到finish
beqzr2,finish
multur3,r1,r4;
r3为当前分量相对于向量基址的偏移(每个分量占8B)
ldfO,a(⑶;
取a中第r1个分量
ldf2,b(r3);
取b中第r1个分量
adddf4,f0,f2;
相加结果放在f4中
sdr(r3),f4;
将相加结果放入结果向量r中
addir1,r1,1;
下一分量
jloop
finish:
输出向量相加的结果
addir14,r0,PrintfPar
2、运行结果:
FDlX-Standard-1/0
Input•*■・・
Cancel
Theresultis
3.
OOODOO
4.:
300000
7.00QOOO
9.
000000
11
oooooo
13
.000000
15
17.QQQQOO
ie
.900000
21
.oooooo
23
25
.aooooo
27.000000
29
31
33
35
37.000000
36
41
489Cyclefs]executed.
IDexecutedby135Instructior(sl
2Inriructiorfs)currentinPipeline.
Haxdwaxeconfiguration:
Memory咄芥;
3276BBytes
faddEX'
Stages:
LrequiredCycl&
s:
3fnuJEX-Stages'
1*requiredCycles;
5fdivE^-SUaes;
1.uquu曲Cydcs;
1日
FonAiardingdibbled
Stalls;
RAWstalls:
263(53.78^ofallCycles)
WAW計制$;
0(n.00^ofellCycles]Structuralstalls;
0[000£
ofalCycles)
DantidlUfc:
21(4.29^cfalCycles|
Tw归k;
9(1,84芻ofalCycles]
Totak293Gtdl(s)[59,922;
ofallQd显]
ConditIqxl^LBr^nch&
s);
21(10.77^allInstructioris).thereof
1(47E^ofaiccnd.Brmches)
rotlaksrc20(95243fofallcondBranches]
d-/Store-Instructioas;
TstatE5「门一于'
ofalIrshudionsJ,thareoF'
Loads:
40回.54篦ofLoad-/5tora*lnstructionis]
Stan$H25(224F;
ofLood/Storsimtiuctnm)
Floatincrpointstag'
siustru匚ti匸
TqUI:
40(20.51^of訓I喃wutiori或thereoL
Add^iors:
2D(50.00%ofRulingpointitageinst.)
Mullplicalions:
20(50.00^ofFloatingpointstageinsL)
Divisions:
0[0.00^ofFloatingpoststage»
L)
Traps31(154ofallInstructions:
)
5.2程序相关性分析结果
指出程序中出现上述现象的指令组合。
产生了53.78%的数据相关。
当对当前指令的操作数寄存器进行操作的时候,前几条指令的运算结果还未写回结果寄存器,由此产生数据相关。
产生数据相关的指令主要有:
1)addir1,r0,0
subir2,r1,20
2)subir2,r1,20
3)multur3,r1,r4
Idf0,a(r3)
4)ldf2,b(r3)
adddf4,f0,f2
|HD[严店:
;
|MFM|钞日
1=
H-5al
IJII
faciifXniMEMIV,'
B
I伯I
InriRUclizirc;
J*L^dei
已ddzS14K1..IZ
半dr[i3JM-
•ddrl/13
ihet
三址>r2/1,Ch~Ab«
prS.fdih
无结构相关
产生了4.29%的控制相关。
系统按照预测成功来执行指令,执行一条指令后马上将其下一条指令trap读进来。
和4.1代码类似。
1个浮点运算部件3个浮点运算部件
—鼻*
4E9Cydefs)executed.
IDewecutedbyJ95Insiiuctionfs)
2Instictior(曲currentlyinPipeline
Tot^l:
439CydE阖executed.
IDesecufcedby1'
dbInsbuctionfs].
2nsttuctonf^JoireHtpnPipeline.
Hardvarecontiguration;
Memy检;
22帝Byte?
faddEX-Staae?
:
1.requiedCiclfrs12fmulE^taoe^:
'
.requiredCycles:
5蔺耶孤1..(squHdQyde«
19
Foiwarangdibbled.
Eai-dwareconfiguration.:
Msmcrysze:
32768BylesfaddE^-St3Qes:
1requiedCycles;
2fnrdE^-gbges:
3,requiredCycles5fdvEX-Stages:
3.requiredCycles:
19ForwerAigdi泪hd,
RAW血感263駅局算ofalCydes)WAW如呢ofdllQGl於
Structudlstalls;
D(000%ofalC/cIbs)Conlrolstair21(4.29^cfall3凸翎Trap細屛cf制lUyu閒
293Stall圍陕9盈of訓事鬭
F^W如农26315370^口fallCycles)VrAWstdls:
0(000^ofallCycles)StucturalskkOOdDOSofalCycles)Controlskis;
21(4.29^ofall
Tsp心;
9(1.94^ofdQcb订
293Stalls(5332^of
C匚3rviiQh@s);
Totak21(10.77^ofallln9&
ud»
m)Lthefeor:
teken:
1(4.76^ofallconiBlanches)noHakanc20(96.24^ofal«
nd.Branches]
ConditionalBranches)
Tvtat21(10,7?
6cfdlInsbuctionsjLthtreof;
taken!
1(476%ofalcond.Dranchn)nottaken:
20(95.24^ofalcord由anchKj
Load-/Store-rnstruetiors;
Totat(33.33tofalllnshudiont)Ltheracf
Loids'
40(E1.54XofLosd-/5tore^n$truclicm)
Stnx的尬4E需cfLQad-/StQrdndNG4hrH)
loac-/Store-instructions:
Totat65(33.33?
*ofallInslructions),thereof:
40[61.54^dLoad-/Slore-hstiuclions]
Stores:
25(38146^cfLoad/StorehsbudiDns]
Flostinqpointstagsinstructionsnt400.51ofallInstruction^thersor;
Addition:
20(50URofRoathgpointttageh$l)
Mutiplica