Question

How do you convert the following mips instructions into binary li $t0, 7 li $t1, 2...

How do you convert the following mips instructions into binary

li $t0, 7
li $t1, 2

please explain!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Actually load immediate is the mnemonic in MIPS and assembler translates this pseudoinstruction into the appropriate basic instruction.

Hence, li $t0, 7 will be translate into basic instruction as ori $t0, $zero, 7

and  li $t1, 2 will be translate into basic instruction as ori $t1, $zero, 2

Now MIPS binary code of ori $t0, $zero, 7 will be obtained as follows:-

6 bit opcode of ori which is 001101 followed by 5 bits code of source register $zero which will be 00000 followed by 5 bit opcode of register $t0 which is 01000 followed by 16 bits for immediate field which will be 0000 0000 0000 0111 for 7.

Hence binary code of li $t0, 7 will be

001101 00000 01000  0000 0000 0000 0111

Similarly ori $t1, $zero, 2 will have 6 bit opcode of ori which is 001101 followed by 5 bits code of source register $zero which will be 00000 followed by 5 bit opcode of register $t1 which is 01001 followed by 16 bits for immediate field which will be 0000 0000 0000 0010 for 2.

Hence binary code for ori $t1,$zero, 2 will be

001101 00000 01001 0000 0000 0000 0010

Please comment for any clarification

Add a comment
Know the answer?
Add Answer to:
How do you convert the following mips instructions into binary li $t0, 7 li $t1, 2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT