[Solved] MIPS HW1-MIPS Programming

30 $

File Name: MIPS_HW1-MIPS_Programming.zip
File Size: 235.5 KB

SKU: [Solved] MIPS HW1-MIPS Programming Category: Tag:

Or Upload Your Assignment Here:


1.Goal:

In hw1, students will learn how to write MIPS code, and know the difference between assembly and high-level languages. In order to test the correctness of program, students should use a MIPS simulator –MARS to simulate the programs.

2.Download and Using MARS:

  1. Download and installation:

1.Download MARS from the page: http://courses.missouristate.edu/KenVollmar/MARS/

2.Download the version chosen by yourself, and install it

  1. Steps for running a MIPS code on MARS:

1.File ->New

2.Write MIPS code

3.Run -> Assemble (F3)

4.Run -> Go (F5)

  1. HW Description:

A. Factorial

The attached files factorial.c and factorial.s are modified from the example given in textbook for computing n!. In this part, please execute factorial.s on MIPS simulator MARSfor practice.

B. Prime number

Read an number from standard input, and judge if it’s a prime number or not. If it is a prime number, then print ”It’s a

prime” on standard output. Otherwise, print “It’s not a prime”.

(Hint: DIV instruction calculates both quotient and remainder )

C. Draw a diamond

Input a number n, draw a diamond with the length of its diagonal line equal to 2n-1. The following picture is an example.

D. Fibonacci sequence

Read a number from standard input. Output the n-th item of Fibonacci sequence. Students are required to use recursive function to solve this task.

  1. Notes
  2. For every task, the corresponding implement in C is provided.
  1. There’s no strict regulation of input and output format string, but try to be as clear as you can. You can follow the format in reference .c files.
  1. Late submission will have 20% penalty per day. The submission will no longer be accepted three days after deadline.
  1. Here’s the document of MIPS instruction set. https://s3-eu-west-1.amazonaws.com/downloadsmips/documents/MD00565-2B-MIPS32-QRC-01.01.pdf
  1. For all the tasks, test cases and results will not overflow 32-bit registers.
  1. Any assignment work by fraud will get a zero point.
  1. The files you should hand in include:
    1. s
    2. s
    3. s

Please compress these files into one zip file, and name your zip file as HW1_$studentID.zip (For example, HW1_309551092.zip).

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] MIPS HW1-MIPS Programming
30 $