最新lab3复杂流水线实验报告.docx

上传人:b****5 文档编号:6102739 上传时间:2023-01-03 格式:DOCX 页数:9 大小:19.64KB
下载 相关 举报
最新lab3复杂流水线实验报告.docx_第1页
第1页 / 共9页
最新lab3复杂流水线实验报告.docx_第2页
第2页 / 共9页
最新lab3复杂流水线实验报告.docx_第3页
第3页 / 共9页
最新lab3复杂流水线实验报告.docx_第4页
第4页 / 共9页
最新lab3复杂流水线实验报告.docx_第5页
第5页 / 共9页
点击查看更多>>
下载资源
资源描述

最新lab3复杂流水线实验报告.docx

《最新lab3复杂流水线实验报告.docx》由会员分享,可在线阅读,更多相关《最新lab3复杂流水线实验报告.docx(9页珍藏版)》请在冰豆网上搜索。

最新lab3复杂流水线实验报告.docx

最新lab3复杂流水线实验报告

 

lab3复杂流水线实验报告

Lab3复杂流水化实验

Experiment1:

Tostudythebasicsofforwarding.ForalltheprogramspleaseselectStallDetectionandForwardingshouldbeON.

(a)WriteasampleprogramthatforwardsbetweenEXEstageandMEMstageonupperinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.

Instruction

1

2

3

4

5

6

7

8

9

ADDR1,R2,R3

IF

ID

EXE

MEM

WB

SUBR5,R1,R4

IF

ID

EXE

MEM

WB

其中ADD指令中在MEM阶段的ALUout-555(R2+R3)前递到SUB指令的EXE阶段的upperinput。

(b)WriteasampleprogramthatforwardsbetweenEXEstageandWBstageonupperinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.

Instruction

1

2

3

4

5

6

7

8

9

ADDR1,R2,R3

IF

ID

EXE

MEM

WB

NOP

IF

ID

EXE

MEM

WB

SUBR5,R1,R4

IF

ID

EXE

MEM

WB

其中ADD指令中在WB阶段的输出555(R2+R3)前递到SUB指令的EXE阶段的upperinput。

(c)WriteasampleprogramthatforwardsbetweenEXEstageandMEMstageonlowerinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.

Instruction

1

2

3

4

5

6

7

8

9

ADDR1,R2,R3

IF

ID

EXE

MEM

WB

SUBR5,R4,R1

IF

ID

EXE

MEM

WB

其中ADD指令中在MEM阶段的ALUout-555(R2+R3)前递到SUB指令的EXE阶段的upperinput。

(d)WriteasampleprogramthatforwardsbetweenEXEstageandWBstageonlowerinputoftheALU.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.DONOTUSELWINSTRUCTION.

Instruction

1

2

3

4

5

6

7

8

9

ADDR1,R2,R3

IF

ID

EXE

MEM

WB

NOP

IF

ID

EXE

MEM

WB

SUBR5,R4,R1

IF

ID

EXE

MEM

WB

其中ADD指令中在WB阶段的输出555(R2+R3)前递到SUB指令的EXE阶段的upperinput。

(e)WriteasampleprogramthatforwardsbetweenMEMstageandWBstage.Writetheprogrambelowandshowforwardingwitharrow.Testitonthesimulatorandmentionwhatvalueisbeingforwarded.

Instruction

1

2

3

4

5

6

7

8

9

LWR1,0(R2)

IF

ID

EXE

MEM

WB

SWR3,0(R1)

IF

ID

EXE

MEM

WB

其中ADD指令在WB阶段的输出555(R2+R3)前递到SW指令的MEM阶段。

(f)WriteaprogramthatcausesLoadUseDelayStall.SeewhatdataistobemovedandnoticeexactlywhentherequiredDataispassedontothewaitinginstruction.Showitasanarrowonthefollowingdiagram.

Instruction

1

2

3

4

5

6

7

8

9

LWR1,0(R3)

IF

ID

EXE

MEM

WB

ADDR2,R1,R3

IF

ID

EXE

EXE

MEM

WB

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____

1

2

3

4

5

6

7

8

9

10

11

12

13

LWR1,0(R2)

IF

ID

EXE

MEM

WB

ADDIR1,R1,#1

IF

ID

ID

ID

EXE

MEM

WB

SWR1,0(R2)

IF

IF

IF

ID

ID

ID

EXE

MEM

WB

ADDIR2,R2,#4

IF

IF

IF

ID

EXE

MEM

WB

SUBR4,R3,R2

IF

ID

ID

ID

EXE

BNEZR4,Loop1

IF

IF

IF

ID

ADDIR2,R0,0

IF

ADDIR3,R0,0

14

15

16

17

18

19

20

21

22

23

24

25

26

LWR1,0(R2)

IF

ID

EXE

MEM

WB

ADDIR1,R1,#1

IF

ID

ID

ID

EXE

MEM

WB

SWR1,0(R2)

IF

IF

IF

ID

ID

ID

EXE

MEM

WB

ADDIR2,R2,#4

IF

IF

IF

ID

EXE

MEM

SUBR4,R3,R2

MEM

WB

IF

ID

ID

BNEZR4,Loop1

ID

ID

EXE

MEM

WB

IF

IF

ADDIR2,R0,0

FLUSHED

IF

ID

EXE

MEM

WB

ADDIR3,R0,0

(b)Redothepart(a)withforwardingONandotherprocessorconfigurationissame.Totalclockcycles___

1

2

3

4

5

6

7

8

9

10

11

12

13

LWR1,0(R2)

IF

ID

EXE

MEM

WB

IF

ID

EXE

MEM

ADDIR1,R1,#1

IF

ID

EXE

EXE

MEM

WB

IF

ID

EXE

SWR1,0(R2)

IF

ID

ID

EXE

MEM

WB

IF

ID

ADDIR2,R2,#4

IF

IF

ID

EXE

MEM

WB

IF

SUBR4,R3,R2

IF

ID

EXE

MEM

WB

BNEZR4,Loop1

IF

ID

ID

EXE

MEM

WB

ADDIR2,R0,0

IF

IF

ID

EXE

MEM

WB

ADDIR3,R0,0

14

15

16

17

18

19

20

21

22

23

24

25

26

LWR1,0(R2)

WB

IF

ID

EXE

MEM

WB

ADDIR1,R1,#1

EXE

MEM

WB

IF

ID

EXE

EXE

MEM

WB

SWR1,0(R2)

ID

EXE

MEM

WB

IF

ID

ID

EXE

MEM

WB

ADDIR2,R2,#4

IF

ID

EXE

MEM

WB

IF

IF

ID

EXE

MEM

SUBR4,R3,R2

IF

ID

EXE

EXE

WB

IF

ID

EXE

BNEZR4,Loop1

IF

ID

ID

EXE

MEM

WB

IF

ID

ADDIR2,R0,0

IF

IF

ID

EXE

MEM

WB

IF

ADDIR3,R0,0

实验心得:

通过本次实验,我更加深刻的理解了流水线中的前递技术的实现,以及不同类型的指令在不同的阶段前递,方式也不同。

同时,我对branch指令数据冒险的解决也有了一个更加清晰的认识,branch类型主要通过循环内改写和循环展开这两种方式,通过不同的实例,清楚地知道不同情况下考虑策略的不同。

通过实验,更加清晰的理解了课上的理论内容,也对复杂流水化有了一个更加全面系统的认知,收获很大。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1