MIPS write the program with Mars: Multitasking and Context Switching; Pipelining
ID: 3902878 • Letter: M
Question
MIPS write the program with Mars:
Multitasking and Context Switching; Pipelining
Assume a 5-stage pipelined processor using the standard 5-stages (IF, ID, EX, MEM, WB) that uses no forwarding or stalling circuitry. Rather, you will use the compiler to add no-ops to the code to ensure correct execution.
Note: You can assume that if the processor reads and writes to the same register in a given cycle, the value read out will be the new value that is written in that cycle.
Write your own short program that re-writes the code below including the no-ops that are needed to protect against hazard conditions.
Include as few no-ops as possible. Do not change the order of the code statements.
Explanation / Answer
Answer is as follows :
After inserting no ops instreuctions to the given instruction , we get the following part.
add $3, $2, $3
NOP
lw $4, 100($3)
sub $7, $6, $2
NOP
xor $6, $4, $3
So the Pipelining with no forwarding technique is as follows :
if there is any query please ask in comments...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 add $3, $2, $3 IF ID EX MEM WB lw $4, 100($3) IF * ID EX MEM WB sub $7, $6, $2 IF ID EX MEM WB xor $6, $4, $3 IF * ID EX MEM WBRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.