CIS 314 Assignment 6


Rate this product

CIS 314 Assignment 6 – 100/100 points –
Please submit individual source files for coding exercises (see naming conventions below) and a
single solution document for non-coding exercises (.txt or .pdf only), when appropriate. Your
code and answers need to be documented to the point that the graders can understand your
thought process. Full credit will not be awarded if sufficient work is not shown.
1. [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 Bubble 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)? Draw pipeline diagrams to
support your answers (see Figure 4.43). Write your answers in your solutions document.
Zip the source files and solution document (if applicable), name the .zip file <Your Full (e.g.,, and upload the .zip file to Canvas (see
Assignments section for submission link).

Open chat
Need help?
Can we help you?