Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Run the given assembly code and just provide these outputs, I don't have an MIPS compiler that's why I am posting it here. Last four
Run the given assembly code and just provide these outputs, I don't have an MIPS compiler that's why I am posting it here.
Last four digits of ID: 2907
Outputs Needed
- Paste your image showing the Run I/O from the MARS MIPS simulator showing the digits entered and total
- Paste your image showing the Run I/O from the MARS MIPS simulator showing the digits entered and total
- Paste your screenshot from the MARS MIPS simulator showing the code that outputs the result of the multiplication and the full Run I/O from one run of the program
- Paste a screenshot from another test, showing the Run I/O only.
- Paste your screenshot from the MARS MIPS simulator showing the code for the loop and the full Run I/O from one run of the program
Code
.data enterMsg1: .asciiz "Please enter the last four digits of your student id " enterMsg2: .asciiz "Press enter between each digit " enterMsg3: .asciiz "Enter next digit " out1: .asciiz " Last 4 digit of your ID is " out2: .asciiz " Digits total is " .text # output the initial instruction text to the console addi $v0, $zero, 4 la $a0, enterMsg1 syscall addi $v0, $zero, 4 la $a0, enterMsg2 syscall #Call function to read digit and display details jal doCalc #Display results add $t1,$0,$v0 #Displayy output digit message la $a0,out1 addi $v0,$0,4 syscall #Display digits enterd add $a0,$0,$t1 add $v0,$0,1 syscall #Display output message of total la $a0,out2 addi $v0,$0,4 syscall #Display sum add $a0,$0,$v1 add $v0,$0,1 syscall #End of the program addi $v0,$0,10 syscall #Implementation of digits total and display details doCalc: addi $t0,$0,4 #Variable for looping addi $v1,$0,0 #Variable to find sum addi $t1,$0,1000 #Variable for digit generation addi $t2,$0,10 #Variable for digit generation addi $t4,$0,0 #Variable for digit generation #loop implementation loop: beq $t0,0,ret #Loop until get 4 digits #Message to get input digit la $a0,enterMsg3 addi $v0,$0,4 syscall addi $v0,$0,5 syscall #4-digit creation mul $t3,$v0,$t1 add $t4,$t4,$t3 #Sum add $v1,$v1,$v0 #Next digit calculation variable div $t1,$t1,$t2 #loop variable decrement addi $t0,$t0,-1 j loop #Return to main ret: #Digit in v0 and sum in v1 add $v0,$0,$t4 #Return to main
Step 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