Perform the rotation operation on the array write down the


Computer Organization and Design Assignment: MIPS Assembly Programming and Computer Arithmetic

Q1 Write and test an adding machine program that repeatedly reads in integers and adds them into a running sum. The program should stop when it gets an input that is -1, printing out the sum at that point.

Q2 Write and test a program that reads in a positive integer using the SPIM system calls. If the integer is not positive, the program should terminate with the message "Invalid Entry"; otherwise the program should print out the names of the digits of the integers, delimited by exactly one space. For example, if the user entered "728," the output would be "Seven Two Eight."

Q3 Write and test a MIPS assembly language program to compute and print the first 150 prime numbers. A number n is prime if no numbers except 1 and n divide it evenly. You should implement two routines:

- test_prime (n) Return 1 if n is prime and 0 if n is not prime.
- main () Iterate over the integers, testing if each is prime. Print the first 150 numbers that are prime. Test your programs by running them on SPIM.

Q4 A left rotation operation on an array of size shifts each of the array's elements unit to the left. For example, if left rotations are performed on array [1, 2, 3, 4, 5], then the array would become [3, 4, 5, 1, 2].

Given an array of n integers and a number, d, perform d left rotations on the array.

- Write a function to read two integers n, d.
- Read the following n integers into an array.
- Perform the rotation operation on the array.
- Then print the updated array as a single line of space-separated integers.

Q5 Answer the following:

a. What decimal number does the bit pattern 0×0C000000 represent if it is a two's complement integer? An unsigned integer?
b. If the bit pattern 0×0C000000 is placed into the Instruction Register, what MIPS instruction will be executed?
c. What decimal number does the bit pattern 0×0C000000 represent if it is a floating point number? Use the IEEE 754 standard.

Q6 Answer the following

a. Write down the binary representation of the value of pi assuming the IEEE 754 single precision format.
b. Write down the binary representation of the value of pi assuming the IEEE 754 double precision format.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Perform the rotation operation on the array write down the
Reference No:- TGS02673361

Expected delivery within 24 Hours