Ve370 Introduction to Computer Organization Project 1 solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Develop a MIPS assembly program that operates on a data segment consisting of an array of 32-bit unsigned integers. In the text (program) segment of memory, write a procedure called main that implements the main() function and other subroutines described below. Assemble, simulate, and carefully comment the file. Screen print your simulation results and explain the results by annotating the screen prints. You should compose an array whose size is determined by you in the main function and is not less than 20 elements.

main() {
int size = …; //determine the size of the array here
int PassCnt, FailCnt;
int testArray[size] = { 55, 83,
… //compose your own array here
};
PassCnt = countArray(testArray, size, 1);
FailCnt = countArray(testArray, size, -1);
}

int countArray(int A[], int numElements, int cntType) {
/**********************************************************************
* Count specific elements in the integer array A[] whose size is *
* numElements and return the following: *
* *
* When cntType = 1, count the elements greater than or equal to 60; *
* When cntType = -1, count the elements less than 60; *
**********************************************************************/
int i, cnt = 0;
for(i=numElements-1, i>0, i–) {
switch (cntType) {
case ‘1’ : cnt += Pass(A[i]); break;
otherwise: cnt += Fail(A[i]);
}
}
return cnt;
}

int Pass(int x) {
if(x>=60) return 1;
else return 0;
}

int Fail(int x) {
if (x<60) return 1; else return 0; } DELIVERABLES A written report is required for this project. The entire program must be clearly commented and saved as a .s file, and attached to the project report as an appendix. The report must also contain screen shots and explanations of simulation results. This is an individual assignment. Your work must be submitted electronically to Canvas before the specified due date.