Unformatted text preview:

Q1 Run what s downloadable from Programming Project 1 on eLearning in MARS examine the corresponding registers in the MARS windows and look in the code of what s and try to work out what it does Check whether the program works if the argument is changed to 6 1 0 10 20 etc Answer what the program does in one Sentence Ans This MIPS program calculates the product of a given argument stored in arg and the number itself essentially performing the following operation result arg arg Here s how the program works step by step 1 Load the argument 2 Initialize variables Initially argument 5 was stored in the memory as a word under the label arg Then we load arg 5 in register t1 and s1 Then we initialize s3 to zero using the add function where we will store the result Program check if t1 is 0 If t1 is zero then the program skips to the end since multiplying by zero would give a result of zero 3 Loop multiplying the argument by itself The loop fori adds the values in s1 to s3 and negate t1 by 1 until t1 is zero 4 End the program When the loop is done the program calls syscall to terminate Behavior with Different Arguments If the argument in arg is changed to 6 the program will compute 6 6 36 With 1 it computes 1 1 1 With 0 the program will exit early without any loop since 0 0 0 For 10 it computes 10 10 100 For 20 it computes 20 20 400 Answer in one sentence The program calculates the square of the given argument stored in memory arg


View Full Document

UTD CS 5330 - Assignment 1 Explanation

Documents in this Course
Load more
Download Assignment 1 Explanation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Assignment 1 Explanation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assignment 1 Explanation and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?