北郵計算機系統(tǒng)結(jié)構(gòu)實驗報告-實驗一到五-WINDLX模擬器_第1頁
北郵計算機系統(tǒng)結(jié)構(gòu)實驗報告-實驗一到五-WINDLX模擬器_第2頁
北郵計算機系統(tǒng)結(jié)構(gòu)實驗報告-實驗一到五-WINDLX模擬器_第3頁
北郵計算機系統(tǒng)結(jié)構(gòu)實驗報告-實驗一到五-WINDLX模擬器_第4頁
北郵計算機系統(tǒng)結(jié)構(gòu)實驗報告-實驗一到五-WINDLX模擬器_第5頁
已閱讀5頁,還剩37頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、北京郵電大學(xué)實驗報告課程名稱計算機系統(tǒng)結(jié)構(gòu)計算機學(xué)院2016111303班王陳(2016110711)目錄實驗一 windlx模擬器安裝及使用3實驗準(zhǔn)備錯誤!未定義書簽。實驗環(huán)境錯誤!未定義書簽。實驗步驟錯誤!未定義書簽。實驗內(nèi)容及要求錯誤!未定義書簽。實驗過程錯誤!未定義書簽。實驗總結(jié)8實驗二指令流水線相關(guān)性分析9實驗?zāi)康?實驗環(huán)境9實驗步驟9實驗過程錯誤!未定義書簽。實驗總結(jié)16實驗三 dlx處理器程序設(shè)計17實驗?zāi)康?7實驗環(huán)境錯誤!未定義書簽。實驗步驟錯誤!未定義書簽。實驗過程17a. 向量加法代碼及性能分析17b. 雙精度浮點加法求和代碼及結(jié)果分析22實驗總結(jié)26實驗四代碼優(yōu)化27實

2、驗?zāi)康?7實驗環(huán)境錯誤!未定義書簽。實驗原理27實驗步驟錯誤!未定義書簽。實驗過程27實驗總結(jié)+實習(xí)體會32實驗五循環(huán)展開32實驗?zāi)康?2實驗環(huán)境錯誤!未定義書簽。實驗原理32實驗步驟錯誤!未定義書簽。實驗過程32矩陣乘程序代碼清單及注釋說明32相關(guān)性分析結(jié)果38增加浮點運算部件對性能的影響38増加forward部件對性能的影響38轉(zhuǎn)移指令在轉(zhuǎn)移成功和轉(zhuǎn)移不成功時候的流水線開銷38實驗總結(jié)+實習(xí)體會+課程建議38實驗一 windlx模擬器安裝及使用windlx模擬器的結(jié)構(gòu)和功能說明1 點擊運行之后,會看到一個如下圖所示的窗口。它包括 regis ter, code, pipeline, clo

3、ck cycle diagram, statistics, breakpointso接下來詳細介模擬器的結(jié)構(gòu)及各個部件的功能。2. register 窗口介紹rigister窗口屮顯示的是各個寄存器的名稱及內(nèi)容。如下圖:he vndow execute memory qonfigurabon registerregisterpc=.0x00000100r8 =0x00000000f0 =0f24 =0imar=0x00000000r9 =0x00000000fl =0f25 =0ir=0x00000000r10 =0x00000000f2 =0f26 =00x00000000rll =0x00

4、000000f3 =0f27 =0ahi =0x00000000r12 =0x00000000f4 =0f28 =00x00000000r13 =0x00000000f5 =0f29 =0bhi =0x00000000r14 =0x00000000f6 =0f30 =0bta=0x00000000r15 =0x00000000f7 =0f31 =0alu=0x00000000r16 =0x00000000f8 =0d0 =0aluhi=0x00000000r17 =0x00000000f9 =0d2 =0fpsr=0x00000000r18 =0x00000000f10 =0d4 =0dmar

5、=0x00000000r19 =0x00000000fll =0d6 =0sdr-0x00000000r200x00000000f12-0d8-0sdrhi0x00000000r21-0x00000000f13-0d10-0ldr-0x00000000r22-0x00000000f14-0d12-0ldrhi0x00000000r23-0x00000000f15-0d14-0r0 =0x00000000r24 =0x00000000f16 =0d16 =0rl =0x00000000r25 =0x00000000f17 =0d18 =0r2 =0x00000000r26 =0x00000000

6、f18 =0d20 =0r3 =0x00000000r27 =0x00000000f19 =0d22 =0r4 =0x00000000r28 =0x00000000f20 =0d24 =0r5 =0x00000000r29 =0x00000000f21 =0d26 =0r6 =0x00000000r30 =0x00000000f22 =0d28 =0r7 =0x00000000r31 =0x00000000f23 =0d30 =0可以看到寄存器中以十六進制標(biāo)識,從上圖可以看出各個寄存器中的內(nèi)容。2. code窗口介紹在沒有進行任何執(zhí)行的時候,初次打開code窗i,即為卜圖所示殳 windlxf

7、ile win dow execute memory con figuratio n codecode$text0x00000000nop$t ext+0x40x00000000nop$t ext+0x80x00000000nop$text+0xc0x00000000nop$t ext+0x100x00000000nop$t ext+0x140x00000000nop$t ext+0x180x00000000nop$text+0x1c0x00000000nop$t ext+0x200x00000000nop$t ext+0x240x00000000nop窗】i現(xiàn)實的信息是齊個存儲器內(nèi)同。第一列

8、標(biāo)識存儲器的地址;第二列是機 器代碼,用16進制表示;第三列是匯編指令。當(dāng)我們點擊上方的eecute ,可以選擇單步或多步執(zhí)行(也可以使用快捷鍵 f7或f8)。若選擇單步執(zhí)行,每按一次f7,指令執(zhí)行一次,可以看到,一次執(zhí) 行的為if->id->intex->mem->wb,沒執(zhí)行一次還有顏色的變化。顏色是用來標(biāo) 識指令處于哪個流水段的,如下圖。$text0x00000000nop$t ext+0x40x00000000nop$t ext+0x80x00000000 wbnop$text+0xc0x00000000 memnop| $t ext+0x100x0000000

9、0 intexnop$t ext+0x140x00000000 idnop$t ext+0x180x00000000 ifnop$text+0x1c0x00000000nop$t ext+0x200x00000000nop$t ext+0x240x00000000nop當(dāng)然,我們也可以使用多步執(zhí)行,按快捷鍵f8,選擇5步流水,即可。3. pipeline 窗口介紹通過閱讀windlx模擬器說明書可以知道,pipeline窗口顯示的是dlx處理 器的內(nèi)部結(jié)構(gòu)。窗口用下圖標(biāo)識dlx五段流水。當(dāng)然,如同code窗口介紹講述 的那樣,不同的顏色顯示了指令處于哪段流水線。使用快捷鍵f7單步執(zhí)行,可 以明

10、顯的看出,不同時候流水段執(zhí)行的不同指令。如下圖。int-stagesfaddexfmulexfdivexwbnop$t ext+0x8圖片反映的正式與code屮所處的時刻相同的指令流水。可以清晰看到不同 流水段執(zhí)行的是哪條指令。4. clock cycle diagram 窗口實驗準(zhǔn)備中我們已經(jīng)知道,該窗口顯示的是流水線的時空圖。時空圖反映的 是不同時隙內(nèi)的運行情況。如下圖。clock cycle diagraminstructions / cyclesnopnopnopnopnopif idifnopnop在我看來,時空圖是最好理解的。因為它反映的就是流水段的并行程度。在 這個dlx模擬器屮

11、,并不存在一些數(shù)據(jù)或者控制上的沖突問題。所以可以依靠上 圖很清晰的看到指令所處的不同流水段,及指令執(zhí)行情況。該時空圖同樣也是和 前面的code等相對應(yīng)。也可以通過快捷鍵f7來進一步執(zhí)行指令,可以看到流水 線時空圖的擴展情況。任意雙擊指令的一行,可以詳細看到不同流水段的情況。如下圖所示。information about nopnopack.: $textcode: 0x00000000t erminated successfullyfirst cycle: -6last cycle: -2t otal cycles: 5ifcycles: -6(1)t erminated successful

12、lyi mar < pc (=$text)ir<-memimar (=0x00000000) pc<-pc+4 (=$text+0x4)no stalls required.idcycles: -5(1)t erminated successfully a<-r0(=0x0) no stalls exmemwbcycles: 4(1)cycles: -3(1)cycles: -2(1)t erminated successfullyt erminated successfullyt erminated successfullyalu<-a&

13、#171;0 (=0x0)nothing to do.r0<-alu (=0x0)no stalls required.no forwarding.no stalls required.no stalls required.5. statistics 窗口介紹該窗口是對運行程序中的數(shù)據(jù)進行分析。主要包括模擬器中硬件配置情況, 在該窗口中,我們可以比較不同配置對于該模擬器的不同影響。如卜圖所示。1) 整體指令執(zhí)行情況total:7 cycle(s) executed.id executed by 6 instruction(s).5 instruction(s) currently in

14、pipeline.2) 碩件配置情況hardware conf iguration:memory size: 32768 bytes faddex-stages: 1 z required cycles: 2 fmulex-stages: 1 z required cycles: 5 fdivex-stages: 1. required cycles: 19 forwarding enabled.3)暫停次數(shù)和百分比及原因分析stalls:raw stalls: 0 (0.00 of all cycles), thereof:ld stalls: 0(0.00 of raw stalls)br

15、anch/jump stalls: 0 (0.00 of raw stalls) floating point stalls: 0 (0.00 of raw stalls)waw stalls: 0 (0.00 of all cycles)structural stalls: 0 (0.00 of all cycles) control stalls: 0 (0.00 of all cycles) t rap stalls: 0 (0.00 of all cycles) t otal: 0 stall(s) (0.00 of all cycles)4) 分支次數(shù)和百分比conditional

16、branches):total: 0 (0.00 of all instructions), thereof: taken: 0 (0.00 of all cond. branches) not taken: 0 (0.00 of all cond. branches)5) load/store指令執(zhí)行情況load-/store-instruetions:total: 0 (0.00 of all instructions thereof: loads: 0 (0.00 of load-/store-lnstructions) stores: 0 (0.00 of loadvstore-lns

17、tructions)6) 浮點指令執(zhí)行次數(shù)和百分比floating point stage instructions: total: 0 (0.00 of all instructions thereof:additions: 0 (0.00 of floating point stage insl) multiplications: 0 (0.00 of floating point stage inst.) divisions: 0 (0.00 of floating point stage inst.)7) trap發(fā)生的次數(shù)和百分比traps:traps: 0 (0.00 of all

18、 instructions)6. breakpoints 窗口介紹該窗口使用來觀察代碼運行情況。先打開breakpoints窗口,點擊窗口上方 的breakpoints來設(shè)置breakpoint,也就是設(shè)置指令運行到流水線的哪個階段程勛 停止執(zhí)行。如上圖,如果選擇ex階段,在code窗口屮相應(yīng)的行會出現(xiàn)bex,即指令執(zhí)行到譯碼結(jié)束執(zhí)行開始的時候,程序?qū)⒅兄?。實驗總結(jié)通過本次試驗,由于是第一次接觸dlx模擬器,該試驗?zāi)軌驇椭覍@個模 擬器大致的功能及使用做個大致的了解。對于日后的實驗打卜好的基礎(chǔ)。我覺得windlx模擬器小而精悍,它冇不同顏色的標(biāo)記,不同寄存器及存儲 器的反映。通過使用它,可以

19、對5步流水的過程及不同階段很清楚明口的看到。 也可以看到不同指令分析走到了哪一步,到了哪一步流水段。實驗二指令流水線相關(guān)性分析實驗?zāi)康耐ㄟ^使用windlx模擬器,對程序中的三種相關(guān)現(xiàn)象進行觀察,并對使用 專用通路,壇加運算部件等技術(shù)對性能的影響進行考察,加深對流水線和risc處理器的特點的理解。實驗環(huán)境windows xp操作系統(tǒng)windlx模擬器實驗步驟1. 觀察程序中出現(xiàn)的數(shù)據(jù)/控制/結(jié)構(gòu)相關(guān)。指出程序中出現(xiàn)上述現(xiàn)彖的指令 組合。2. 考察增加浮點運算部件對性能的影響。3. 考察增加forward部件對性能的影響。4. 觀察轉(zhuǎn)移指令在轉(zhuǎn)移成功和轉(zhuǎn)移不成功時候的流水線開銷。1. 觀察程序中出

20、現(xiàn)的數(shù)據(jù)/控制/結(jié)構(gòu)相關(guān);指出程序中出現(xiàn)上述現(xiàn)象的指令組 合。1)數(shù)據(jù)相關(guān)如卜圖所示,在clock cycle diagram窗口所想是的時空圖中和pipeline 窗口中的流圖屮,第一次岀現(xiàn)了 r-stall。iiirtstfucbons / cyclestrap 0x5t-stallid17 . -16 . -15 . -14if ildami r14a0x1084:ifid bhtex | mem wbn1 e trap 0x3if it-stal|血 i r2a0x1034addirkoxodcidi r4.f0,0xaibu 00x0(if | id | “ex 1 mer |seq

21、i r5j3,0xaif | idbnez r5>iput. finishif_ f | mem | rstal 亍i廠subi r3j3z0x30u;n addi rajo.oxa0x00000170接下來可以點擊上圖中的橘色窗口,則屏幕顯示in pipelinea<-r3 (=0x0)1 stall(s) because of raw-hazard with ibu r30x0(r2)lbu r3, 0x0(r2)要在wb周期寫回r3屮的數(shù)據(jù);而下一條指令seqi r5, r3, oxa 要在intex周期中讀取r3中的數(shù)據(jù)。上述過程發(fā)生了 wr沖突,即寫讀相關(guān)。為了避免此類沖

22、突, seq r5, r4, oxa的intex指令延遲了一個周期進行。由此,相關(guān)指令為:input. loop0x90430000ibu r3z0x0(r2)0x000001780x6065000a memseqi r5j3,0xa2) 控制相關(guān)clock cycle diagram:111if | id | intex |mem |i:if | idintex |ii;ifiiiiiiiiiiiiabortedifinstructions / cyclesaddi r1 jo.oxi 000 同 inputunsigned movi2fp f10j1 $w saver2(ro)j2由上圖可

23、以看出,在第4時鐘周期:第一條指令處于mem段;第二條命令處 于intex段;第三條指令出于aborted狀態(tài);第四條命令處于1f段。原因分析:jal inputunsigned是無條件分支指令,但當(dāng)?shù)谌齻€周期開始的時候, 也就是jal這條指令被譯碼后才知道。此吋,movi2fp已經(jīng)執(zhí)行,月.將要執(zhí)行的 下一條命令在另外一個地址處,所以這條指令不會執(zhí)行,這個吋候就會發(fā)生控制 相關(guān)。由此,發(fā)生控制相關(guān)的指令為:0x000001440xac021094 ifswsaver2(r0)zr23) 結(jié)構(gòu)相關(guān)首先,我們先來看一下執(zhí)行過控制相關(guān)的時空圖和pipeline,如下圖。zeiaddi r4x)z0

24、xabu r3,qxo(r2)seqi r5zr3xlxasubi(343,0x30muftur1jlzr4add r1 zr3addi 2f2o<1jirpii.loopinslructorts / cycjesbnez r5jnp ul. finish|f addi r2j2z0x1 30000018cadd r1zd j3il |0x000q0188工intez:emem 二1multu r1 j1 丿 4mom 84當(dāng)我們點擊pipeline中tf所對應(yīng)的框框可以看到詳細的該指令執(zhí)行情況,如下 圖:ifcycles: -2(3)in pipelineimar<-pc (=i

25、nput.loop+0x18) ir<-memimar (=0x20420001)pc<-pc+4 (=input.loop+0x1 c)2 stall(s) because of structural hazard!上圖表明了 addi r2,r2, 0x1的詳細信息。該指令與它前一條指令addrl,rl,r3 發(fā)生了結(jié)構(gòu)相關(guān)。并且由于此處的沖突,需要暫停2個周期。在id段暫停后, 則開始進圖intex段。所以這條指令(addi r2,r2,0xl)你不能進入id流水段, 譯碼部分占用,發(fā)生了結(jié)構(gòu)相關(guān)。該部分的指令為:0x000001880x00230820add r1 j1 j

26、30x0000018c0x20420001addi r2j2,0x12. 考察增加浮點運算部件對性能的影響。該實驗取n=6 首先通過 figuration,點擊 floating point stage configuration 來設(shè)置浮點 運算部件的配置。由于實驗手冊上面要求delay二4,所以我們將delay這一欄改 成4,而count可以任意,為了對比,我們第一次浮點運算部件取全部為2,第 二次浮點運算部件取全部為3。如卜圖所示:運行50個cycles z后,可以看到他們數(shù)據(jù)的對比:total:50 cycle(s) executed id executed by 32 instruc

27、bonjsj.4 instrucdon(s) currently in pipeine.hardware conf iguration: memory size: 32768 bytes faddex-stages: 3, required cycles: 4 fmulex-stages: 3, required cycles: 4 fdivex-stages: 3. required cycles: 4 forwarding enabledstalls:raw 9 (18.00n d al cycte$l tfweof ld stalls: 2 (22 尬 of raw branch/jum

28、p stafc 2 (2222 of raw floating point $ta*$ 5 (55 56z of raw stalls)waw stalls: ofo otal cydes) structural stalls: 0 (0 00 of al cydes) control stalls: 4 (8 00 of al cycles) t rap stalls: 6 (12 00% of al cycles) to(al: 19 stall($)(3800olal cycles)conditional branches):t otal: 2 (6 25% of all irttbuc

29、tioml thereof taken: 1 (50 00 of al cond branches) not taken: 1 (50 00 of al cond branches)load-/s t ore-instruct!ons:t otal: 11 (34.38% of al ln$bucbon$t thereof: loads: 6 (54 54 of load-/store-lnstructions) stores: 5 (45 45 o( loadtsto(e4n$tructions)floating point stage instructions: t otal: 1 (3.

30、12 of all insbucbonsl thereof:additions: 0 (0.00 of floating point stage inst.) multiplications: 1 (100.00 of floating point stage inst.) divisions: 0 (0.00 of floating point stage inst.)traps: t raps: 2 (6.25鬼 of all instrucbons)hardware conf iguration: memory size: 32768 bytes faddex-stages: 2z re

31、quired cycles: 4 fmulex-stages: 2# required cycles: 4 fdivex-stages: 2z required cycles: 4 forwarding enabled.stalls:raw stalls: 9 (18.00 of all cycles), thereof: ld stalls: 2 (22.22 of raw stalls) branch/jump stalls: 2 (22.22% of raw stalls) floatinq point stalls: 5 (55.56之 of raw stallswaw stalls:

32、 0 (0.00 of all cycles) structural stalls: 0 (0.00 of all cycles) control stalls: 4 (8.00 of all cycles) t rap stalls: 6 (12.00 of all cycles) total: 19 stall(s) (38.00 of all cycles)conditional branches):total: 2 (6.25 of all instructions), thereof: taken: 1 (50.00 of all cond. branches) not taken:

33、 1 (50.00 of all cond. branches)load-/stcttb-instruotions : total: 11 (34.38 of all instructions), thereof:loads: 6 (54.54n of load7s tore-l nstructions)stores: 5(45.45% of loadvstore-lnstructions)floating point stage instructions: total: 1 (3.12 of all instructions thereof:additions: 0 (0.00 of flo

34、ating point stage inst.) multiplications: 1 (100.00 of floating point stage inst.) divisions: 0 (0.00 of floating point stage inst.)由此可見,浮點運算部件的增減對效率無影響。比較各個數(shù)據(jù),發(fā)現(xiàn)沒有變 化。無論怎么增加浮點運算部件,統(tǒng)計結(jié)果都一樣。原因在于此程序小浮點計算 指令沒有重疊,所以并行度沒有增加,性能沒有提高。3.考察增加forward部件對性能的影響。為了對比有無forward部件的性能。需要在configuration中勾選enable forward

35、ing,以及不勾選enable configuration來看性能數(shù)據(jù)的對比。不使用forward部件:11 statisticstotail:50 cycle($) executed.id executed by 27 in4 instruction(s) currently m pipeinehardware configuration imemory size: 32768 bytesfaddex-sages: 3, requited cycles 4 fmulex-stage$: 3, requued cycles 4 fdivex-stages: 3, requwed cycles

36、4 forwarding disabledstalls:raw stalls: 13 (26 00 ol al cycles) waw stalls: 0 (0 00 of al cycles) structural stalls: 0 (0 00<> of al cydes) control stalls: 3 (6.0吆 of al cyctes) trap stalls: 6 (12.qg% o( al cycles)t otal: 22 stall(s) (44.00 of al cydes)使用forward部件:total:50 cycle(s) executed.id

37、 executed by 32 instnjcbon®4 instruction(s) currently in pipeinehardware conf1gurationmemory size: 32768 bytes faddex-slages: 3, requued cycles 4 imulex-stages: 3required cycles 4 fdivex-stages: 3, requtted cycles 4 forwarding enabled,stalls:raw 鮒 11$: 9 (18 00 of al cyde theieof: ld stalls: 2

38、(22.222; ol raw sials) branch/jump stalls: 2 22 22% of raw stalls) floating point stalls: 5 (55 56 of raw stalls)waw stalls: 0 (0.00 d afl cycles) structural stalls: 010 00 of al cycles) control stalls: 4 (8.00 of al cycles) trap stalls: 6 (12.00 of al cycfes) t otal: 19 stall(s) (38.00 of al cydes)

39、從上面的數(shù)據(jù)我們可以看出增加forwardi部件后raw由原來占總時鐘周期 的26%減少至18%, raw個數(shù)由原來的13減少至9o增加forward部件使得控制 相關(guān)比例増加了。即,使用foard部件后,總的時鐘周期減少,數(shù)據(jù)相關(guān)減少, 流水線的性能得到一定的改善。3. 觀察轉(zhuǎn)移指令在轉(zhuǎn)移成功和轉(zhuǎn)移不成功時候的流水線開銷。我們假設(shè),浮點部件設(shè)置count二3, dclay=4;n=6o執(zhí)行完畢后,查看條件轉(zhuǎn)移分支,如下圖所示:conditional branches):total: 8 (12.12n of all instructions), thereof: taken: 2 (25.0

40、0 of all cond. branches) not taken: 6 (75.00% of all cond. branches)由上圖可知,轉(zhuǎn)移指令一共8條,成功轉(zhuǎn)移2條(占25%),不成功為6條。 所以,靜態(tài)指令調(diào)度算法只能解決數(shù)據(jù)相關(guān),條件轉(zhuǎn)移結(jié)果與原來相比沒冇變化。 即,若轉(zhuǎn)移不成功,對流水線的執(zhí)行無影響,流水線的呑吐率和效率沒有降低; 若轉(zhuǎn)移成功,則耍廢棄預(yù)先讀入的指令,重新從傳移成功處讀入指令,執(zhí)行效率 會下降。實驗總結(jié)本次試驗中,主要遇見一個問題,就是在當(dāng)初文件加載時沒有成功,后來通 過查詢資料和自己的嘗試,發(fā)現(xiàn),在選擇文件的順序很關(guān)鍵,它決定了文件在存 儲器中出現(xiàn)的順序。

41、本次實驗,主耍通過對于三中相關(guān)的觀察,分析出現(xiàn)相關(guān)時的指令,分析浮 點運算部件和forward部件對性能的影響,觀察轉(zhuǎn)移指令在轉(zhuǎn)移成功和不成功時 的流水線開銷,這些實驗一步一步,通過windlx形象生動的表示,使我在實踐 屮更加深入的認識了流水線。實驗三dlx處理器程序設(shè)計實驗?zāi)康膶W(xué)習(xí)使用dlx匯編語言編程,進一步分析相關(guān)現(xiàn)象實驗過程a.向量加法代碼及性能分析首先給據(jù)題目要求,需耍熟練掌握dlx編程語言,然后根據(jù)規(guī)范格式編寫向量的 代碼。1) 向量聲明vectorlength: . word 16/聲明向量長度vectorl: .word 1, 2, 3, 4, 5, 6, 7, 8, 9,

42、10, 11, 12, 13, 14, 15, 16 聲明兩個向量 vectorl 和 vector2vector2:. word 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16result:. space 4/聲明一個空間來存放打印的數(shù)據(jù)loop:/循環(huán)體id f 10, vectorl (r2)id fl2, vector2(r2)/讀入兩個提前聲明的向量add f4, f2, fo/加法運算trap 5/系統(tǒng)中斷2) 源代碼uector2: .word 1,2,3,4,5,&& printf! : .asciiz

43、 ,buector =*printf2 : .asciizb, zf".align 2printprompt:.word printfiprintpar:. viord printf2result:.space 4.textmain :addi r14»ro,printprompttrap 5lw r20»uectorlengthaddi r2,r0,0loop :id f10,uector1(r2)id f12,uector2(r2)cuti2d f0.f1ocuti2d f2,f52addd f4,f2,f0finish :sd result ,f4addi

44、r14»ro,printpartrap 5addi r2,r2,4subi r2o,r20,1bnez r209looptrap 0運行結(jié)果分析當(dāng)運行到如下圖所示的時候,則表示運行結(jié)束。運行結(jié)果為 dlx-standard-1/ovector = 2.000000 4.000000 6.000000 8.000000 10.000000 12.0000000000 18.000000 20.000000 22.000000 24.000000 26.000000 28.000000000014.000000 16.0c30.000000 32.0c接卜來我們可以杳看statistic

45、s可以看到運行結(jié)杲的數(shù)據(jù)顯示,如卜圖所示。total:283 cycle(s) executed.id executed by 181 instruction(s). 2 instruction(s) currently in pipeline.hardware conf iguration: memory size: 32768 byles faddex-stages: 1 z required cycles: 2 fmulex-slages: 1z required cycles: 5 fdivex-slages: 1z required cycles: 19 forwarding ena

46、bled.stalls:raw stalls: 32 (11.31 of all cycles), thereof:ld stalls: 0 (0.00 of raw stalls)branch/jump stalls: 16 (50.00 of raw stalls) floating point stalls: 16 (50.00 of raw stalls) waw stalls: 0 (0.00 of all cycles) structural stalls: 0 (0.00 of all cycles) control stalls: 15 (5.30 of all cycles)

47、 t rap stalls: 54 (19.08 of all cycles) total: 101 stall(3570% of all cycles)conditionad branches):tolal: 16 (8.84 of all instructions), thereof: taken: 15 (93.75% of all cond. branches) not taken: 1 (6.25 of all cond. branches)load-/store-instruct ions:total: 49 (27.07 of all instructions), thereof

48、:loads: 33 (67.35n of load-/s tore-l nstructionss lores: 16 (32.65之 of load-/storejnshuctions)floating point stage instructions: total: 16 (8.84 of all instructions thereof:additions: 16 (100.00 of floating point stage inst) multiplications: 0 (0.00 of floating point stage inst) divisions: 0 (0.00 o

49、f floating point stage inst.)traps:traps: 18 (9.94% of all instructions)1)程序相關(guān)性分析結(jié)果數(shù)據(jù)相關(guān)由上圖的 raw stalls: 32 (11.31 of all cycles), thereof:可以看出,該程序產(chǎn)生了 11.31% 的數(shù)據(jù)相關(guān)。所以當(dāng)對當(dāng)前指令的操作數(shù)寄存器進行操作(ex)的時候,前幾條 指令的運算結(jié)果還未寫回(wb)結(jié)果寄存器,曲此產(chǎn)生數(shù)據(jù)相關(guān)。結(jié)構(gòu)相關(guān)由于程序只簡單的做了一次加法,所以沒冇結(jié)構(gòu)相關(guān)產(chǎn)生??刂葡嚓P(guān)查看pipeline 可以看到,當(dāng)執(zhí)行到如下情況吋,發(fā)生了控制相關(guān)。addi r14

50、zr0z0x1098if i stall id1 information about trap 0x5trap 0x5adr.: finish+0x8code: 0x44000005t erminated successfullyfirst cycle: -12last cycle:5t otal cycles: 8ifcycles: -12(4)t erminated successfullyi mar < pc (=finish+0x8)i r<-meml mar )(=0x44000005)pc<-pc+4 (=finish+0xc)3 stall(s) because

51、 oft rap-pipeli necle8i ng!idcycles: 8(1)t erminated successfully system call executed.no stalls exmemwbcycles: -7(1)t erminated successfully nothing to do.no stalls required.no forwarding.cycles: -6(1)t erminated successfully nothing to do.no stalls required.cycles: -5(1)t erminated suc

52、cessfully nothing to do.no stalls required.irap 0x5ift-stall由 statistics 中的 control stalls: 15 (5.30 of all cycles)可以看出,其控制相關(guān)發(fā) 生了 5.3%。分析可知,由于系統(tǒng)按照預(yù)測成功來執(zhí)行指令,所以執(zhí)行bnez h馬 上將其下一條指令trap讀進來。2)浮點運算部件帶來的影響當(dāng)我們通過設(shè)置浮點部件的個數(shù),并將程序運行完畢,查看statistics中的數(shù) 據(jù)作對比。如下圖所示。totail :283 cycle(s) executed id executed by 181 ln$

53、truct>or)().2 instruction(s) currendy in rpehne.hair-dwai2?e conf igujtslt xon : memory size: 32768 bytes faddexst&geu 4 requited cycles: 2 fmulex-stages: 4, requtfed cycles 5 fdivex-stages: 4“ required cycles: 19 forwarding eriabled.stalls: raw stalls: 32 (11 3= n ol al cydesl theieof:ld sta

54、lls: 0 (0 00 ol raw stals) branch/jump stals: 16(50 oon of raw stalls) floating point stalls 16 (50 00 of raw stalls) waw stalls: 0 (0 cm ot al cycles) structural 0 (0 oon of al cydesj control stalls: 15 (5 30 ot al cycles) t rap stalls: 54 (19 08 of al cycles) total: 101 stall(35 70% oi al cycles)cond11 iona1 branches) total: 16 (8 842 of at

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論