Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLP 5.2 UART String Conversion Create modular code and interface with unfamiliar modularized code The Task In this project, you will be writing a program

PLP 5.2 UART String Conversion Create modular code and interface with unfamiliar modularized code The Task In this project, you will be writing a program that converts a string to an integer (similar to Javas Integer.parseInt() method or Pythons int() function). You program will receive ASCII strings from the UART, one character at a time. It should convert each string of characters into an integer value that is passed to a provided print function. Strings will be terminated using a semicolon (;) character and will contain one or more characters in addition to the semicolon. Your program should be able to handle multiple strings concatenated together and treat each string ending with a ; as a separate input. When processing strings, it should detect any invalid characters within a string. Invalid characters are any characters other than 0 through 9 and ;. If an invalid character is detected then the rest of the string (i.e. all characters leading up to and including the next ;) should be received by the UART, but ignored. Your program should then use the print function to output an error message and then continue processing the next string as a new string. Print Function A skeleton PLP project file is available to download on Blackboard. The PLP project includes a second ASM file titled, project3_print.asm. This ASM file contains the print function used in this project. PLPTool concatenates all ASM files within a PLP project into a single location in memory (unless additional .org statements have been added to specify different location for code). No changes to project3_print.asm should be made. When called, the print function will send the value currently in register $a0 over the UART to the PLPTool simulated UART device. Register $a1 is used as an invalid character flag for the print function. If $a1 register contains a non-zero value, the print function will display an invalid character message instead of the value in register $a0. The print function is called using the following instruction: call project3_print To use the print function, your PLP program needs to initialize the stack pointer ($sp) before performing the function call (or any other operations involving the stack pointer). For this reason, the skeleton project file includes an initialization that sets the stack pointer to 0x10fffffc (the last address of RAM). This initialization only needs to be done once at the start of the program.

.org 0x10000000

# Initializations

li $sp, 0x10fffffc

# Initialize any registers you will be using here.

li $t1, 0xf0000000 #Command Register

li $t2, 0xf0000004 #Status Register

li $t3, 0xf0000008 #Receive Buffer

li $t4, 0xf000000c #Send Buffer

# It can be helpful to include a comment about a register's purpose

# next to an initialization at the start of the program for reference.

main: # TODO: write your primary program within this loop

li $t1, 0b100

and $t2, $t0, $t1

li $s0, 0xf0000000

lw $t1, 4($s0) #UART STAUS REGISTER

move $t2, $t1

li $sp, 0x10FFFFFC

li $t1, 0x59

li $t2, 0x23

push $t1

addiu $sp, $sp, -4

sw $t1, 4($sp)

push $t2

addiu $sp, $sp, -4

sw $t2, 4($sp)

pop $t1

lw $t1, 4($sp)

addiu $sp, $sp, 4

pop $t2

lw $t2, 4($sp)

addiu $sp, $sp, 4

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Different formulas for mathematical core areas.

Answered: 1 week ago

Question

2. Identify and choose outcomes to evaluate a training program.

Answered: 1 week ago