2. Refer to the following table for the data required. Arith Store Load Branch I
ID: 3599577 • Letter: 2
Question
2. Refer to the following table for the data required. Arith Store Load Branch Instructions for 500 150 10o 100o a program CPI 5 5 2 a. b. c. d. Calculate execution time of a program on a 2 GHz processor. Find global CPl of the program If number of load instructions can be reduced by one-half, what is the speed up and CPI? If number of store and arithmetic instructions can be reduced by one-half, what is the speed up and CPI? Write MIPS code to implement a leaf procedure for the following C function: int leaf_procedure (int x, int y) 3. int i, a; arxty i =x-2; a-a+i return a;Explanation / Answer
3)
The MIPS code for implementing a leaf procedure for the given c function is given below:
code:
.file 1 ""
.section .mdebug.abi32
.previous
.nan legacy
.module fp=32
.module nooddspreg
.abicalls
.text
.align 2
.globl leaf_procedure
.set nomips16
.set nomicromips
.ent leaf_procedure
.type leaf_procedure, @function
leaf_procedure:
.frame $fp,24,$31 # vars= 8, regs= 1/0, args= 0, gp= 8
.mask 0x40000000,-4
.fmask 0x00000000,0
.set noreorder
.set nomacro
addiu $sp,$sp,-24
sw $fp,20($sp)
move $fp,$sp
sw $4,24($fp)
sw $5,28($fp)
movz $31,$31,$0
lw $3,24($fp)
lw $2,28($fp)
nop
addu $2,$3,$2
sw $2,8($fp)
lw $2,24($fp)
nop
addiu $2,$2,-2
sw $2,12($fp)
lw $3,8($fp)
lw $2,12($fp)
nop
addu $2,$3,$2
sw $2,8($fp)
lw $2,8($fp)
move $sp,$fp
lw $fp,20($sp)
addiu $sp,$sp,24
j $31
nop
.set macro
.set reorder
.end leaf_procedure
.size leaf_procedure, .-leaf_procedure
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609"
Hope This Helps, if you have any doubts Please comment i will get back to you, thank you and please thumbs up
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.