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:
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started