Please take a look on this pdf
COMP 122 Problem set 3 (Fall 2018 ) Your Name COMP 122: Computer Architecture November 29, 2019 Problem 1. Convert the following code to MIPS: 1 int main() 2 { 3 printf("Hello, World!"); 4 return 0; 5 } Problem 2. Convert the following C code to MIPS 1 int result[100]; 2 int main () 3 { 4 int i = 0; 5 for (int i = 0; i <100; i+="0)" 6="" {="" 7="" result[i]="i;" 8="" }="" 9="" }="" problem="" 3.="" convert="" the="" following="" mips="" code="" to="" c="" 1="" 1="" .data="" 2="" sz:="" .word="" 10="" 3="" array:="" .word="" 1,="" 1,="" 2,="" 3,="" 5,="" 8,="" 13,="" 21,="" 34,="" 55="" 4="" .text="" 5="" main:="" 6="" lw="" $t0,="" sz="" 7="" move="" $t1,="" $zero="" 8="" move="" $t2,="" $zero="" 9="" 10="" back:="" 11="" bge="" $t1,="" $t0,="" end="" 12="" sw="" $t1,="" array($t2)="" #shift="" 13="" addi="" $t1,="" $t1,="" 1="" 14="" addi="" $t2,="" $t2,="" 4="" 15="" j="" back="" 16="" 17="" end:="" problem="" 4.="" unroll="" the="" following="" code="" (in="" c)="" 1="" int="" result[10];="" 2="" int="" main="" ()="" 3="" {="" 4="" int="" i="0;" 5="" for="" (int="" i="0;" i="">100;><10; i+=0) 6 { 7 result[i] = i; 8 } 9 } problem 5. unroll the following code (in mips) 1 .data 2 sz: .word 10 3 array: .word 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 4 .text 5 main: 6 lw $t0, sz 7 move $t1, $zero 8 move $t2, $zero 9 10 back: 11 bge $t1, $t0, end 12 sw $t1, array($t2) #shift 13 addi $t1, $t1, 1 14 addi $t2, $t2, 4 15 j back 16 17 end: i+="0)" 6="" {="" 7="" result[i]="i;" 8="" }="" 9="" }="" problem="" 5.="" unroll="" the="" following="" code="" (in="" mips)="" 1="" .data="" 2="" sz:="" .word="" 10="" 3="" array:="" .word="" 1,="" 1,="" 2,="" 3,="" 5,="" 8,="" 13,="" 21,="" 34,="" 55="" 4="" .text="" 5="" main:="" 6="" lw="" $t0,="" sz="" 7="" move="" $t1,="" $zero="" 8="" move="" $t2,="" $zero="" 9="" 10="" back:="" 11="" bge="" $t1,="" $t0,="" end="" 12="" sw="" $t1,="" array($t2)="" #shift="" 13="" addi="" $t1,="" $t1,="" 1="" 14="" addi="" $t2,="" $t2,="" 4="" 15="" j="" back="" 16="" 17="">10; i+=0) 6 { 7 result[i] = i; 8 } 9 } problem 5. unroll the following code (in mips) 1 .data 2 sz: .word 10 3 array: .word 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 4 .text 5 main: 6 lw $t0, sz 7 move $t1, $zero 8 move $t2, $zero 9 10 back: 11 bge $t1, $t0, end 12 sw $t1, array($t2) #shift 13 addi $t1, $t1, 1 14 addi $t2, $t2, 4 15 j back 16 17 end:>