Consider two registers Ss0 and Ssl holding the values 0x00000002 and 0x80000003.
ID: 3723611 • Letter: C
Question
Consider two registers Ss0 and Ssl holding the values 0x00000002 and 0x80000003. Multiplication of two 32 bit values result in a 64-bit product. a. Write a MIPS code using mult' to multiply the above given values and to hold b. Write a MIPS code using" multu, to multiply the above given values and to hold c. Write a MIPS code using shift instructions to multiply the contents of Ss2 with 4, the upper 32 bits of the product in Ss2 and the lower 32 bits of the product in Ss3. the upper 32 bits of the product in Sa0 and the lower 32 bits of the product in Sal. storing the result in SvO and divide the contents of Ss3 with 2 and store the results in Svl Write down the contents of registers Ss2, Ss3, Sa0, Sal, SvO and SvlExplanation / Answer
1.MIPS code using mult(signed operands) :-
li $s0,0x00000002
li $s1,0x80000003
mult $s0,$s1
mfhi $s2
mflo $s3
explanation:- Multiply the numbers stored in the registers $s0 and $s1.
This yields a 64 bit number, which is stored in two
32 bits parts: "hi" and "lo".
mfhi loads the upper 32 bits from the product register into $s2.
mflo loads the lower 32 bits from the product register into $s3.
2.MIPS code using multu(unsigned operands) :-
li $s0,0x00000002
li $s1,0x80000003
multu $s0,$s1
mfhi $a0
mflo $a1
explanation:- Multiply the numbers stored in the registers $s0 and $s1.
This yields a 64 bit number, which is stored in two
32 bits parts: "hi" and "lo".
mfhi loads the upper 32 bits from the product register into $a0.
mflo loads the lower 32 bits from the product register into $a1.
3.MIPS code :-
mult $s2,04
mfhi $v0
mflo $v1
explanation:- Multiply the numbers stored in the registers $s0 and $s1.
This yields a 64 bit number, which is stored in two
32 bits parts: "hi" and "lo".
mfhi loads the upper 32 bits from the product register into $a0.
mflo loads the lower 32 bits from the product register into $a1.
div $s3,02
mfhi $t0
mflo $t1
explanation:- Remainder moved into $t0
Quotient moved into $t1
CONTENTS OF THE GIVEN REGISTERS--
$S2-00000001
$S3-00000006
$a0-00000001
$a1-00000006
$v0-00000000
$v1-00000004
$t0-00000000
$t1-00000003
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.