Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

[18 Points ] Assume we are running code on a 6-bit machine using two\'s compleme

ID: 3890319 • Letter: #

Question

[18 Points ] Assume we are running code on a 6-bit machine using two's complement arithmetic for signed integers. Also assume that TMax is the maximum integer, TMin is the minimum integer. Fill in the empty boxes in the table below. The following definitions are used in the table: int y = -29; int x = 30; Note: For the empty boxes in the first column (Expression) you MUST USE either x or y along with any other constants, eg. x+17. In the column labeled "Overflow", you should indicate Yes or No whether overflow occurred 93

Explanation / Answer

Given

Int y = -29

29 in Binary format = (011101)2

Int x = 30

30 in Binary format = (011110)2

Minimum number in 6-bit representation is -31(111111)

Maximum number in 6- bit representation is 31(011111)

1. y = -29 in decimal format is written as -29 and overflow is not activated.

Given that 6-bit 2’s compliment is used for negative number representation.

Therefore -29 is stored as 2’s compliment of (011101) = 00010+1 = 1000112 MSB is 1 because of = negative number. Since the result excluding sign bit doesn’t exceed 111112 So the overflow is not active.

2. x+1 = 30+1 = 31 (011111) which is the Tmax Result doesn’t exceed the 6 bits so overflow is not active.

3. x+2 = 30+2 = 32 (010000) Its 2’s compliment bit representation is 1011111 + 1 = 11000002 = Since the MSB is 1 the number is negative and the result exceeded 6 bits Overflow is activated.

4. x+y = 30+ (-29) = 1 (000001). Since the result is doesn’t exceed Tmax Overflow is not activated.

5. x+Tmax = 30+31 = 61 (0111101)2 .2’s compliment is 1000010 + 1= 10000112 .Since the result exceeds 6 bits Overflow is active and MSB is 1 Therefore the Decimal number is -3.

6. Tmin + y = -29 + (-31) = -60 = -(1111100)2 2’s compliment is 00000112. Since the result exceeds 6 bits Overflow is active and MSB is 0 Therefore the Decimal number is 3.

Please Rate it if find the answer is helpful….Thanks…:)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote