Translate the loop into MIPS assembly using the given blocks. for (int i = 15; (i - x) > 0; i--) { // BODY } Use: $s0 for i $s6 for x li $s0, 15 sub $t0, $s0, $s6 ble $t0, $0, exit body: addi $s0,...


MIPS assembly. Practice question for midterm tomorrow.


Translate the loop into MIPS assembly using the given blocks.<br>for (int i = 15; (i - x) > 0; i--)<br>{<br>// BODY<br>}<br>Use:<br>$s0 for i<br>$s6 for x<br>li<br>$s0,<br>15<br>sub $t0,<br>$s0, $s6<br>ble<br>$t0, $0,<br>exit<br>body:<br>addi $s0, $s0, -1<br>

Extracted text: Translate the loop into MIPS assembly using the given blocks. for (int i = 15; (i - x) > 0; i--) { // BODY } Use: $s0 for i $s6 for x li $s0, 15 sub $t0, $s0, $s6 ble $t0, $0, exit body: addi $s0, $s0, -1
li<br>$s0, 15<br>sub $t0, $s0, $s6<br>ble<br>$t0, $0,<br>exit<br>body:<br>addi $s0, $s0, -1<br>sub $t0, $s0, $s6<br>bgt<br>$t0, $0,<br>body<br>exit:<br>bgt<br>$t0, $0,<br>exit<br>sub $t0, $s6, $s0<br>ble<br>$t0, $0,<br>body<br>sub $t0, $s6, $s0<br>addi $6, $s6, -1<br>

Extracted text: li $s0, 15 sub $t0, $s0, $s6 ble $t0, $0, exit body: addi $s0, $s0, -1 sub $t0, $s0, $s6 bgt $t0, $0, body exit: bgt $t0, $0, exit sub $t0, $s6, $s0 ble $t0, $0, body sub $t0, $s6, $s0 addi $6, $s6, -1

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here