资源描述:
《高级体系结构实验报告.docx》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1.提交三个程序的mips汇编代码文件以及x86汇编代码文件;MIPS1.test.c:.frame$sp,16,$31.setnoreorder.cpload$25.setreorderaddu$sp,$sp,-16.mask0x40c00000,-8sw$22,0($sp)sw$23,4($sp)sw$30,8($sp)la$30,3la$23,2addu$22,$30,$23subu$22,$30,$23mul$22,$30,$23div$22,$30,$23rem$22,$30,$23move$2,$0L.1:lw$22,0($sp)lw$23,4($sp)lw$30,8($sp)a
2、ddu$sp,$sp,16j$312.sum.c.frame$sp,16,$31.setnoreorder.cpload$25.setreorderaddu$sp,$sp,-16.mask0x40800000,-12sw$23,0($sp)sw$30,4($sp)move$30,$0move$23,$0move$30,$0L.2:addu$23,$23,$30L.3:la$30,1($30)la$24,100ble$30,$24,L.2move$2,$0L.1:lw$23,0($sp)lw$30,4($sp)addu$sp,$sp,16j$311.func.c.frame$sp,0,$31.
3、setnoreorder.cpload$25.setreorderaddu$2,$4,$5L.1:j$31.endadd.globlmain.text.align2.entmainmain:.frame$sp,48,$31.setnoreorder.cpload$25.setreorderaddu$sp,$sp,-48.mask0x82000000,-28.cprestore16sw$31,20($sp)la$24,1sw$24,-4+48($sp)la$24,2sw$24,-8+48($sp)lw$4,-4+48($sp)lw$5,-8+48($sp)jaladdsw$2,-12+48($
4、sp)move$2,$0L.2:lw$25,16($sp)lw$31,20($sp)addu$sp,$sp,48j$31X86汇编Sum.c#includeusingnamespacestd;intmain(){012D1370pushebp012D1371movebp,esp012D1373subesp,0D8h012D1379pushebx012D137Apushesi012D137Bpushedi012D137Cleaedi,[ebp-0D8h]012D1382movecx,36h012D1387moveax,0CCCCCCCCh012D138Crepstosdwo
5、rdptres:[edi]inti,sum;i=0;012D138Emovdwordptr[i],0sum=0;012D1395movdwordptr[sum],0for(i=0;i<=100;i++)012D139Cmovdwordptr[i],0012D13A3jmpmain+3Eh(12D13AEh)012D13A5moveax,dwordptr[i]012D13A8addeax,1012D13ABmovdwordptr[i],eax012D13AEcmpdwordptr[i],64h012D13B2jgmain+4Fh(12D13BFh){sum+=i;012D13B4moveax,
6、dwordptr[sum]012D13B7addeax,dwordptr[i]012D13BAmovdwordptr[sum],eax}012D13BDjmpmain+35h(12D13A5h)return0;012D13BFxoreax,eax}012D13C1popedi012D13C2popesi012D13C3popebx012D13C4movesp,ebp012D13C6popebp012D13C7retFun.cintmain(){009D13E0pushebp009D13E1movebp,esp009D13E3subesp,0E4h009D13E9pushebx009D13EA
7、pushesi009D13EBpushedi009D13ECleaedi,[ebp-0E4h]009D13F2movecx,39h009D13F7moveax,0CCCCCCCCh009D13FCrepstosdwordptres:[edi]inta=1;009D13FEmovdwordptr[a],1intb=2;009D1405movdwordptr[b],2intc;c=add(a,b);009D140