##### Question

In: Electrical Engineering

# Show and classify all potential data hazards. Instructions 1. add R2, R5, R4 2. add R4,...

Show and classify all potential data hazards.

Instructions
1. add R2, R5, R4
2. add R4, R2, R5
3. sw R5, 100(R2)
4 . add R5, R2, R4

## Solutions

##### Expert Solution

INSTRUCTION 1 : add R2,R5,R4 ; % Regs[R2] <-- Regs[R5] + Regs[R4] %

The data in registers R5 and R4 are added and the sum stored in Register R2

INSTRUCTION 2 : add R4,R2,R5 ; % Regs[R4] <-- Regs[R2] + Regs[R5] %

The sum data in R2 is added with the data in Register R5, and it further stored in Register R4. Afer this instruction we are losing the original data of R4

INSTRUCTION 3 : sw R5,100(R2) ; % Regs[R5] <-- Mem[100 + Regs[R2] %

The data in the memory location address corresponding to (value in Register R2 plus 100) th location is stored to the Register R5. This will replace original data og Register R5

INSTRUCTION 4 : add R5,R2,R4 ; % Regs[R5] <-- Regs[R2] + Regs[R4] %

The data in Register R2 is added with the data in Register R4 and it is further stored in the Register R5. So by executing this instruction , we are losing the data in Register R5 , which we are moved from the Memory locations in the previous instruction.

There are three situations in which data hazard can occur

1. Read After Write (RAW), a true dependency

2. Write After Read (WAR), an anti-dependency

3. Write After Write (WAW) an output dependecy

when operands are fetched for second operation, the result from the first will not yet have been saved, and hence a data dependency occurs.Therefore, a data dependency (RAW) occurs with instructoin 2, as it is dependent on the completion of instruction 1.

Instruction 3 and Istruction 4 tries to write a destination before it is read by instruction 1 and instructon 2. A Write After Read (WAR) data hazard represents a problem with concurrent execution.Therefore , it must be ensured that the result of Register R5 is not stored before the instruction 3 and instruction 4 has had a chance to fetch the operands.

Instruction 3 and instruction 4 both try to write data into Register R5, therefore A Write After Write (WAW) may occur in concurrent execution.It must be ensured that the Write back of instuction 4 must be delayed until the instruction 1 finishes executing.

## Related Solutions

##### You have estimated spot rates as follows: r1= 5.60%, r2= 6.00%, r3= 6.30%, r4= 6.50%, r5=...
You have estimated spot rates as follows: r1= 5.60%, r2= 6.00%, r3= 6.30%, r4= 6.50%, r5= 6.60%. a. What are the discount factors for each date (that is, the present value of $1 paid in year t)? b. Calculate the PV of the following$1,000 bonds assuming an annual coupon and maturity of : (i) 5.6%, two-year bond; (ii) 5.6%, five-year bond; and (iii) 10.6%, five-year bond. c. What should be the yield to maturity on a five-year zero-coupon bond?...
##### You have estimated spot rates as follows: r1= 6.40%, r2= 6.80%, r3= 7.10%, r4= 7.30%, r5=...
You have estimated spot rates as follows: r1= 6.40%, r2= 6.80%, r3= 7.10%, r4= 7.30%, r5= 7.40%. a. What are the discount factors for each date (that is, the present value of $1 paid in year t)? (Do not round intermediate calculations. Round your answers to 3 decimal places.) year Discount Factor 1 2 3 4 5 b. Calculate the PV of the following$1,000 bonds assuming an annual coupon and maturity of : (i) 6.4%, two-year bond; (ii) 6.4%,...
##### Problem Description: Given Machine Instruction 1. LD R1, 50(R2) 2. ADD R3, R1, R4 3. LD...
Problem Description: Given Machine Instruction 1. LD R1, 50(R2) 2. ADD R3, R1, R4 3. LD R5, 100(R3) 4. MUL R6, R5, R7 5. ADD R1, R1, #100 6. SUB R2, R2, #8 Font type: Times New Roman and Size 12 Task to do: a) Draw the four-stage pipeline for the above Instruction. b) Calculate the total clock cycles for all the above-mentioned instructions need to be completed. c) Explain how to handle structural hazards the pipeline instruction. d) Explain...
##### You have estimated spot rates as follows: r1= 1.5%,  r2= 1.8%,  r3= 2.1%,  r4= 2.3%,  r5= 3.5%, r6= 4.5%. Calculate...
You have estimated spot rates as follows: r1= 1.5%,  r2= 1.8%,  r3= 2.1%,  r4= 2.3%,  r5= 3.5%, r6= 4.5%. Calculate the price of bond with an annual coupon rate of 4.5% and six years to maturity. Face value of the bond is $1000.$1011.5 $1050.5$1000 $1032.5$1025.5
##### Q.  Show that the ellipse x^2/4+ y^2/9= 1 in R2 is connected, and show that the function...
Q.  Show that the ellipse x^2/4+ y^2/9= 1 in R2 is connected, and show that the function f(x, y) = 3 x^3− 5y^3 − 4 has a zero on the above ellipse.
##### Use the data in Table 2.0, answer questions 1, 2, & 3. Please show all of...
Use the data in Table 2.0, answer questions 1, 2, & 3. Please show all of your working. Table 2.0 Data for a sample of 50 individual in a Cardiovascular Disease Study Participant ID Weight (kg) Height (cm) Smoking status Blood glucose 1 70 165 1 107 2 60 162 0 145 3 62 150 1 237 4 66 165 1 91 5 70 162 0 185 6 59 165 0 106 7 47 160 0 177 8 66 170...
##### need to add these functions to my code: • show only important tasks • show all...
need to add these functions to my code: • show only important tasks • show all completed tasks My code in java: import java.util.ArrayList; import java.util.*; public class TodoList { String date=""; String work=""; boolean completed=false; boolean important=false; public TodoList(String a,String b,boolean c,boolean d){ this.date=a; this.work=b; this.completed=c; this.important=d; } public boolean isCompleted(){ return this.completed; } public boolean isImportant(){ return this.important; } public String getDate(){ return this.date; } public String getTask(){ return this.work; } } class Main{ public static void main(String[]...
##### 1. Explain the issues related to all-hazards risk analysis and mitigation planning. 2. Discuss the political,...
1. Explain the issues related to all-hazards risk analysis and mitigation planning. 2. Discuss the political, social, and economic issues raised by erosion impacts. 3. Describe the relationship between hazard mitigation plans and land use plans.
##### Show that the probability that all permutations of the sequence 1, 2, . . . ,...
Show that the probability that all permutations of the sequence 1, 2, . . . , n have no number i being still in the ith position is less than 0.37 if n is large enough. Show all your work.
##### Instructions: Provide answers to the problems below. Show all your works Exercise 1: Suppose 80% of...
Instructions: Provide answers to the problems below. Show all your works Exercise 1: Suppose 80% of the incoming email messages for a college’s computer system are spam. 1. Use the CLT to approximate the probability that in a random sample of 200 incoming email messages at this college, the sample proportion of these messages that are spam would exceed .75. 2. Display your answer to question 1 as a shaded area in a well-labeled sketch. 3. After implementing a new...