Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following sequence of instructions, where the syntax consists of an

ID: 3587450 • Letter: C

Question

Consider the following sequence of instructions, where the syntax consists of an opcode followed by the destination register followed by one or two source registers: R3, R1, R2 ADD LOADR6, [R3] AND ADD SRL R7, R5,3 R1, R6, RO R7, RO, 8 R2, R4,R7 R5, R3, Rd RO, R1,R10 SUB ADD LOAD R, [RS] SUB AND R2, R1, R6 R3, R7, 15 10 Assume the use of a four-stage pipeline: fetch, decode/issue, execute, write back Assume that all pipeline stages take one clock cycle except for the execute stage. For simple integer arithmetic and logical instructions, the execute stage takes one cycle, but for a LOAD from memory, five cycles are consumed in the execute stage. If we have a simple scalar pipeline but allow out-of-order execution, we can construct the following table for the execution of the first seven instructions: Instruction Fetch Decode Execute Write Back 10 12 The entries under the four pipeline stages indicate the clock cycle at which each instruction begins each phase. In this program the second ADD instruction (instruo tion 3) depends on the LOAD instruction (instruction 1) for one of its operands, rm. Because the LOAD instruction takes five clock cycles, and the issue logic encounters the dependent ADD instruction after two clocks, the issue logic must delay the ADD instruction for three clock cycles. With an out-of-order capability. the processor can stall instruction 3 at clock cycle 4, and then move on to issue the following three inde pendent instructions. which enter execution at clocks 6. 8, and 9.The LOAD finishes execution at clock 9, and so the dependent ADD can be launched into execution on clock 10. a. Complete the preceding table. b. Redo the table assuming no out-of-order capability. What is the savings using the capability? c. Redo the table assuming a superscalar implementation that can handle two instructions at a time at each stage.

Explanation / Answer

C JMP NEXT

STA 4152 Store the result in memory

MOV A C STA 4153