Computers and Technology
Computers and Technology, 01.10.2019 02:30, eamccoy1

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:00, pinkyglitter2696
Give an example of a case where a two-way handshake to establish a connection could leave one side of the connection live while the other side does not believe there is a connection.
Answers: 1
image
Computers and Technology, 22.06.2019 03:20, owoeli
Which of these is a benefit of social networking? oa. hiding your true identity from friendsob. avoiding talking to people in personoc. spending time with friends instead of studyingod. connecting with new people
Answers: 2
image
Computers and Technology, 22.06.2019 15:20, brookemcelhaney
The north and south regions had very diferent economies in the 1800s.
Answers: 1
image
Computers and Technology, 22.06.2019 18:00, ladyree8721
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
Do you know the correct answer?
Simpley convert the code below to assembly languageyour proof-of-study task is to hand-compile the c...

Questions in other subjects: