Chapter 2: 8E (page 166)
Translate into decimal
Short Answer
The translation is:
2882400018
Chapter 2: 8E (page 166)
Translate into decimal
The translation is:
2882400018
All the tools & learning materials you need for study success - in one app.
Get started for freeAssume that registers \(s0 and \)s1 hold the values 0x80000000 and 0xD0000000, respectively.
1. What is the value of \(t0 for the following assembly code?
add \)t0,\(s0,\)s1
2. Is the result in \(t0 the desired result, or has there been an overflow?
3. For the contents of registers \)s0 and \(s1 as specified above, what is the value of \)t0 for the following assembly code?
sub \(t0,\)s0,\(s1
4. Is the result in \)t0 the desired result, or has there been an overflow?
5. For the contents of registers \(s0 and \)s1 as specified above, What is the value of \(t0 for the following assembly code?
add \)t0,\(s0,\)s1
add \(t0,\)t0,\(s0
6. Is the result in \)t0 the desired result, or has there been an overflow?
For the MIPS assembly instructions in Exercise 2.4, rewrite the assembly code to minimize the number if MIPS instructions (if possible) needed to carry out the same function.
Question: If the current value of the PC is 0x00000600, can you use a single jump instruction to get to the PC address as shown in Exercise 2.39?
Question: Write the MIPS assembly code to implement the following C code:
lock(lk);
shvar=max(shvar.x);
unlock(lk);
Assume that the address of the lk variable is in \(a0, the address of the shvar variable is in \)a1, and the value of variable x is in $a2. Your critical section should not contain any function calls. Use ll/sc instructions to implement the lock() operation and the unlock() operation is simply an ordinary store instruction.
Question: Assume \(t0 holds the value 0x00101000. What is the value of \)t2 after the following instructions?
slt \(t2, \)0, \(t0
bne \)t2, \(0, ELSE
j DONE
ELSE: addi \)t2,$t2, 2
DONE:
What do you think about this solution?
We value your feedback to improve our textbook solutions.