I know that consecutive R-Type instructions can cause a hazard, for example:
add $2, $2, $1
add $2, $2, $3
but can consecutive I-Type instructions? For example:
addi $2, $0, 10
addi $2, $0, 5
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
given your case of:
you will never encounter a data hazard because you are never reading a value after it is being written (read after write)
maybe think of it like this:
you can see that $2 is not being used in the second calculation and $0 is not being changed, so there is no data hazard.
if you were to do this:
pipelining will not guarantee that $2 is the expected value when it is read during the second calculation.
consider that lw and sw are also I-type instructions;
http://www.cs.nmsu.edu/~pfeiffer/classes/473/notes/hazards.html
given that the operations for reading and writing data are I-type instructions and given the definition of these potential data hazards, yes, I-type instructions can still have a hazard.