

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
These HOMEWOR NOTES are very easy to understand and very helpful to built a concept about the foundation of computers ORGANIZATION and Database Design.The key points in these slide are:Partial Combinational Logic, Hardwired Control Unit, Memory Write, Automobile Assembly Process, Completions of Automobiles, Fetch-Execute Cycle, Stages for Instruction Pipelined, Decode Instruction, Semantic Gap
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Translate the following quick sort algorithm to ARM assembly language. (YOU ARE TO USE THE ARM
CALLING CONVENTIONS WHEN IMPLEMENTING THE QUICK SORT, PARTITION, AND SWAP SUBPROGRAMS!!!)
Use the following template for your program.
AREA QUICK_SORT_PROGRAM, CODE, READONLY ; Quick sort program ENTRY MAIN ADR sp, STACK_START ADR a1, SCORES MOV a2, # LDR a3, LENGTH SUB a3, a3, # BL QUICK_SORT
; Add your code here END_QUICK_SORT
; Add your code here END_PARTITION
; Add your code here END_SWAP
AREA QUICK_SORT_PROGRAM, DATA, READWRITE SCORES DCD 20, 30, 10, 40, 50, 60, 30, 25, 10, 5 LENGTH DCD 10
STACK_END SPACE 0x00000FF ALIGN STACK_START DCD 0 DUMMY DCD 0x
END
The quick sort algorithm is below:
quickSort( start address of integer array,
function partition( start address of integer array,
integer low, high)
integer start, end ) returns an integer
local variable
local variables
integer pivotPosition
begin if (low < high) then pivotPosition = partition(array, low, high) quickSort(array, low, pivotPosition-1) quickSort(array, pivotPosition+1, high) end if end quickSort
main( ) begin quickSort(scores, 0, length-1) end main
swap( address of integer operand1, address of integer operand2) local variable integer temp begin temp = operand operand1 = operand operand2 = temp end swap
(swap should exchange the values at the addresses passed it)
integer pivotValue, pivotPosition, mid, scan
mid = (start + end) / 2 swap(array[start], array[mid]) <<< send addresses pivotPosition = start pivotValue = array[start] for scan = start + 1 to end do if (array[scan] < pivotValue) then pivotPosition = pivotPosition + 1 swap(array[pivotPosition], array[scan]) end if end for swap(array[start], array[pivotPosition]) return pivotPosition end partition
a print-out of your ARM quick sort program, e.g., hw5.s. Print the file from inside of the uVision4 IDE. a window capture of the uVision4 simulator after running your assembly language program, so it shows the above array values sorted. You can capture this window by (1) right-clicking anywhere in the window to make it the "currently active" window, (2) while holding down the