Starting from:
$30

$24

Assignment 6 Solution

[70] Write a Y86 program that sorts an array of integers.



(10) Allocate a hardcoded input array similar to that used by asum.ys (linked on course examples page) with at least 10 entries.



(30) Implement a sort procedure that sorts the input array using Selection Sort. Your sort procedure should sort the array in place – there’s no need to allocate additional memory for an output array.



(10) Have your sort procedure call your swap procedure from assignment 5 to perform the actual swaps in memory.



(10) Implement a main procedure to call your sort procedure, passing the input array and array length as arguments.



(10) Follow the register usage conventions outlined in B&O’H section 3.7.3.



Name your source file 6-1.ys.




2. [30] Consider the following Y86 code:




addl %edx %eax




mrmovl 0(%ecx) %edx




addl %edx %eax




How many pipeline stalls (or bubbles) are required when running the above code with and without forwarding (see sections 4.5.5-4.5.8 in the textbook)? Write your answers in your solutions document.




Zip the source files and solution document (if applicable), name the .zip file <Your Full NameAssignment6.zip (e.g., EricWillsAssignment6.zip), and upload the .zip file to Canvas (see Assignments section for submission link).

More products