2.11 Assume that registers X0 and X1 hold the values 0×8000000000000000 and 0×D0
ID: 3886280 • Letter: 2
Question
2.11 Assume that registers X0 and X1 hold the values 0×8000000000000000 and 0×D000000000000000, respectively.
2.11.1 [5] <§2.4> What is the value of X9 for the following assembly code? ADD X9, X0, X1
2.11.2 [5] <§2.4> Is the result in X9 the desired result, or has there been overflow?
2.11.3 [5] <§2.4> For the contents of registers X0 and X1 as specified above, what is the value of X9 for the following assembly code? SUB X9, X0,
X1
2.11.4 [5] <§2.4> Is the result in X9 the desired result, or has there been overflow?
2.11.5 [5] <§2.4> For the contents of registers X0 and X1 as specified above, what is the value of X9 for the following assembly code? ADD X9, X0, X1 ADD X9, X9, X0
2.11.6 [5] <§2.4> Is the result in X9 the desired result, or has there been overflow?
Explanation / Answer
2.11.1 [5] <§2.4> What is the value of X9 for the following assembly code? ADD X9, X0, X1
Solution:
X9=X0+X1
¿0x8000000000000000+0x D000000000000000
8+D=15
Thus,X9=0x15000000000000000=(000101010000000000000000000000000000000000000000 00000)
2.11.2 [5] <§2.4> Is the result in X9 the desired result, or has there been overflow?
Solution:
Yes, there has been overflow.An overflow occurs when the results of an arithmetic operation (i.e. addition orsubtraction) produces a result that is too large or too small to store.Overflow occurs when the leftmost retained bit of the binary bit pattern is not the sameas the infinite number of digits to the left (the sign bit is incorrect): a 0 on the left of thebit pattern when the number is negative or a 1 when the number is positive.LEGv8 architecture are all 64 bits in length and the result is 68 bits in length whichmeans there has been an overflow.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.