subject

Simpley convert the code below to assembly languageyour proof-of-study task is to hand-compile the code below into an assembly language function (a procedure), then place it in the provided .asm file, test it, and turn it in. your function must adhere to the procedure calling conventions covered in class. you must also use specific registers when storing local variables, see below. before you start: you may use my tests -- i've set them up to make it easy for you to test your code, and i have examples in the tests! : ) here they are: proof-of-study #4.asmhere is a recursive sorting algorithm that you will convert into assembly: void sort (int[] data, int lowindex, int highindex){ print ("entering sort: ") print (lowindex) print (" ") print (highindex) print ("\n") if (lowindex > = highindex) print ("leaving sort: ") print (lowindex) print (" ") print (highindex) print ("\n") return tempindex = lowindex centerindex = lowindex centervalue = data[highindex] while (tempindex < highindex) tempvalue = data[tempindex] if (tempvalue < centervalue) data[tempindex] = data[centerindex] data[centerindex] = tempvalue centerindex = centerindex + 1 tempindex = tempindex + 1 data[highindex] = data[centerindex] data[centerindex] = centervalue sort (data, centerindex+1, highindex) sort (data, lowindex, centerindex-1) print ("leaving sort: ") print (lowindex) print (" ") print (highindex) print ("\n") return}note that the code looks similar to java, c, or many other languages. it has variables (assumed to be integers or arrays), a loop, and 'if' statements. the loop and 'if' statements use indentation to show scope. when converting this algorithm, use only these registers for variables: variable register notesdata $s1 array address, it arrives in $a0 but your code will copy $a0 to $s1 and use $s1 insteadlowindex $s2 integer, it arrives in $a1 but your code will copy $a1 to $s2 and use $s2 insteadhighindex $s3 integer, it arrives in $a2 but your code will copy $a2 to $s3 and use $s3 insteadtempvalue $t0 integertempindex $t1 integercentervalue $t2 integercenterindex $t3 integerwhen needed, you can use $t4-$t9 for additional temporary computations (addresses, but not for program variables. you may use pseudoinstructions. you will need to add code to the function to properly create a stack frame and to preserve registers appropriately. follow the convention covered in class (required). clearly comment your code. you may write the assembly code for your function separately, or you may write it as part of this test program (easier): do not optimize your program. each c/java statement should be independently translated to assembly. don't avoid writing code because you want to reuse a previous temporary value - always write the complete code for each statement. (you can verify correctness much faster by doing it this way.)after you convert the statements, add the code to create the stack frame and do preservation of registers. the code is recursive. be careful to preserve the needed temporary variable(s) just before you make the first function call, and restore it/them when the function call completes. if you're curious, note that i adapted a quicksort algorithm to be easy to code in assembly. do not add sorting code (or other critical statements) to 'main' because it won't be in our version of main. you can change your main as needed for testing (but remember that we will not use your 'main' function).your sort procedure should be contiguous statements. don't embed other functions within your sort function. we'll only copy your sort function into our test code, and it needs to be easy for us to extract it.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
What ordering of tcp flags makes up the three-way handshake?
Answers: 2
question
Computers and Technology, 22.06.2019 17:30
Rachel completed typing an official document with a word processing program. she wants to make sure that her document has no typographical errors. she also wants all headings to have the same font. which features in a word processing program should she use? rachel should use the feature in a word processing program to find typographical errors. she should apply to have uniform headings.
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Which demographic challenge is europe currently experiencing? a. an aging and decreasing population b. a baby boomc. an unequal distribution between males and females d. a large group of teenagers moving through the school system(i chose a but i'm unsure)
Answers: 1
You know the right answer?
Simpley convert the code below to assembly languageyour proof-of-study task is to hand-compile the c...
Questions
question
Mathematics, 05.10.2020 15:01
question
Mathematics, 05.10.2020 15:01
Questions on the website: 13722359