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

Consider the following C-code fragment: for (i-0; i-100; i++) zlilalil blil; Ass

ID: 3756118 • Letter: C

Question

Consider the following C-code fragment: for (i-0; i-100; i++) zlilalil blil; Assume that - a, b, and z are arrays of 32-bit words. The machine code for this fragment is stored in memory starting from location 00000100 Hex. a- Convert this code to MIPS. You must provide the numeric offset for each branch or jump instruction that you use. (50 points) b- Assume that the CPls for MIPS instructions on a multi-cycle system M1 are as listed below: lw: 5 cycles R-type, addi, sw, and other immediate Arithmetic instruction : 4 Cycles beq, bne, and j: 3 cycles other instructions: 4 cycles How many clock cycles does it take to execute the C-code fragment on system MI? Justify your answer (20 points) c- Assume that the clock rate for M1 is 2.5 GHz. What is the CPU execution time for the code on M1? (10 points) d- Compute CPU execution time of the code for a single-cycle system with clock rate 1.6 Ghz (20 points)

Explanation / Answer

.file 1 "" .section .mdebug.abi32 .previous .nan legacy .module fp=32 .module nooddspreg .abicalls .text .align 2 .globl main .set nomips16 .set nomicromips .ent main .type main, @function main: .frame $fp,624,$31 # vars= 608, regs= 1/0, args= 0, gp= 8 .mask 0x40000000,-4 .fmask 0x00000000,0 .set noreorder .set nomacro addiu $sp,$sp,-624 sw $fp,620($sp) move $fp,$sp sw $0,8($fp) b $L2 movz $31,$31,$0 nop $L3: lw $2,8($fp) nop sll $2,$2,2 addiu $3,$fp,8 addu $2,$3,$2 lw $3,4($2) lw $2,8($fp) nop sll $2,$2,2 addiu $4,$fp,8 addu $2,$4,$2 lw $2,204($2) nop subu $3,$3,$2 lw $2,8($fp) nop sll $2,$2,2 addiu $4,$fp,8 addu $2,$4,$2 sw $3,404($2) lw $2,8($fp) nop addiu $2,$2,1 sw $2,8($fp) $L2: lw $2,8($fp) nop slt $2,$2,100 bne $2,$0,$L3 nop nop move $sp,$fp lw $fp,620($sp) addiu $sp,$sp,624 j $31 nop .set macro .set reorder .end main .size main, .-main .ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609"

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