1、23456789ADD R1,R2,R3IFIDEXEMEMWBSUB R5,R1,R4 其中ADD指令中在MEM阶段的ALUout-555(R2+R3)前递到SUB指令的EXE阶段的upper input。(b)Write a sample program that forwards between EXE stage and WB stage on upper input of the ALU.Write the program below and show forwarding with arrow. Test it on the simulator and mention what v
2、alue is being forwarded. DO NOT USE LW INSTRUCTION.NOP其中ADD指令中在WB阶段的输出555(R2+R3)前递到SUB指令的EXE阶段的upper input。(c)Write a sample program that forwards between EXE stage and MEM stage on lower input of the ALU.Write the program below and show forwarding with arrow. Test it on the simulator and mention wh
3、at value is being forwarded. DO NOT USE LW INSTRUCTION.SUB R5,R4,R1(d) Write a sample program that forwards between EXE stage and WB stage on lower input of the ALU.Write the program below and show forwarding with arrow. Test it on the simulator and mention what value is being forwarded. DO NOT USE
4、LW INSTRUCTION.(e) Write a sample program that forwards between MEM stage and WB stage. Write the program below and show forwarding with arrow. Test it on the simulator and mention what value is being forwarded.LW R1,0(R2)SW R3,0(R1) 其中ADD指令在WB阶段的输出555(R2+R3)前递到SW指令的MEM阶段。(f) Write a program that ca
5、uses Load Use Delay Stall. See what data is to be moved and notice exactly when the required Data is passed on to the waiting instruction. Show it as an arrow on the following diagram.LW R1,0(R3)ADD R2,R1 ,R3BRANCH HAZARDS. (Lab Experiment 2)(a) Let us now study some branch hazard. First of all make
6、 sure that the Aggressive branching option is OFF, Stall Detection is ON and Forwarding is ON. Select Always Flush option from the branch Policy and write the following program. Does this program work properly. If not modify the program so that it works properly. It fills 10 memory locations memory
7、with a value 222. Check what should be the values of all the registers if this program work is to properly (no useful instruction turning into NOP or getting flushed). Carefully note the use of SLTI instruction in the following loop.ADDI R3, R0, 0ADDI R1, R0, 0ADDI R2, R0, 222Loop: Addi R1, R1, 4SW
8、R2, 100(R1)ADDI R3, R3, 1SLTI R5, R3, 10BNEQ R5, R0, loopADDI R7, R1, 10ADDI R8, R2, 5ADDI R2, R2, 100(i)Calculate the CPI for this program. 61/65 (ii)What changes can we make to this program so that it works properly (useful instructionsafter the program do not flush) 可以在BNEQ跳转后面加3条ADD R0,R0,R0(iii
9、)Run the same program with Predict NT option in Branch Policy. What difference do you seewhen loop completes. Predict NT:循环执行完了顺序执行了剩下3条语句。Always Flush:循环执行完了依然将剩下3条语句flush掉了。(b) This problem is similar to problem A-1 at the end of the book. (Exercise A-1.)Note that you need to calculate the offset
10、in the actual program in terms of number of instructions.Offset = -6 (A) Processor Configuration. Stall Detection ON., Forwarding: OFF, Aggressive Branching: YES, Branch Policy: Always Flush. Run the above program and fill the following table for the instructions in the loop body for first 2 or 3 it
11、erations. Total Clock cycles to run the program _10111213LW R1, 0(R2)ADDI R1,R1, #1SW R1, 0(R2)ADDI R2,R2, #4SUB R4,R3,R2BNEZ R4, Loop1ADDI R2, R0, 014151617181920212223242526FLUSHED(b) Redo the part (a) with forwarding ON and other processor configuration is same. Total clock cycles _实验心得:通过本次实验,我更加深刻的理解了流水线中的前递技术的实现,以及不同类型的指令在不同的阶段前递,方式也不同。同时,我对branch指令数据冒险的解决也有了一个更加清晰的认识,branch类型主要通过循环内改写和循环展开这两种方式,通过不同的实例,清楚地知道不同情况下考虑策略的不同。通过实验,更加清晰的理解了课上的理论内容,也对复杂流水化有了一个更加全面系统的认知,收获很大。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1