Question: Write a program using your favorite programming language that reads assembly code like the following: LW $0, $1(20) load instruction at address $1 + 20
Write a program using your favorite programming language that reads assembly code like the following: LW $0, $1(20) load instruction at address $1 + 20 and put the result in register $0. ADD $3, $0, $2 add the content of register $0 to register $2 and store the outcome in register $3.
Your program must simulate the pipeline by creating an execution schedule. The program must determine the dependencies between the instructions, if any, and stall the pipeline as necessary. The program must show the execution table including the stalls if any. Finally, the program must also output the number of cycles needed to execute the input program. To simplify matters, restrict the accepted instruction to only: ADD (add two values), LW (load from memory), SW (store a word in memory), SUB (subtract).
IMPORTANT: the output of the code should appear result like this below
F DE EX MEM WB
F stall stall DE EX MEM WB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
