! difficulty ratingCheck section A.10 for interesting assembler services
More Hints
Write a simple 30-50 instruction assembly program with 1-2 nested procedures, 2-3 leaf procedures, and utilizing assembler directives and MIPS pseudo-instructions.
|
! ! !
SPIM Exercise 5.1Load and run this version of procedure sort from your textbook.
! ! ! !
SPIM Exercise 5.2Write a procedure to implement selection sort. Call the procedure "sel_sort". Procedure inputs: list of 32-bit signed integers (pass address), and list size (n). Use procedures swap and smallest from SPIM Exercises 3.2 and 3.4, respectively. Use the sample list from 3.4 (without the end mark "-1") and the list from 5.1 to test your code. ! ! ! ! !
SPIM Exercise 5.3 Show me!Write a procedure to implement insertion sort (see hints to the left). Call the procedure "ins_sort".
! ! ! !
SPIM Exercise 5.4 Write a procedure to implement binary search. Your assembly should be based on this high level code (use the bubble sort procedure from your textbook). Note that you will need a main() to test your work.
! ! ! !
SPIM Exercise 5.5 Write a procedure "median" to calculate the median of an odd-sized list of nonzero 4-byte words. Procedure median should call 2 other procedures: procedure sort from your textbook, and the leaf procedure Mid which you will write. Note that you will need a main() to test your work.
Hint: follow these general steps: test if list size is odd (otherwise exit); sort list; calculate the mid-point index; use mid-point index to loop through list until mid-point element (or to calculate the address of mid-point element directly), use that addr to get the median value. What is the median? |