Find Jobs
Hire Freelancers

MIPS program from C code

$10-30 USD

Closed
Posted about 3 years ago

$10-30 USD

Paid on delivery
Write a complete MIPS program that implements the algorithm shown below (in C). To verify the output of the MIPS program, copy this C code and execute it. 1) int main() { int Z=2; int i; i=0; while(1){ if(i>20) break; Z++; i+=2; } do { Z++; } while (Z<100); while(i > 0) { Z--; i--; } return 0; } I and Z must be integer words in memory. 2) int main() { int A[5]; // Empty memory region for 5 elements int B[5] = {1,2,3,4,5}; int C=12; int i; for(i=0; i<5; i++) { A[i] = B[i] + C; } i--; while(i >= 0) { A[i]=A[i]*2; i--; } } A and B must be arrays of integer words in memory, but i can be a register. 3) int main() { char string[256]; int i=0; char *result = NULL; // NULL pointer is binary zero // Obtain string from user, e.g. "Constantinople" scanf("%255s", string); // Search string for letter 'e'. // Result is pointer to first e (if it exists) // or NULL pointer if it does not exist while(string[i] != '\0') { if(string[i] == 'e') { result = &string[i]; break; // exit from while loop early } i++; } if(result != NULL) { printf("First match at address %d\n", result); printf("The matching character is %c\n", *result); } else printf("No match found\n"); } The array of characters is an array of bytes, not words! The result pointer must be stored in memory when the program finishes.
Project ID: 29810297

About the project

1 proposal
Remote project
Active 3 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
1 freelancer is bidding on average $50 USD for this job
User Avatar
I can start now..................................................................................................
$50 USD in 1 day
4.9 (55 reviews)
4.9
4.9

About the client

Flag of UNITED STATES
Stockton, United States
5.0
3
Payment method verified
Member since Feb 16, 2021

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.