Question

ARMv7 Assembly 2.12 Assume that X0 holds the decimal value 128. For the instruction ADD X9,X0,X1,...

ARMv7 Assembly

2.12 Assume that X0 holds the decimal value 128.

For the instruction ADD X9,X0,X1, what is the range(s) of values for X1 that would result in overflow?

Please go IN DEPTH on explanation as texbook sucks and I'm having a tough time wrapping my head around this material.

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

Overflow bit is checked by doing XOR operation between carry into MSB and Carry out of MSB Bit . If result is 1 overflow is set to be 1 else 0 ;

For example

1100+1000= Now in this we have no carry into MSB but a carry is generated out of MSB Bit so

Carry In =0

Carry Out =1

Overflow =Carry In Xor Carry Out= 0 Xor 1 =1

Example 2

1100+1101= now Carry in and carry out both are one so 1 Xor 1 = 0 so no Overflow .

Conclusion

If carry in is 0 and both MSB are 1 then overflow occurs and called as negative overflow

If carry in is 1 and both MSB are 0 then overflow occurs and called as positive overflow .

Now come to the problem

we have 128 in binary = 10000000

Now X1 MSB bit should be 1 to get an overflow as in 128 all are 0's except MSB so carry in will always be 0

so to get overflow we need to make Carry out as 1 so make MSB of data in X1 as 1 .

X1= 1xxxxxxx here x represents that it can be 0 or 1

so Min no. to get overflow in X1 is when all x are 0

X1=10000000= 128

and

max value in X1 to get overflkow when all are 1's = 111111111=255

so Range of values in X1 when added up with 128 that will surely give overflow is

Range = 128 -255

If X1 data is in range inclusive 128 and 255 then we will get a negative overflow always

Thank You

'If u have any doubt comment the answer and if u like the answer please upvote it .

Add a comment
Know the answer?
Add Answer to:
ARMv7 Assembly 2.12 Assume that X0 holds the decimal value 128. For the instruction ADD X9,X0,X1,...
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