Docsity

Scheduling Branch Delay Slots, Pipelining-Computer Architecture and Assembly Language-Assignment, Exercises of Computer Architecture and Organization

Toggle sidebar
bg1
InstructionstoSolveAssignments
The purpose of assignments is to give you hands on practice. Itisexpectedthatstudents
willsolvetheassignmentsthemselves.Followingruleswillapply during the evaluation of
assignment.
• Cheatingfromanysourcewillresultinzeromarksintheassignment.
• Anystudent found cheating in any twoof the assignments submitted will be awarded
"F"gradeinthecourse.
• Noassignmentafterduedatewillbeaccepted.
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Scheduling Branch Delay Slots, Pipelining-Computer Architecture and Assembly Language-Assignment and more Exercises Computer Architecture and Organization in PDF only on Docsity!

Instructions to Solve Assignments

The purpose of assignments is to give you hands on practice. It is expected that students will solve the assignments themselves. Following rules will apply during the evaluation of assignment.

  • Cheating from any source will result in zero marks in the assignment.
  • Any student found cheating in any two of the assignments submitted will be awarded "F" grade in the course.
  • No assignment after due date will be accepted.

Question 1: Total Points (10+5+5=20)

Following code lines are written in a high level language: a = c + d; b = c + e;

The corresponding instructions for MIPS are:

LW R1, 0(R0) LW R2, 4(R0) ADD R3, R1, R SW R3, 12(R0) LW R4, 8(R0) ADD R5, R1, R SW R5, 16(R0)

These instructions are to be executed on a pipelined processor with forwarding. (a) Identify hazards by showing the execution of these instructions per cycle bases.

(b) Reorder these instructions to avoid any pipeline stalls.

(c) How many cycles are saved after executing the reordered instructions?

Question 2: Total Points (10+10+10=30)

Scheduling branch delay slots (see the three ways in Figure 2.1) can improve performance. Assume a single branch delay slot and an instruction pipeline that determines branch outcome in the second stage. (a) For a delayed branch instruction, what is the penalty for each branch delay slot

scheduling scheme if the branch is taken and if it is not taken, and what condition, if any, must be satisfied to ensure correct execution?

(b) A cancel‐if‐not‐taken branch instruction (also called branch likely and

implemented in MIPS) does not execute the instruction in the delay slot if the branch is not taken. Thus, a compiler need not be as conservative when filling the delay slot. For each branch delay slot scheduling scheme, what is the penalty if the branch is taken and if it is not taken, and what condition, if any, must be satisfied to ensure correct execution?

(c) Assume that an instruction set has a delayed branch and a cancel‐if‐not‐taken

branch. When should a compiler use each branch instruction and from where should the slot be filled?

Figure 3.1 The basic structure of a MIPS floating point unit using Tomasulo’s algorithm. Instructions are sent from the instruction unit into the instruction queue from which they are issued in FIFO order. The reservation stations include the operation and the actual operands, as well as information used for detecting and resolving hazards. Load buffers have three functions: hold the components of the effective address until it is computed, track outstanding loads that are waiting on the memory, and hold the results of completed loads that are waiting for the CDB. Similarly, store buffers have three functions: hold the components of the effective address until it is computed, hold the destination memory addresses of outstanding stores that are waiting for the data value to store, and hold the address and value to store until the memory unit is avail‐ able. All results from either the FP units or the load unit are put on the CDB, which goes to the FP register file as well as to the reservation stations and store buffers. The FP adders implement addition and subtraction, and the FP multipliers do multiplication and division.

Figure 3.2 Pipeline latencies where latency is number of cycles between producing and consuming instruction.

Question 4: Total Points (15)

Consider the following code for (i=1; i<=100; i=i+1) { A[i+1] = A[i] + C[i]; /* S1 / B[i+1] = B[i] + A[i+1]; / S2 */ } Write an optimal assembly code for the loop. Is it safe to use loop un‐rolling here? Why or why not?

Question 5: Total Points (15)

Based on the paper "Instruction Issue Logic for High Performance Interruptable Pipelined Processors", explain how the Register Update Unit (RUU) is used to resolve data dependencies and maintain precise interrupts.