3. Consider the following C++ program segment: i=0; while (i!=j) { x[i]=y[i]; i+
ID: 3545326 • Letter: 3
Question
3. Consider the following C++ program segment:
i=0;
while (i!=j) {
x[i]=y[i];
i++;
}
1) Convert the C++ program into MIPS code use direct translation. (15 pts)
When write MIPS code, assume that variables are kept in registers as follows, and that all registers except those indicated as Free are used to keep various variables, so they cannot be used for anything else.
Variables
i
j
x
y
1 (constant)
Free
Registers
$1
$2
$3
$4
$5
$6, $7, $8, $9
2) If the loop exits after executing only two iterations, draw a pipeline diagram for your MIPS code executed on a 2-issue processor shown in Figure 4.69. Assume the processor has perfect branch prediction and can fetch any 2 instructions (not just consecutive instructions in the same cycle). Dont rearrange your instructions and pad with NOP instructions if necessary. Also, assume full forwarding in the pipeline. (20 pts)
(Hint: Make sure that there is no dependence between the two instructions in the VLIW).
3) What is the IPC in this program? (5 pts
Variables
i
j
x
y
1 (constant)
Free
Registers
$1
$2
$3
$4
$5
$6, $7, $8, $9
Explanation / Answer
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.