Question: Create a MIPS program based in the proposed C program: void Fred() { x=x+1; Bill(); } void Bill() { x=x+2; Charlie(); } Void Charlie() {
Create a MIPS program based in the proposed C program:
void Fred()
{
x=x+1;
Bill();
}
void Bill()
{
x=x+2;
Charlie();
}
Void Charlie()
{
x=x+3;
}
int x=0;
main()
{
Fred();
}
Here is an example of a mips procedure call: Information that may be lost is stored on the stack. Note the
convention of who (the caller or the callee) saves the information. There may be error!
.text
.globl
main
main:
subu
$sp,$sp,32
# Example of code required by calling protocol
sw
$ra,20($sp)
# for saving registers (uses stack).
sw
$fp,16($sp)
addu
$fp,$sp,28
la
$t0,
yoursubroutinecode
jalr
$t0
lw
$ra,20($sp)
lw
$fp,16($sp)
addiu
$sp,$sp,32
j
$ra
yoursubroutinecode: ***
*************
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
