Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a flowchart for the following MIPS code: # Registers used: # $t 0 for A # $t 1 for B # $t 2 for
Create a flowchart for the following MIPS code: # Registers used: # $t for A # $t for B # $t for C # $t for D # $t$t is used to store results from evaluations data promptA: asciiz "Enter integers for A B C D respectively:" resultFb: asciiz ftwo:" resultFten: asciiz ften: resultGb: asciiz gtwo: resultGten: asciiz gten: newline: asciiz text main: #input promptA la $a promptA li $v syscall #newline li $v la $a newline syscall #read integers from users input li $v syscall move $t $v #int A$t li $v syscall move $t $v #int B$t li $v syscall move $t $v #int C$t li $v syscall move $t $v #int D$t li $t li $t loopb: beqz $t exit #if B exit loop add $t $t $t subi $t $t #repeat addition B number of times j loopb exit: li $t move $t $t #copy Ds value to $t loopbd: beqz $t exit #if D exit loop add $t $t $t subi $t $t #repeat subsequent addition D number of times j loopbd exit: add $t $t $t #calculate fBDA #input resultFten la $a resultFten li $v syscall move $a $t #move f result into $a li $v #print F in decimal syscall #newline li $v la $a newline syscall #input resultFb la $a resultFb li $v syscall move $a $t #move f result into $a li $v #print F in binary syscall #newline li $v la $a newline syscall move $t $t #copy Ds value to $t li $t loopDD: beqz $t exit #if D exit loop add $t $t $t subi $t $t #repeat addition D number of times j loopDD exit: li $t loopCA: beqz $t exit #if A exit loop add $t $t $t subi $t $t #repeat addition A number of times j loopCA exit: sub $t $t $t #compute g result #input resultGten la $a resultGten li $v syscall move $a $t #move G result into $a li $v #print G in decimal syscall #newline li $v la $a newline syscall #input resultGb la $a resultGb li $v syscall move $a $t #move G result into $a li $v #print G in binary syscall #newline li $v la $a newline syscall #exit program li $v syscall
Create a flowchart for the following MIPS code:
# Registers used:
# $t for A
# $t for B
# $t for C
# $t for D
# $t$t is used to store results from evaluations
data
promptA: asciiz "Enter integers for A B C D respectively:"
resultFb: asciiz ftwo:"
resultFten: asciiz ften:
resultGb: asciiz gtwo:
resultGten: asciiz gten:
newline: asciiz
text
main:
#input promptA
la $a promptA
li $v
syscall
#newline
li $v
la $a newline
syscall
#read integers from users input
li $v
syscall
move $t $v #int A$t
li $v
syscall
move $t $v #int B$t
li $v
syscall
move $t $v #int C$t
li $v
syscall
move $t $v #int D$t
li $t
li $t
loopb:
beqz $t exit #if B exit loop
add $t $t $t
subi $t $t #repeat addition B number of times
j loopb
exit:
li $t
move $t $t #copy Ds value to $t
loopbd:
beqz $t exit #if D exit loop
add $t $t $t
subi $t $t #repeat subsequent addition D number of times
j loopbd
exit:
add $t $t $t #calculate fBDA
#input resultFten
la $a resultFten
li $v
syscall
move $a $t #move f result into $a
li $v #print F in decimal
syscall
#newline
li $v
la $a newline
syscall
#input resultFb
la $a resultFb
li $v
syscall
move $a $t #move f result into $a
li $v #print F in binary
syscall
#newline
li $v
la $a newline
syscall
move $t $t #copy Ds value to $t
li $t
loopDD:
beqz $t exit #if D exit loop
add $t $t $t
subi $t $t #repeat addition D number of times
j loopDD
exit:
li $t
loopCA:
beqz $t exit #if A exit loop
add $t $t $t
subi $t $t #repeat addition A number of times
j loopCA
exit:
sub $t $t $t #compute g result
#input resultGten
la $a resultGten
li $v
syscall
move $a $t #move G result into $a
li $v #print G in decimal
syscall
#newline
li $v
la $a newline
syscall
#input resultGb
la $a resultGb
li $v
syscall
move $a $t #move G result into $a
li $v #print G in binary
syscall
#newline
li $v
la $a newline
syscall
#exit program
li $v
syscall
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