(5/5)

This lab is the basis for future labs. Write it yourself.

You need to understand all of the principles in this lab to be successful going forward. Do not use online resources. It will first be run through a plagiarism checking program before being graded. Make sure you follow good coding practices, indent any nested code for readability.

Introduction to MARS and MIPS ASCII to Integer Conversion, Vector Format, Place Value Requirements

1. Mac, Windows or Linux PC

2. Java standard edition (SE) version 9 or higher.

3. MARS Java program Introduction In this lab, 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. If you have any problems running MARS, refer to the instructions in Lab 1. There are two different ways to convert a number into ASCII, arithmetic and masking.

• If your student ID ends in an odd number, use arithmetic.

• If your student ID ends in an even number, use masking. There is a complete integer to ASCII reference table in the textbook. Exercise 1 Write a program that:

1. Inputs a 1x8 vector of two-digit integers (all inputs will be two digits, for example, 7 will be input as 07)

2. Stores them into 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). Each ASCII character of a two-digit integer must be converted separately as there are only ASCII representations of the integers 0-9.

After converting each integer, the values must be summed to produce a single value. Note that the "place value" of the two digits must be taken into account when summing them; that is, the upper digit must be multiplied by 10 before adding it to the lower digit.

Do not use the multiply instruction to do this simple multiplication. Note instead that 10X = (8 + 2)X = 8X + 2X. (two shifts, sll, and one add) After storing the integers in the array:

1. Read in 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: 11 04 20 22 37 03 88 42 (this is just an example vector; it can be any string of two-digit integers) Input VPrime: 11 4 20 22 37 3 88 42 (Where the integers: 0 1 2 3 4 ... 98 99 that the user wants to input are input by the user on the “console.”) And the output will look like: Check Result: 0 (hopefully!) (Upload the program to Canvas in runable form.) (.asm format)

(5/5)

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Get Free Quote!

256 Experts Online