Assembly Programming
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
. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java
CS 340 Milestone One Guidelines and Rubric
Overview: For this assignment, you will implement the fundamental operations of create, read, update,
. 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
Retail Transaction Programming Project
Project Requirements:
Develop a program to emulate a purchase transaction at a retail store. This
. The following program contains five errors. Identify the errors and fix them
7COM1028
Secure Systems Programming
Referral Coursework: Secure
. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer
CS 340 Final Project Guidelines and Rubric
Overview The final project will encompass developing a web service using a software stack and impleme