Question

In: Computer Science

1. In this assignment, you will use MARS(MIPS Assembler and Runtime Simulator) to write and run...

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

Solutions

Expert Solution

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:


Related Solutions

Using MIPS (MARS) - Assembly Language Assignment ( PLEASE USE COMMENTS TO DESCRIBE EACH STEP )...
Using MIPS (MARS) - Assembly Language Assignment ( PLEASE USE COMMENTS TO DESCRIBE EACH STEP ) Take input of name, the input of hours worked, and input of hourly wage, and use input of hourly wage and hours worked to calculate total paycheck and print Name, and paycheck.
Use MARS to write and simulate a MIPS assembly language program to implement the strlen function....
Use MARS to write and simulate a MIPS assembly language program to implement the strlen function. The program should ask for a user's input and print the length of the user's input. Write the main function to call strlen. The main function should: - Prompt the user for input - Pass that input to strlen using registers $a0. - Preserve (i.e. push onto the stack) any T registers that the main function uses. The strlen function should: - Preserve any...
I have to do the following MIPS coding assignment. Question 1 Write a MIPS program that...
I have to do the following MIPS coding assignment. Question 1 Write a MIPS program that meets the following requirements (NOTE: your program statements should follow the order of the requirements and each requirement should correspond to only one assembly instruction): Loads the hexadecimal equivalent of 23710 into register 13 using an immediate bitwise OR instruction Loads the hexadecimal equivalent of 183410 into register 17 using an immediate bitwise OR instruction Performs the bitwise AND operation on the operands stored...
Task in this assignment is to write mips_sim a simulator for a small simple subset of...
Task in this assignment is to write mips_sim a simulator for a small simple subset of the MIPS . The input to mips_sim will be the 32-bit instruction codes for MIPS instructions as hexadecimal numbers. mips_sim.c should simulate executing these instruction like this: cat examples/42.hex 3404002a 34020001 c 3404000a 3402000b c dcc mips_sim.c -o mips_sim ./mips_sim examples/42.hex 0: 0x3404002A ori $4, $0, 42 >>> $4 = 42 1: 0x34020001 ori $2, $0, 1 >>> $2 = 1 2: 0x0000000C syscall...
MARS: Use MASKING to convert ASCII characters to Integer Write and run a program that reads...
MARS: Use MASKING to convert ASCII characters to Integer Write and run a program that reads in a string of ASCII characters and converts them to Integer numbers stored in an array USING MASKING, not subtraction. Write a program that: 1. Inputs a 1x8 vector of single-digit integers 2. Stores them into an 8-entry 32-bit Integer array, “V”. After storing the integers in the array: 1. Read the same values using Read Integer and store them in a 32-bit integer...
Assembly Language Coding Using MARS (MIPS) 1)Write a program that prints your name in a Triangle....
Assembly Language Coding Using MARS (MIPS) 1)Write a program that prints your name in a Triangle. (NAME = John Doe) 2)Write a Program that intializes X to 10, Y to 20 and Z to -50, adds X and Y and Z and prints the following the value of each variable, for example value of x is 10 as well as the result of the addition.
For this assignment, you are required to write a MIPS program that reads its own instructions...
For this assignment, you are required to write a MIPS program that reads its own instructions and counts the number of occurrences of each type of instruction (R-type, I-type, or J-type). To accomplish this task, your program should execute the following steps: First, your program should load the address of its first instruction (0x400000) into a register, and initialize three separate instruction class counters to zero. Next, your program should enter a loop that reads each instruction from memory. For...
ation  Simulator  Assignment  Reference  Feedback    Assignment     1. There is a total of 56...
ation  Simulator  Assignment  Reference  Feedback    Assignment     1. There is a total of 56 cells including 20 unstained cells altogether in the five counting squares of hemocytometer.Given volume of media is 5ml. The average viable cell count per square is 4 and the dilution factor is 2. Then calculate the percentage of cell viability, viable cells/ml and the volume of media needed, if we need 5000 cells. 2. What is the principle behind Trypan Blue Exclusion Test of...
In MIPS Assembly Language in Mars, define a method 1 to check if a number is...
In MIPS Assembly Language in Mars, define a method 1 to check if a number is divisible by 4. Then, define a method 2 to generate a random number, call method 1, and return result(number, yes/no) to main. Lastly, have the main method call method 2, and display the results.
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit...
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit integers X and Y (X and Y can be prompted separately or at the same time), get them from the user then store them in memory locations labeled X and Y respectively. The program then loads X and Y from the main memory to registers, calculates the sum of them (i.e. X + Y) and store the sum into a memory location labeled S....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT