代做report | 代写assembly | unity代写 | assignment | mips – COMPSCI 2GA3 – ass

COMPSCI 2GA3 – ass2

代做report | 代写assembly |  assignment | mips |  architecture代写 – 这是利用MIPS进行训练的代写, 通过汇编练习对计算机体系结构有了进一步的认识, 是比较有代表性的report/assembly/mips等代写方向, 该题目是值得借鉴的assignment代写的题目,对MIPS学习有比较好的示范帮助作用

ass代做 assignment代写 代写assignment

COMPSCI 2GA3: Computer Architecture

Fall 2019

assignment Two

The purpose of this assignment is to provide you the opport unity to gain hands on experience with assembly language programming. This will be accomplished by writing several mips programs to solve several problems. You will have the opportunity to explore various assembly language instructions including loops, conditionals, and procedure/function calling.

Part One: Warm-up/Practice (Non-Graded) Questions

The following questions will not be graded but are included only for you to practice. Do not submit your solutions to these questions. Solutions will be provided before the exam for you to look over/study.

  1. Write the following sequence of code into MIPS assembler:
x = x + y + z - q;
Assume that x, y, z, q are stored in registers $s1-$s4.
  1. Write a MIPS assembly language version of the following C code segment:
int A[100], B[100];
for (i=1; i < 100; i++) {
A[i] = A[i-1] + B[i];
}
At the beginning of this code segment, the only values in registers are the base
address of arrays A and B in registers $a0 and $a1.
  1. Write a MIPS assembly language program of the following C code segment:
for (i = 0; i < 98; i ++) {
C[i] = A[i + 1] - A[i] * B[i + 2]
}
Arrays A, B and C start at memory location A000hex, B000hex and C000hex
respectively. Try to reduce the total number of instructions and the number of
expensive instructions such as multiplies.

Part Two: To be Submitted (5 marks)

Solutions to the following questions are to be submitted. Both questions are equally weighted. All the programs should be well documented.

  1. (a) Convert the following C function to the corresponding MIPS assembly procedure: int count(int a[], int n, int x){ int res = 0; int i = 0; for(i = 0; i != n; i++) if(a[i] == x) res = res + 1; return res; }
(b) Write a MIPS assembly program that will make use of the function count above as
follows:
 Hard-code the following 10 values into array a:
128, 10, 23, 12, 128, 9, 220, 46, 128, 5
 Hard-code n = 10
 Prompt the user to enter a value as follows: Please enter an integer value
 Read the integer value and store it (lets call it x)
 Call the function count with the following arguments: count(a, 10, x)
 Output the results as follows: The number of times x appears in the list is res times
 Exit the program

Part Three: To be Submitted (5 marks)

Your task is to develop a number guessing game in QTSpim using MIPS Assembly coding language. Your program must adhere to the following:

  1. Prompt the user to enter an integer number N that will serve maximum (e.g., the number that will be guessed will range from [ 0 … N ]
  2. Prompt the user to enter a seed S for the randomizer and initialize the randomizer
  3. Using the randomizer initialized above, generate a random number TARGET whose range is between [ 0 … N ]
  4. Prompt the user to guess a number X
  5. Determine whether X is equal to TARGET, near (within 10% of TARGET), or far (greater than 10% of TARGET)
  6. Inform the user on whether their = X was correct (e.g., X = TARGET) or near, or far
  7. If correct end program, If near or far, go back to step 4 (prompt the user to enter a number)

Bonus: Instead of near or far use Very near ( X is within 5% of TARGET), near (X is within 10% of TARGET), Correct , far ( X is within 10% to 25% of TARGET), Very far ( X is greater than 25% of TARGET)

Note: You can assume that N as entered will be a valid positive integer and that N, as entered, will be large enough to ensure you can actually check for very near, near, far, very far. In other words, you are NOT required to perform and error checking on the user input.

What to Submit:

 Submit your solution. Your solution should compile and execute on its own without any
additional code added. Your TA may assemble and execute the resulting program to
test for the correct implementation. Your submitted code should also include (in the
form of comments) the name of each group member and their corresponding student
ID. You may have to provide a live working demo of your solution to your TA (if
required, then you will be informed). This will involve downloading your submitted
files from Avenue and assembling/running them in the presence of your TA.
 Each of the programs above should be submitted in a separate file and each of these
(assembly) files should be submitted. Name your files as: <your
name_Assignment2_Program number>. Your TA may assemble and execute the
resulting program to test for the correct implementation. Nothing else should be
submitted (e.g., as mentioned, no  report is required).
 Programs that cannot be assembled may result in an automatic grade of 0.

Note: Although you may work in groups, it is strongly recommended that each group member participate in solving the problem this is good practice for your final exam.

Rubrics (for both the parts):

  1. Accurate Syntax:02 marks
  2. Execution as expected: 02 marks
  3. Documentation: 01 mark