Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following assembly code, where to-t5 are temporary registers, and s

ID: 3577114 • Letter: C

Question

Consider the following assembly code, where to-t5 are temporary registers, and s0-s9 are registers. Write the equivalent C code of the above assembly code. You are not allowed to use the goto statement. Clearly indicate how the variables used in your C code correspond to the registers in the assembly. Assuming the program is run on a VLIW processor with unlimited number of hardware resources and the latency of each instruction is 1 cycle. What is the minimal number of cycles the program can complete, assuming the initial value of s1 before entering the loop is 16? Show a schedule of the instructions

Explanation / Answer

a)int t0,*s1

do

{

t0=*s1;

s1=s1+p;

*s1=t0;

s1=s1-4;

}while(s1!=0);

-->here s1 represents the register s1,the [s1] in assembly language indicates the we are accessing the value present in the address given by value in s1. similarly *s1 in programming language indicates that we are using the value at adress given in s1.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote