1. Homepage
  2. Programming
  3. MIPS assembly: C code translation

MIPS assembly: C code translation

Engage in a Conversation
MIPSAssemblyUniversity of ToledoLehigh Carbon Community CollegeLCCCAlbany

Objective
CourseNana.COM

  CourseNana.COM

To learn the fundamentals of MIPS architecture through the use of its assembly language and the SPIM MIPS simulator. CourseNana.COM

  CourseNana.COM

Description CourseNana.COM

  CourseNana.COM

You are to write a complete program in MIPS assembly language that implements the appended C program. This program contains four functions in addition to the main() function. Your solution must implement all five routines as they have been coded in the example. In essence, your solution must follow their dependence as determined by the way they are invoked in the C code presented below. You are to use the MIPS simulator QtSpim. A list of SPIM system calls is provided in the lecture notes as also supplied for quick reference as follows: CourseNana.COM

  CourseNana.COM

What to Submit CourseNana.COM

  CourseNana.COM

1.Copies of all .asm files you created for this exercise as well as CourseNana.COM

2.Screenshots of the results produced by your solution. CourseNana.COM

  CourseNana.COM

All above listed information must be placed in a Microsoft compressed (zipped) folder (.zip). CourseNana.COM

  CourseNana.COM

#include <stdio.h> CourseNana.COM

int getMax(int arr[], int n) CourseNana.COM

{ CourseNana.COM

int mx = arr[0]; CourseNana.COM

for (int i = 1; i < n; i++) CourseNana.COM

if (arr[i] > mx) CourseNana.COM

mx = arr[i]; CourseNana.COM

return mx; CourseNana.COM

} CourseNana.COM

void countSort(int arr[], int n, int exp) CourseNana.COM

{ CourseNana.COM

int output[n]; CourseNana.COM

int i, count[10] = { 0 }; CourseNana.COM

for (i = 0; i < n; i++) CourseNana.COM

count[(arr[i] / exp) % 10]++; CourseNana.COM

for (i = 1; i < 10; i++) CourseNana.COM

count[i] += count[i - 1]; CourseNana.COM

for (i = n - 1; i >= 0; i--) { CourseNana.COM

output[count[(arr[i] / exp) % 10] - 1] = arr[i]; CourseNana.COM

count[(arr[i] / exp) % 10]--; CourseNana.COM

} CourseNana.COM

for (i = 0; i < n; i++) CourseNana.COM

arr[i] = output[i]; CourseNana.COM

} CourseNana.COM

void radixSort(int arr[], int n) CourseNana.COM

{ CourseNana.COM

int m = getMax(arr, n); CourseNana.COM

for (int exp = 1; m / exp > 0; exp *= 10) CourseNana.COM

countSort(arr, n, exp); CourseNana.COM

} CourseNana.COM

void printData(int arr[], int n) CourseNana.COM

{ CourseNana.COM

for (int i = 0; i < n; i++) CourseNana.COM

printf("%d \n", arr[i]); CourseNana.COM

} CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
MIPS代写,Assembly代写,University of Toledo代写,Lehigh Carbon Community College代写,LCCC代写,Albany代写,MIPS代编,Assembly代编,University of Toledo代编,Lehigh Carbon Community College代编,LCCC代编,Albany代编,MIPS代考,Assembly代考,University of Toledo代考,Lehigh Carbon Community College代考,LCCC代考,Albany代考,MIPShelp,Assemblyhelp,University of Toledohelp,Lehigh Carbon Community Collegehelp,LCCChelp,Albanyhelp,MIPS作业代写,Assembly作业代写,University of Toledo作业代写,Lehigh Carbon Community College作业代写,LCCC作业代写,Albany作业代写,MIPS编程代写,Assembly编程代写,University of Toledo编程代写,Lehigh Carbon Community College编程代写,LCCC编程代写,Albany编程代写,MIPSprogramming help,Assemblyprogramming help,University of Toledoprogramming help,Lehigh Carbon Community Collegeprogramming help,LCCCprogramming help,Albanyprogramming help,MIPSassignment help,Assemblyassignment help,University of Toledoassignment help,Lehigh Carbon Community Collegeassignment help,LCCCassignment help,Albanyassignment help,MIPSsolution,Assemblysolution,University of Toledosolution,Lehigh Carbon Community Collegesolution,LCCCsolution,Albanysolution,