Question
Can you do the c merge sort code below to mips code please !!! I include the given mips code and you have to implment
Can you do the c merge sort code below to mips code please !!!
I include the given mips code and you have to implment the merge sort below it !!
# Lab 5 # Merge Sort
.data #data segment .align 2 buffer: .space 4096 #allocate space for 1K words
.align 2 name: .asciiz "CSE3666: Lab 5: YOUR NAME Tedros (YOUR NetID ttb17002) "
.text # Code segment .globl main # declare main to be global main: # specify the size of the array, must be less than 1024 la $s0, buffer # address of the buffer in $s0 li $s1, 1024 # number of elements in $s1
la $a0, name # load the address of "name" into $a0 li $v0, 4 # system call, type 4, print an string syscall # system call
# call init_array() to initialize the array with random values move $a0, $s0 # use pseudoinstructions move $a1, $s1 jal init_array
# check array move $a0, $s0 move $a1, $s1 jal check_array
# call merge_sort function with proper arguments move $a0, $s0 move $a1, $s1 jal merge_sort # call merge_sort
# check array move $a0, $s0 move $a1, $s1 jal check_array
Exit: li $v0, 10 # System call, type 10, standard exit syscall # ...and call the OS
####START_OF_MERGE_SORT # void merge_sort(int p[], int n) # TODO merge_sort:
Appendix: Pseudocode of the merge sort algorithm void merge sort (int p, int n) // Allocate space on stack and save registers // Let p3 be the starting address of a local array of n words if (nStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started