Question: Two C functions (stringlen.c and StringReverse.c) are shown in the following with the function defined as: stringlen - find the length of a string, input:

  1. Two C functions (stringlen.c and StringReverse.c) are shown in the following with the function defined as:

stringlen - find the length of a string, input: pointer to a string

StringReverse reverse the letters of a string, input: pointer to a string

An ARM MDK C project which includes these two files are also available for downloading. In this homework, please

Write both MIPS and ARM assembly language codes to implement these two functions. Please also follow the calling conventions of MIPS and ARM. For MIPS calling conventions, please refer to the Call Convention table on the green card. For ARM calling functions, any other registers besides r0-r3 shall be preserved.

Please run the simulation using MARS and Keil. Perform a screen shot of your output results for both MARS and Keil.

uint8_t stringlen(const uint8_t str[])

{

uint8_t index=0;

while(str[index]!=0)

{

index++;

}

return index;

}

void StringReverse(uint8_t str[])

{

uint8_t i=0;

uint8_t j=stringlen(str)-1;

uint8_t temp;

while(i

temp=str[i];

str[i]=str[j];

str[j]=temp;

i++;

j--;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!