Question

Write the MIPS assembly code that creates the 32-bit constant 0010 0000 0000 0001 0100 1001...

Write the MIPS assembly code that creates the 32-bit constant 0010 0000 0000 0001 0100 1001 0010 0100 and stores that value to register $t1. From previous answers, I see that there is an lui and ori code. Where do those come from? Do they come from the mips reference sheet? Can I get a good explanation please.?

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

Ans. lui $t1, 0x2001 # $t1 = 0010 0000 0000 0001 0000 0000 0000 0000

ori $t1, 0x4924 # $t1 = 0010 0000 0000 0001 0100 1001 0010 0100

->Larger constants can be loaded into a register 16 bits at a time.
->The load upper immediate instruction lui loads the highest 16 bits of a register with a constant, and clears the lowest 16 bits to 0s.
- >Animmediate logical OR, ori, then sets the lower 16 bits.
To load the 32-bit value 0000 0000 0011 1101 0000 1001 0000 0000.

->This illustrates the principle of making the common case fast.
-> Most of the time, 16-bit constants are enough.
-> It’s still possible to load 32-bit constants, but at the cost of two
instructions and one temporary register.
-> Pseudo-instructions may contain large constants. Assemblers including SPIM will translate such instructions correctly.

->The limited 16-bit constant can present problems for accesses to global data.

Add a comment
Know the answer?
Add Answer to:
Write the MIPS assembly code that creates the 32-bit constant 0010 0000 0000 0001 0100 1001...
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