Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please using PLP help with the following code . Thank you .org 0x10000000 # Initializations # NOTE: You may add initializations after line 10, but

Please using PLP help with the following code . Thank you

.org 0x10000000

# Initializations # NOTE: You may add initializations after line 10, but please do not # remove or change the initializations to $sp, $s0, $s1, or $s2

li $sp, 0x10fffffc # Starting address of empty stack li $s0, 0xf0000000 # UART base address li $s1, array_ptr # Array head pointer li $s2, array_ptr # Array tail pointer

#################################################################### # Do not make changes to the jump to main, the allocation of # memory for the array, or the main loop #################################################################### j main nop

array_ptr: # Label pointing to 100 word array .space 100

main: jal poll_UART nop jal period_check nop jal space_check nop jal case_check nop jal array_push nop j main nop #################################################################### # ****************************************************************** ####################################################################

# The "poll_UART" function should poll the status register of the UART. # If the 2^1 bit position (ready bit) is set to 1 then it # should copy the receive buffer's value into $v0 and send # a clear status command (2^1) to the command register before # returning (a return statement is already included). In order to # receive full credit, $s0 must contain the base address of the UART # and must be used with the appropriate offsets to access UART # registers and buffers

poll_UART:

jr $ra nop

# The "period_check" function should check if the current character ($v0) # is a period ("."). If it is a period then the function should go to the # label, "palindrome_check". If the character is not a period then it # should use the included return.

period_check:

jr $ra nop

# The "space_check" function should check if the current character ($v0) # is a space (" "). If it is then it should jump to "main" so # that it skips saving the space character. If not it should # use the included return.

space_check:

jr $ra nop

# The "case_check" function should perform a single inequality check. # If the current character ($v0) is greater than the ASCII value of 'Z', # which indicates the current character is lowercase, then it should convert # the value of $v0 to the uppercase equivalent and then return. If the # current character ($v0) is already uppercase (meaning the inequality # mentioned before was not true) then the function should return without # performing a conversion.

case_check:

jr $ra nop

# The "array_push" function should save the current character ($v0) to the # current location of the tail pointer, $s2. Then it should increment the # tail pointer so that it points to the next element of the array. Last # it should use the included return statement.

array_push:

jr $ra nop

# The "palindrome_check" subroutine should be jumped to by the period # check function if a period is encountered. This subroutine should contain # a loop that traverses the array from the front towards the back (using the # head pointer, $s1) and from the back towards the front(using the tail # pointer, $s2). If the string is a palindrome then as the array is traversed # the characters pointed to should be equal. If the characters are not equal # then the string is not a palindrome and the print function should be used # to print "No". If the pointers cross (i.e. the head pointer's address is # greater than or equal to the tail pointer's address) and the compared # characters are equal then the string is a palindrome and "Yes" should be # printed. # # Remember to restore the head and tail pointers to the first element # of the array before the subroutine jumps back to main to begin processing the # next string. Also, keep in mind that because the tail pointer is updated at # the end of "array_push" it technically points one element past the last # character in the array. You will need to compensate for this by either # decrementing the pointer once at the start of the array or using an offset # from this pointer's address.

palindrome_check:

j main nop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What is meant by 'Wealth Maximization ' ?

Answered: 1 week ago

Question

Do you believe that Matilda overreacted to James? Why or why not?

Answered: 1 week ago