Question

In: Computer Science

Use the following code fragment: 1       sub x4,x4,x0      2       add x3,x4,x0      3       sub x6,x3,x2...

Use the following code fragment:

1       sub x4,x4,x0

     2       add x3,x4,x0

     3       sub x6,x3,x2

     4       mul x1,x6,x7

     5       add x2,x5,x9

     6       div x5,x9,x2

     7       add x8,x1,x4

Draw the dependency graph among the instructions and indicate the type of data hazards (such as RAW, WAW, etc.) on each edge.

Solutions

Expert Solution

Answer : There are 3 types of hazards in Data Dependencies :

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

1. RAW hazard(Read After Write): It occurs when instruction J tries to read data before instruction I writes it.
Eg:
I: R2 <- R1 + R3
J: R4 <- R2 + R3

2. WAR hazard(Write After Read): It occurs when instruction J tries to write data before instruction I reads it.
Eg:
I: R2 <- R1 + R3
J: R3 <- R4 + R5

3. WAW hazard (Write After Write): It occurs when instruction J tries to write output before instruction I writes it.
Eg:
I: R2 <- R1 + R3
J: R2 <- R4 + R5

Now in the given question instruction sequences are as follows:

I1 : sub x4,x4,x0

I2 : add x3,x4,x0

I3 : sub x6,x3,x2

I4 : mul x1,x6,x7

I5: add x2,x5,x9

I6: div x5,x9,x2

I7: add x8,x1,x4

From the above we can easily say that

Instructions I1,I2

I2,I3

I3,I4

I5,I6

I4,I7

are causing RAW Hazard

and instruction I3,I5 are causing WAR hazard

and there is no WAW hazard in the given set of instructions

So the dependency graph will be as follows :

In the above graph , Instruction I1, I2, I3 will exceute one after the other in the given order and then we can execute any of the instruction I5 and I4 as they have no dependency among them .

Depending upon instruction executed we will be executing remaining instruction as per given graph.


Related Solutions

The values of X1, X2, X3, X4 and X5 are .1, .2, .08, .2 and .3....
The values of X1, X2, X3, X4 and X5 are .1, .2, .08, .2 and .3. Explicate the meaning of those numbers for the Z score. What are the prospects of this firm? Discuss thoroughly.
Let X1, X2, X3, X4, X5, and X6 denote the numbers of blue, brown, green, orange,...
Let X1, X2, X3, X4, X5, and X6 denote the numbers of blue, brown, green, orange, red, and yellow M&M candies, respectively, in a sample of size n. Then these Xi's have a multinomial distribution. Suppose it is claimed that the color proportions are p1 = 0.22, p2 = 0.13, p3 = 0.18, p4 = 0.2, p5 = 0.13, and p6 = 0.14. (a) If n = 12, what is the probability that there are exactly two M&Ms of each...
Case Y X1 X2 X3 X4 X5 X6 1 43 45 92 61 39 30 51...
Case Y X1 X2 X3 X4 X5 X6 1 43 45 92 61 39 30 51 2 63 47 73 63 54 51 64 3 71 48 88 76 69 68 70 4 61 35 86 54 47 45 63 5 81 47 85 71 66 56 78 6 43 34 51 54 44 49 55 7 58 35 70 66 56 42 67 8 71 41 64 70 57 50 75 9 72 31 81 71 69 72 82...
Z X1 X2 X3 X4 X5 X6 RHS 1 170 0 0 25 -20 0 15,550...
Z X1 X2 X3 X4 X5 X6 RHS 1 170 0 0 25 -20 0 15,550 0 3 0 1 1/2 -1 0 65 0 1 1 0 0 1/2 0 205 0 -5 0 0 -1 2 1 480 a) Which variables are nonbasic, which ones are basic, and what are their respective values? b) If I were minimizing the objective, which nonbasic variables are legitimate candidates to enter the basis? How about if I were maximizing? c) Suppose...
Use Newton’s method to find x1, x2 and x3 with the given x0 2/x− x^2 +...
Use Newton’s method to find x1, x2 and x3 with the given x0 2/x− x^2 + 1 = 0 x0 = 2
How do you simplify the following boolean expressions: Y3= X3' X2 X1 X0' + X3' X2...
How do you simplify the following boolean expressions: Y3= X3' X2 X1 X0' + X3' X2 X1 X0 + X3 X2 X1 X0' +X3X2X1X0 Y2 = X3' X2 X1' X0' + X3' X2 X1' X0 + X3 X2 X1' X0' + X3 X2 X1' X0 +  X3 X2' X1' X0' + X3 X2' X1' X0 + X3 X2' X1 X0' + X3 X2' X1 X0 Y1 = X3' X2' X1 X0' + X3' X2' X1 X0 + X3' X2 X1 X0'...
We have a random sample of observations on X: x1, x2, x3, x4,…,xn. Consider the following...
We have a random sample of observations on X: x1, x2, x3, x4,…,xn. Consider the following estimator of the population mean: x* = x1/2 + x2/4 + x3/4. This estimator uses only the first three observations. a) Prove that x* is an unbiased estimator. b) Derive the variance of x* c) Is x* an efficient estimator? A consistent estimator? Explain.
How many integer solutions are there to x1+x2+x3+x4= 100 with all of the following constraints: 10...
How many integer solutions are there to x1+x2+x3+x4= 100 with all of the following constraints: 10 ≤ x1 , 0≤ x2 < 20 , 0 ≤ x3 < 40 , 10 ≤ x4< 50 Please solve using the Principle of Inclusion/Exclusion.
Let x3 be the following vector: x3 <- c(0, 1, 1, 2, 2, 2, 3, 3,...
Let x3 be the following vector: x3 <- c(0, 1, 1, 2, 2, 2, 3, 3, 4) Imagine what a histogram of x3 would look like. Assume that the histogram has a bin width of 1. How many bars will the histogram have? Where will they appear? How high will each be? When you are done, plot a histogram of x3 with bin width = 1, and see if you are right. I need code help R programming
Let X1, X2, X3 be independent having N(0,1). Let Y1=(X1-X2)/√2, Y2=(X1+X2-2*X3)/√6, Y3=(X1+X2+X3)/√3. Find the joint pdf...
Let X1, X2, X3 be independent having N(0,1). Let Y1=(X1-X2)/√2, Y2=(X1+X2-2*X3)/√6, Y3=(X1+X2+X3)/√3. Find the joint pdf of Y1, Y2, Y3, and the marginal pdfs.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT