Question: 1 a . Write a function combination which implements the combinatorial function n C r in MIPS assembler. A straightforward Java implementation without checks is
a Write a function combination which implements the combinatorial function in MIPS assembler.
A straightforward Java implementation without checks is given here:
int combinations int int
int ;
forint ;;
;
forint ;;
;
return ;
b The assemble instructions for multiplication and division, respectively, are mul and div.
Use the nonrecursive factorial example with loops from the class as a starting point.
Write a main function which calls combinations twice with hardcoded and as follows:
aThe answer is
bThe answer is which takes more than bits to represent!
Exit your program with the proper syscall.$
c Test and run your program. Provide a screenshot of test runs for the two cases.
Can you use mflo or mfhi for main since large numbers become quite complex as it involves implementing
multiprecision arithmetic manually.
I need help editing my code because my outputs are supposed to be and but for some reason every time I
change my code it keeps giving me different answers. This time when I run it my output is Please help me get and
data
result: word
text
globl nain
# Invert te and at for decrementing. You want to decrement a temporary register, not a
main:
# Call combinations with
$
$
jal $al s
Sw $ve result #Store result in memory
# Display result for
li $ve
Iw
Call combinations with
$#
$#
jal $al
jal combinations
# Display result for
ii $ve
Iw
exit:
li $ syscall "exit with syscall
combinations:
# Save registers
addi $$
# Save and
nove $ $a
nove $t $a
Store result in memory
Load the result from menory.
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
