In: Computer Science
1. In this assignment, you will use MARS(MIPS Assembler and Runtime Simulator) to write and run a program that reads in a string of ASCII characters and converts them to Integer numbers stored in an array.
There are two different ways to convert the number into ASCII, subtraction and “masking”.
If your student ID ends in an odd number, then use subtraction.
If your student ID ends in an even number, then use masking.
Write a program that:
1.Inputs a 1x8vector of single-digit integers
2.Storestheminto an 8-entry 32-bit Integer array, “V”.
It is not completely trivial to do this given the Syscalls available and the desired input format.
Hint: Use Read String and not Read Integer, then convert from ASCII to integer before storing into the integer array, “V”. Use the ASCII table in the book to determine how to convert from ASCII to integer (there are two ways, both very easy, select the method as per the introduction).
After storing the integers in the array:
1.Read the same values using Read Integer and store them in a 32-bit integer array, “VPrime”.
2.Subtract the two arrays integer by integer and put the results into a third 32-bit integer array, “VCheck”.
3.Sum all the values in VCheck and using Write Integer, display the result.
When you run the program, the input should look something like this with a space between numbers:
Input V: 1 4 0 2 7 3 8 4 (this is just an example vector; it can be any string of single digit integers)
Input VPrime:
1
4
0
2
7
3
8
4
(Where the integers: 0 1 2 3 4 ... 8 9 or whatever vector values the user wants to input are input by the user on the “console.”)
And the output will look like:
Check Result: 0
What is mips?
it stands for "Million Instructions Per Second." It is a method of measuring the raw speed of a computer's processor. The MIPS measurement has been used by computer manufacturers like IBM to measure the "cost of computing." The value of computers is determined in MIPS per dollar. ...
Masking Operations:
A mask is a value used to force certain bits to zero or one within some other value. A mask typically affects certain bits in an operand (forcing them to zero or one) and leaves other bits unaffected. The appropriate use of masks allows you to extract bits from a value, insert bits into a value, and pack or unpacked a packed data type. The following sections describe these operations in detail
If your student ID ends in an odd number, then use subtraction.
.Inputs a 1x8vector of single-digit integers:
Sum all the values in VCheck and using Write Integer, display the result: