Question: Some programming languages allow twos complement integer arithmetic on variables declared byte and half, whereas MIPS only has integer arithmetic operations on full words. As
Some programming languages allow two’s complement integer arithmetic on variables declared byte and half, whereas MIPS only has integer arithmetic operations on full words. As we recall from Chapter 2, MIPS does have data transfer operations for bytes and halfwords. What MIPS instructions should be generated for byte and halfword arithmetic operations?
1. Load with 1bu, 1hu; arithmetic with add, sub, mult, div; then store using sb, sh.
2. Load with 1b, 1h; arithmetic with add, sub, mult, div; then store using sb, sh.
3. Load with 1b, 1h; arithmetic with add, sub, mult, div, using AND to mask result to 8 or 16 bits after each operation; then store using sb, sh.
Step by Step Solution
3.42 Rating (161 Votes )
There are 3 Steps involved in it
For MIPS architecture when working with byte and halfword arithmetic operations the appropriate inst... View full answer
Get step-by-step solutions from verified subject matter experts
