Question: In this project, you will be writing a program that receives a string of characters via the UART, checks if this string is a palindrome,
In this project, you will be writing a program that receives a string of characters via the UART, checks if this string is a palindrome, and then uses a print function to print either Yes or No A palindrome is a sequence of characters typically a word or phrase that is the same both forwards and backwards. For this project, strings will be terminated using a period You may assume that a string will contain at least one letter in addition to a period eg the input, b should be considered a palindrome You will not need to handle empty strings, strings containing only a period, or stings containing characters other than letters, spaces, and periods. Your program should be able to handle multiple strings sent one after another or concatenated together. For example, the string: abba data. should print Yes followed by No on the next line. Spaces should be ignored when checking for a palindrome and the palindrome should not be case sensitive For example, A nut for a jar of Tuna. would be considered a palindrome.
This is the template file.
org x
# Initializations
# NOTE: You may add initializations after line but please do not
# remove or change the initializations to $sp $s $s or $s
li $spxfffffc # Starting address of empty stack
li $sxf # UART base address
li $s arrayptr # Array head pointer
li $s arrayptr # 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
arrayptr: # Label pointing to word array
space
main:
jal pollUART
nop
jal periodcheck
nop
jal spacecheck
nop
jal casecheck
nop
jal arraypush
nop
j main
nop
####################################################################
#
####################################################################
# The "pollUART" function should poll the status register of the UART.
# If the bit position ready bit is set to then it
# should copy the receive buffer's value into $v and send
# a clear status command to the command register before
# returning a return statement is already included In order to
# receive full credit, $s must contain the base address of the UART
# and must be used with the appropriate offsets to access UART
# registers and buffers
pollUART:
jr $ra
nop
# The "periodcheck" function should check if the current character $v
# is a period If it is a period then the function should go to the
# label, "palindromecheck". If the character is not a period then it
# should use the included return.
periodcheck:
jr $ra
nop
# The "spacecheck" function should check if the current character $v
# 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.
spacecheck:
jr $ra
nop
# The "casecheck" function should perform a single inequality check.
# If the current character $v is greater than the ASCII value of Z
# which indicates the current character is lowercase, then it should convert
# the value of $v to the uppercase equivalent and then return. If the
# current character $v is already uppercase meaning the inequality
# mentioned before was not true then the function should return without
# performing a conversion.
casecheck:
jr $ra
nop
# The "arraypush" function should save the current character $v to the
# current location of the tail pointer, $s 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.
arraypush:
jr $ra
nop
# The "palindromecheck" subroutine should be jumpe
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
