計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告_1_第1頁
計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告_1_第2頁
計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告_1_第3頁
計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告_1_第4頁
已閱讀5頁,還剩9頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告一.流水線中的相關(guān)實(shí)驗(yàn)?zāi)康模?. 熟練掌握windlx莫擬器的操作和使用,熟悉dlx旨令集結(jié)構(gòu)及其特點(diǎn);2. 加深對(duì)計(jì)算機(jī)流水線基本概念的理解;3. 進(jìn)一步了解dlx基本流水線各段的功能以及基本操作;4. 加深對(duì)數(shù)據(jù)相關(guān)、結(jié)構(gòu)相關(guān)的理解,了解這兩類相關(guān)對(duì)cpi性能的影響;5. 了解解決數(shù)據(jù)相關(guān)的方法,掌握如何使用定向技術(shù)來減少數(shù)據(jù)相關(guān)帶來的暫停。實(shí)驗(yàn)平臺(tái):win dlx模擬器實(shí)驗(yàn)內(nèi)容和步驟:1.用windlx模擬器執(zhí)行下列三個(gè)程序:求階乘程序fact.s求最大公倍數(shù)程序gcm.s求素?cái)?shù)程序prim.s分別以步進(jìn)、連續(xù)、設(shè)置斷點(diǎn)的方式運(yùn)行程序,觀察程序

2、在流水線中的執(zhí)行情況,觀察cpi中寄存器和存儲(chǔ)器的內(nèi)容。熟練掌握win dlx勺操作和使用。2. 用windlx!行程序structure_d.s ,通過模擬找出存在資源相關(guān)的指令對(duì)以及導(dǎo)致資源相關(guān)的部件;記錄由資源相關(guān)引起的暫停時(shí)鐘周期數(shù),計(jì)算暫停時(shí)鐘周期數(shù)占總執(zhí)行周期數(shù)的百分比;論述資源相關(guān)對(duì)cpi性能的影響,討論解決資源相關(guān)的方法。3. 在不采用定向技術(shù)的情況下(去掉configuration 菜單中enable forwarding 選項(xiàng)前的勾選符),用windlx!行程序data_d.s。記錄數(shù)據(jù)相關(guān)引起的暫停時(shí)鐘周期數(shù)以及程序執(zhí)行的總時(shí)鐘周期數(shù),計(jì)算暫停時(shí)鐘周期數(shù)占總執(zhí)行周期數(shù)的百

3、分比。在采用定向技術(shù)的情況下(勾選enable forwarding ),用windlx再次運(yùn)行程序data_d.&重復(fù)上述3中的工作,并計(jì)算采用定向技術(shù)后性能提高的倍數(shù)。1.求階乘程序用windlx模擬器執(zhí)行求階乘程序fact.s。這個(gè)程序說明浮點(diǎn)指令的使用。該程序從標(biāo)準(zhǔn)輸入讀入一個(gè)整數(shù),求其階乘,然后將結(jié)果輸出。該程序中調(diào)用了input.s中的輸入子程序,這個(gè)子程序用于讀入正整數(shù)。實(shí)驗(yàn)結(jié)果:在載入fact.s和input.s之后,不設(shè)置任何斷點(diǎn)運(yùn)行。a不采用重新定向技術(shù),我們得到的結(jié)果total:cycle($ executed.id executed bp 145 lnshuctiori

4、($)-2 instruction(s) currently in pipeline. stalls: raw 泅is: 53 (22.46 of all cycles) waw stalls: 0 (0.00 of all ccle)stiuctural stalk 0 (oldo of all cyclescontrol stalls: 25 (1(159% of dl cdesjtrap stals 12 5l08 of all cycles) total:90 stall(s) (30 14 of all cycles)b.采用定向技術(shù),我們得到的結(jié)果:total:215 cycle(

5、s) executedid ewecuted by 145 lnebuclion(*).2instruction(s) current in pipeline.stalls:raw stalk 1 ? (/.91 cf all cycles), thereof:ld stalls: 3 (17.65x of raw stalls branch/jump 3 (17.65 of raw stdh floating point stalls:11(64.70當(dāng)of rawwaw stalls: 0 (0.00 of all cycles)slructural wtallw: 0 o.co of a

6、ll cycles)control stalls:25 (11.63 ot all cycledtrap stalls: 12 (5.58 of al cyclestotal: 54 sull(s) 25.12 of all qdet)從上面的數(shù)據(jù)我們可以看出定向的作用:在定向技術(shù)存在的情況下statistics窗口中的各種統(tǒng)計(jì)數(shù)字:總的周期數(shù)(215)和暫停數(shù)(17 raw, 25 control, 12 trap; 54 total)在定向技術(shù)不存在時(shí)候,控制暫停和trap暫停仍然是同樣的值,而raw 暫停從17變成了53,總的模擬周期數(shù)增加到236。所以定向技術(shù)帶來的加速比:236 /

7、215 = 1.098dlx forwarded 比dlx not forwarded 快9.8%。2.數(shù)據(jù)相關(guān)先給出一個(gè)存在數(shù)據(jù)相關(guān)的程序:lhi r2, (a16) & 0xffffaddui r2, r2, a & 0xfffflhi r3, (b16)&0xffffaddui r3, r3, b&0xffffloop:lw r1,0 (r2)add r1, r1, r3sw 0(r2), r1lw r5, 0 (r1)addi r5, r5, #10addi r2, r2, #4sub r4, r3, r2bnez r4, looptrap #0a: .word 0, 4, 8, 12

8、, 16, 20, 24, 28, 32, 36b: .word 9, 8, 7, 6, 5, 4, 3, 2, 1,0沒有采用定向技術(shù)時(shí)運(yùn)行該程序:得到 rotal: 202 cicle($) executed.id execljled by ei5 instruction(s).2lnstruction(s currently in pipeline.stalis:raw 紡?fù)?04 (51 4眈af all cdeswaw atolls: 0 (0.00 of all cyclesstructural 躺11$:0 (j.oo of all cycles)contirol stalls:

9、 9 (4 4e蠱of al cycles)trap stak: 3 (1.48%of all cyclesto怕i:116 stall(s) (57.42 of oil cycles程序執(zhí)行了202個(gè)周期,10個(gè)數(shù)據(jù)相關(guān)引起的時(shí)鐘周期raw stall為104個(gè)。暫停時(shí)鐘周期數(shù)占總執(zhí)行周期數(shù)的百分比=51.48%采用定向技術(shù)時(shí)運(yùn)行該程序:得到total:12s cycle$) executedid executed by 85 iri2hruction(s).2inskuctionbi cuirently in pipeline.stalls:rawstk 30(23.443:dal cyc

10、les), thereofld 站憑:20 (66.67 of raw 期lg) branchzjump stalls: 1d (33.33 of raw 奴all$floating point stall:0 (0.00 of raw sials)waw slab: 0 (0 00 d all cycles)structural stalls 0 (0 00 of al cycles)cortral stalls: 9 (/.03 of cill cycles)tiap stalls- 3 (2.34 of all clestotal: 42 stal|s) (j2.81 of al cyc

11、les)程序執(zhí)行了128個(gè)周期,共有6個(gè)數(shù)據(jù)相關(guān)引起的時(shí)鐘周期raw stall為30個(gè)。暫停時(shí)鐘周期數(shù)占總執(zhí)行周期數(shù)的百分比=23.44%可見通過定向技術(shù),減少了數(shù)據(jù)相關(guān),縮短了程序的執(zhí)行周期,整個(gè)性能為原來的1.57 倍。3.結(jié)構(gòu)相關(guān)下面這段程序存在結(jié)構(gòu)相關(guān)addi r5, r5, 1subi r4, r4, 1and r3, r3, r3xor r7, r7, r7addi r8, r8, 1addi r9, r9, 1mult r1,r5,r4mult r2,r3,r7執(zhí)行之后得到的clock cycle programeirblrucliare/?1陰:-舊卜日丨ii 一 ti巳廠“

12、it舟卜電i i * t * r彳r彳i彳iiaddi石托血1 | if | id berrmemtb|iand r3j3j3 : | if | id | inlv | mem |nor r7j7j? : | 1卜| id l”s | z ili addi r?油血1 : | if | id | iiw | mem | vje |addi占油血1 : if | id | in段| mem |衛(wèi)鳥!rrdt rlj5j4 ?|_l 血imule兇1j | mem w廠rrdt r2j3j? : if id _| imu丸1 mem v/e statistics: total:20 cycle($

13、) ekecuted.id executed 14 instructior(s).5 lntruction($) currentlv in pipeline.stalls:raw stalls: 0 (0.00 of all cycles, thereof:ld shlls: 0(0.00 d raw stalls)branchalump stalls:0 (0 00 of raw 咖ll$floating point stalls: 0 (0l0ds of raw stalls)waw stalls 0 0.00s;d all cycles)structural 旳胚:4 (20.00 of

14、 all cycles)control stalk: q (0 00 of al cycles)trp stalls: 0 (0.00 of all cycles)i otal: 4 staksj 20.00 of all cycles)可見1個(gè)結(jié)構(gòu)相關(guān)引起了4個(gè)stall,占總共20個(gè)cycle的20%為了避免結(jié)構(gòu)相關(guān),可以考慮采用資源重復(fù)的方法,比如,在流水線機(jī)器中設(shè)置相互獨(dú)立的指令存儲(chǔ)器和數(shù)據(jù)存儲(chǔ)器,也可以將cache分割成指令cache和數(shù)據(jù)cache。二.循環(huán)展開及指令調(diào)度實(shí)驗(yàn)?zāi)康模?. 加深對(duì)循環(huán)級(jí)并行性、指令調(diào)度技術(shù)、循環(huán)展開技術(shù)以及寄存器換名技術(shù)的理解;2. 熟悉用指令調(diào)度技術(shù)

15、來解決流水線中的數(shù)據(jù)相關(guān)的方法;3. 了解循環(huán)展開、指令調(diào)度等技術(shù)對(duì)cpi性能的改進(jìn)。實(shí)驗(yàn)平臺(tái):windlx模擬器 實(shí)驗(yàn)內(nèi)容和步驟: 1 ?用指令調(diào)度技術(shù)解決流水線中的結(jié)構(gòu)相關(guān)與數(shù)據(jù)相關(guān)(1 )用dlx匯編語言編寫代碼文件*.s,程序中應(yīng)包括數(shù)據(jù)相關(guān)與結(jié)構(gòu)相關(guān)(假設(shè):加法、乘法、除法部件各有2個(gè),延遲時(shí)間都是3個(gè)時(shí)鐘周期)(2)通過configuration菜單中的floating point stages選項(xiàng),把加法、乘法、除法部件的個(gè)數(shù)設(shè)置為2個(gè),把延遲都設(shè)置為3個(gè)時(shí)鐘周期;(3)用如dlx運(yùn)行程序。記錄程序執(zhí)行過程中各種相關(guān)發(fā)生的次數(shù)、發(fā)生相關(guān)的指令組合,以及程序執(zhí)行的總時(shí)鐘周期數(shù);(4

16、)采用指令調(diào)度技術(shù)對(duì)程序進(jìn)行指令調(diào)度,消除相關(guān);(5運(yùn)行調(diào)度后的程序,觀察程序在流水線中的執(zhí)行情況,記錄程序執(zhí)行的總時(shí)鐘周期數(shù);(6)根據(jù)記錄結(jié)果,比較調(diào)度前和調(diào)度后的性能。論述指令調(diào)度對(duì)于提高cpu性能的意義。2.用循環(huán)展開、寄存器換名以及指令調(diào)度提高性能(1 )用dlx匯編語言編寫代碼文件*.s,程序中包含一個(gè)循環(huán)次數(shù)為4的整數(shù)倍的簡(jiǎn)單循環(huán);(2運(yùn)行該程序。記錄執(zhí)行過程中各種相關(guān)發(fā)生的次數(shù)以及程序執(zhí)行的總時(shí)鐘周期數(shù);(3)將循環(huán)展開3次,將4個(gè)循環(huán)體組成的代碼代替原來的循環(huán)體,并對(duì)程序做相應(yīng)的修改。然后對(duì)新的循環(huán)體進(jìn)行寄存器換名和指令調(diào)度;(4運(yùn)行修改后的程序,記錄執(zhí)行過程中各種相關(guān)發(fā)生的

17、次數(shù)以及程序執(zhí)行的總時(shí)鐘周期數(shù);(5)根據(jù)記錄結(jié)果,比較循環(huán)展開、指令調(diào)度前后的性能。3)存在相關(guān)的程序1.指令調(diào)度:首先,通過configuration菜單中的白o(hù)ating point stages選項(xiàng),把除法單元數(shù)設(shè)置為3,把加法、乘法、除法的延遲設(shè)置為3個(gè)時(shí)鐘周期。給出調(diào)度前的程序sch_bef:.data.global oneone: .word 1.text.global mai nmain:lf f1,one ;turn divf into a movecvti2f f7,f1 ;by stori ng in f7 1 innop ;float in g-po int forma

18、tdivf f1,f8,f7 ;move y=(f8) into f1divf f2,f9,f7 ;move z=(f9) into f2addf f3,f1,f2divf f10,f3,f7 ;move f3 into x=(f10)divf f4,f11,f7 ;move b=(f11) into f4divf f5,f12,f7 ;move c=(f12) into f5multf f6,f4,f5divf f13,f6,f7 ;move f6 into a=(f13)fi nish: trap 0 運(yùn)行之后可以得到結(jié)果:total:27cicle(s) executed.id exec

19、uted by 12lnshuction($._ lnstfuction|x currently in pipeline.stalls :raw stalls: 9 (33.33鬼of all cycles thereof:ld 治陸 1 (11 1uof raw stalls)branch al ump stalls: 0 0.00 龕of raw stals)floatirg point stalls: 8 1 qqloosf of raw stals)waw stalls:0 (0.003:of all cvciejstructural 如ils:0 (0.00 of all cycle

20、dconlrd stalls: 0 (0.00x of dl cydes)t rap dale 1(25l92% of dl 匚yck制total: l6stall(s) (59.26 of all cycles調(diào)度之后的程序sch_aft:.data.global oneone: .word 1.text.global mai nmain:lf f1,one ;turn divf into a movecvti2f f7,f1 ;by stori ng in f7 1 innop ;float in g-po int formatdivf f1,f8,f7 ;move y=(f8) into

21、 f1divf f2,f9,f7 ;move z=(f9) into f2divf f4,f11,f7 ;move b=(f11) into f4divf f5,f12,f7 ;move c=(f12) into f5addf f3,f1,f2multf f6,f4,f5divf f10,f3,f7 ;move f3 into x=(f10)divf f13,f6,f7 ;move f6 into a=(f13)fi nish:trap 0運(yùn)行之后得到:lota 丄21 c vc i b(s)executed.id executed by 12 instruction($).2instruct

22、ion(s) currently in pipeline.stal is:raw 獻(xiàn)alb: 3 (14.2qk of al cycles), lhereaf: ld stalk 1 (33 33 of raw stalk branch/jump stak: 0 (0.00% of raw sials floating point sldk 2舊6.67w of raw stalls)waw stalls: 0 (0 00 nf all cyclesstiuctural stalls: 0 (0.30sof all cyclescontrol stalls: cl (0.00 of all c

23、yclestrap stab: e (29157x of dl cycledtotal: 9 stdb) (42.bg% of all cycles) 可以看出經(jīng)過調(diào)度之后 運(yùn)行周期從27減少到21,而且減少了相關(guān)。2.循環(huán)展開:循環(huán)展開前的程序:lhi r2, (a16 )& oxffffaddui r2, r2, a&0xfffflhi r3, (b16) &0xffffaddui r3, r3, b&0xffffaddu r4, r0, r3noploop:subi r4, r4, #8sub r5, r4, r2bnez r5, looptrap #0a:.double 1,2, 3,

24、 4b: .double 1,2, 3, 4運(yùn)行結(jié)果:statistics 一| |total:30 cycled ecuted.id executed bv i9ln$truction($).2 instruction(s) currently nn pipeline.hardware conf iguration:memory size: 32768 bytes faddex-stages: 1“ required cycles: 2 fmulex-shges: l required ccle$: 5 fdivex-stagec: 1, required cycles:19 forward

25、ing enabled.stalls:raw sc 4 (1333需of all cycles), thereof: ld stalls: 0 (0.00 of raw stalls) branch/jump stalls:4 (100.00% of raw ttek) floating point stals: 0 (0. 00 of raw stall)waw stalls 0 d o號(hào)of all cycles) strudurd stalls: l (0 00k of all cycled control tta*3(10.00 of al cycles) trap stalls; 3 (1o oox of all cycles) total: 10 stall(s) (33.33 of all cycles)循環(huán)展開后的程序:r2, (a16 )& oxfffflhiaddui r2, r2, a&oxfffflhi r3, (b16) &0xffffaddui r3, r3, b&0xffffaddu r4, r0, r3subi r4, r4, #8subi r4, r4, #8 subi r4, r4,

溫馨提示

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

評(píng)論

0/150

提交評(píng)論