Question

In: Computer Science

Consider the following sequence of instructions: I1   sub f4, f4, f0 I2    div f3, f4, f0...

Consider the following sequence of instructions:

I1   sub f4, f4, f0

I2    div f3, f4, f0

I3    add f2, f5, f9

I4       add f0, f2, f3

I5 mult f9, f2, f3

Answer the following three questions.

A. List all the dependencies among the instructions.

B. Name the hazard (WAW, WAR, RAW) for each dependency.

C. Discuss which dependencies can be removed through register renaming.

Solutions

Expert Solution

BEFORE answering lets see what are WAW,WAR,RAW

Data hazards do occur when instructions those exhibit data dependence, modify data in different stages of a pipeline. Hazard cause delays in the pipeline. There are mainly 3 types of data hazards:

1) RAW (Read after Write)
2) WAR (Write after Read) [Anti-Data dependency]
3) WAW (Write after Write) [Output data dependency]

Let there be two instructions I and J, such that J follow I. so,

  • RAW hazard occurs when instruction J tries to read data before instruction I writes it.
    Eg:
    I: R8 <- R1 + R3
    J: R4 <- R8 + R3
  • WAR hazard occurs when instruction J tries to write data before instruction I reads it.
    Eg:
    I: R8 <- R1 + R3
    J: R3 <- R4 + R5
  • WAW hazard occurs when instruction J tries to write output before instruction I writes it.
    Eg:
    I: R9 <- R1 + R3
    J: R9 <- R4 + R5

WAR and WAW hazards occur during the out-of-order execution of the instructions

now lets see the dependencies above

I1   sub f4, f4, f0   

f4 <- f4 - f0

I2    div f3, f4, f0

f3 <- f4 / f0

I3    add f2, f5, f9

f2 <- f5 + f9

I4       add f0, f2, f3

f0 <- f2 + f3

I5 mult f9, f2, f3

f9 <- f2 * f3

I1 and I2 have a RAW dependency , what is I2 read f4 before I1 writes in f4

I1 and I4 have WAR dependency, if I4 writes in f0 before I1 reads it

I2 and I4 have WAR dependency

I2 and I5 have RAW depedency, if I5 reads f3 before I2 writes on it

I3 and I4 have RAW dependency

I3 and I5 have RAW dependency,

We don not have any WAW dependency, as no 2 instructions are writing simultaneoulsy on same register.

So option A, B have answered above, lets see option C

Register renaming is done to avoid WAR and WAW data hazards.

So here, we can see,dependencies having WAR hazards are

I1 and I4

I2 and I4

HOPE I HELPED YOU.


Related Solutions

Compute each of the following: a. F1+F2+F3+F4+F5 b. F1+2+3+4 c. F3xF4 d. F3X4 Given that FN...
Compute each of the following: a. F1+F2+F3+F4+F5 b. F1+2+3+4 c. F3xF4 d. F3X4 Given that FN represents the Nth Fibonacci number, and that F31 =1,346, 269 and F33 = 3,524,578, find the following: a. F32 b. F34 25. Solve the quadratic equation using the quadratic formula: 3x^2-2x-11=0
Make a function in Python that can do the following: Longest Increasing Sub-sequence: The input is...
Make a function in Python that can do the following: Longest Increasing Sub-sequence: The input is a sequence of numbers and the goal is to find a subsequence of the given sequence in which the subsequence's elements are in increasing order. You are looking for the longest possible such subsequence.
. Write a sequence of instructions to calculate the following arithmetic expression and store the result...
. Write a sequence of instructions to calculate the following arithmetic expression and store the result in register CX: 20 – 6 + (-10) - (-8) + 15 Trace the contents of registers, assume initial contents are 0000 ps(there are multiple boxes) Instruction AX BX CX DX Remark initial 0000 0000 0000 0000
Instructions: Work on the following questions/problems. Be sure to answer all questions (and sub questions within...
Instructions: Work on the following questions/problems. Be sure to answer all questions (and sub questions within a problem). USE this as you answer sheet (adjust spacing as necessary). Show solutions. This worksheet can be handwritten BUT be sure it is legible Upload work to the designated link in Canvas (15 points) Suppose John, the owner-manager of a local hotel projects the following demand for his rooms:                         Price ($)          Qty. Demanded                         90                    100                         110                  90                         130                  70...
This question is based on the following cash flows C0=$10,000 I1=$2,000 I2=$2,000 I3=$3,000 I4=$3,000 I5=$2,500 L=$1,000...
This question is based on the following cash flows C0=$10,000 I1=$2,000 I2=$2,000 I3=$3,000 I4=$3,000 I5=$2,500 L=$1,000 0 1 2 3 4 5 C: Cost, I: Income, L: Salvage The escalation rate is 10% per year in this example. Calculate the NPV of this investment assuming an escalated dollar minimum rate of return of 8%
Consider the following information regarding Wayne Manufacturing Company and the following instructions. This is similar to...
Consider the following information regarding Wayne Manufacturing Company and the following instructions. This is similar to Problems 20-5A and 20-5B in our textbook. Wayne Manufacturing Company has four operating divisions. During the first quarter of 2016, the company reported the divisional results shown below and aggregate income shown below. Division: North South East West Aggregate Income Sales $          454,410 $          347,490 $          276,210 $          160,380 Cost of goods sold              267,300              222,750              240,570              133,650 Selling and administrative...
Consider the following information regarding Wayne Manufacturing Company and the following instructions. This is similar to...
Consider the following information regarding Wayne Manufacturing Company and the following instructions. This is similar to Problems 20-5A and 20-5B in our textbook. Wayne Manufacturing Company has four operating divisions. During the first quarter of 2016, the company reported the divisional results shown below and aggregate income shown below. Division: North South East West Aggregate Income Sales $          368,072 $          281,467 $          223,730 $          129,908 Cost of goods sold              216,513               180,428               194,862               108,257 Selling and administrative...
Consider the following information regarding Wayne Manufacturing Company and the following instructions. This is similar to...
Consider the following information regarding Wayne Manufacturing Company and the following instructions. This is similar to Problems 20-5A and 20-5B in our textbook. Wayne Manufacturing Company has four operating divisions. During the first quarter of 2016, the company reported the divisional results shown below and aggregate income shown below. Division: North South East West Aggregate Income Sales $454,410 $347,490 $276,210 $160,380 Cost of goods sold 267,300 222,750 240,570 133,650 Selling and administrative expenses 53,460 71,280 57,915 62,370 Income (loss) from...
Consider the following reaction: H2(g) + I2(g) ⇌ 2HI(g) At a particular temperature, a reaction mixture...
Consider the following reaction: H2(g) + I2(g) ⇌ 2HI(g) At a particular temperature, a reaction mixture at equilibrium contains pressures of H2 = 0.958 atm, I2 = 0.877 atm, and HI = 0.020 atm. At the same temperature, a second reaction mixture (not at equilibrium) contains pressures of H2 = 0.621 atm, I2 = 0.621 atm, and HI = 0.101 atm. What will be the partial pressure of HI when the second reaction mixture reaches equilibrium? a) 0.0144 atm b)...
Consider the following functions. f1(x) = cos(2x), f2(x) = 1, f3(x) = cos2(x) g(x) = c1f1(x)...
Consider the following functions. f1(x) = cos(2x), f2(x) = 1, f3(x) = cos2(x) g(x) = c1f1(x) + c2f2(x) + c3f3(x) Solve for c1, c2, and c3 so that g(x) = 0 on the interval (−∞, ∞). If a nontrivial solution exists, state it. (If only the trivial solution exists, enter the trivial solution {0, 0, 0}.) {c1, c2, c3} =?    Determine whether f1, f2, f3 are linearly independent on the interval (−∞, ∞). linearly dependent or linearly independent?  
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT