assembly w/ Mars (Memory mapped I/O polling) Write a MIPS program to implement the following single digit adder: keyboard input: X+Y= display output: X+Y=Z (w/
assembly w/ Mars
(Memory mapped I/O polling) Write a MIPS program to implement the following single digit adder:
keyboard input: X+Y=
display output: X+Y=Z (w/ MMIO simulator)
where X and Y are single digits (such as 2 and 7) and Z is the result (such as 9).
A possible way to implement:
1. Polling on the receiver control and read the byte from the receiver data. Doing this for four times so that the four characters X, +, Y, = are stored in an array.
2. Compute the result Z. You need find your own way of converting the ascii byte for a digit into the value of the digit so that the value of Z can be computed. Store the ascii bytes (the result Z might have two digits) into the array.
3. Polling on the transmitter control and write into the transmitter data so that the experssion (such as 5+7=12) is sent to the display.
4. To test your code, you need open the MMIO in the simulator. Goto ToolsKeyboard and Display MMIO make sure you press connect to MIPS to run your code. Sometimes, it is also helpful to press reset on the same screen.
5. Hint: a way to convert a byte storing a single digit into the value of the digit, and the converse (my code is untested)
char2num:
lb $t0, asciiZero
subu $v0, $a0, $t0
jr $ra
num2char:
lb $t0, asciiZero
addu $v0, $a0, $t0
jr $ra
.data
asciiZero: .byte 0
exp: .byte 30
here is one way to make it.
I Codel last- Pchar-into btte41a4b Shador jelrto | Mealeh)du-msale app-instale thidofre--aol she rhe /f Malton-ery-tso. Cey-SSD-6tya Aealt-in se3 so. Ce b-Ssb ab 379 e..th_nesuyub . Sne byte or trolyhe. llSeed.Asex-a chak hoDeple Pryhe snd-r bthr Erp. r space to Buffer ptbefferZre law-clon h thStep by Step Solution
There are 3 Steps involved in it
Step: 1
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