logo Use CA10RAM to get 10%* Discount.
Order Nowlogo

The following are some additional pseudo-instructions that one could define for MIPS. In each case, supply an equivalent MIPS instruction or sequence of instructions with the desired effec

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Question 1

The following are some additional pseudo-instructions that one could define for MIPS. In each case, supply an equivalent MIPS instruction or sequence of instructions with the desired effect. Recall that pseudo-instructions should change no registers except the destination register (if applicable, or PC for branch/jump), but pseudo-instructions may make use of $at for temporary results. Briefly describe the utility or usefulness of each pseudo-instruction. 

parta: xchg    $rt, o[$rs]     # swap the memory in M[$rs+o] with $rt
partb: slld    $rs,$rt, shamt  # Shift the double word rs:rt left by shamt 
partc: double  $rd, $rs        # $rd = 2x($rs)  
partd: triple  $rd, $rs        # $rd = 3x($rs)  
parte: mulacc  $rd, $rs, $rt   # $rd = ($rd)+($rs)x($rt)

NOTES:

  • You are not required to implement and test your code. Implementing and testing your code with an appropriate documented testing framework is worth bonus marks. 
  • in part, you are to load $rt from the effective address, and store $rt in the effective address, swapping the contents of the register and memory
  • in part, treat rs and rt together as one 64-bit register, and shift it left by  the shift amount shamt, storing the result bad in rs:rt
  • In part, mulacc is short for multiply-accumulate. You can assume that the result of (reg1) x (reg2) will fit in a single register. 
  • If you can't do a pseudo instruction with a single extra register $at, you may push the contents of a different register before the pseudo instruction, use that register, and then pop its value afterwards.

Bonus: invent a new useful pseudo instruction and write the code for it.  Explain why it is useful. 

 

Question 2

Using the min-max code from the lab as a starting point, write and implement a MIPS program which performs a sort of an array, with the following considerations:

  • The array is to be sorted by insertion sort, not selection sort. For details of the algorithm, see http://en.wikipedia.org/wiki/Insertion_sort;
  • The array is to be sorted by absolute value (e.g. 1, -2, 3, -4, 5, -6...) but the values of the array elements themselves should not be changed; and
  • Use at least one subroutine which makes use of a stack frame, including frame offsets for argument or return value access.

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

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

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

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. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

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

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

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

. 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 Sea Ports. Here are the classes and their instance variables we wish to define:

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

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

944 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

914 Answers

Hire Me
expert
AyooluwaEducation

838 Answers

Hire Me
expert
RIZWANAMathematics

851 Answers

Hire Me

Get Free Quote!

282 Experts Online