Using binary signed 2’s complement notation for integers. You may assume that the maximum size of integers is of 9 bits including the sign bit. (Please note that the numbers given here are in decimal notation).

i) Add – 256 and 206

ii) Subtract 224 from –99

iii) Add 124 and 132

Please indicate the overflow if it occurs. Also write how you identify overflow.

iii) Add 124 and 132

First, we have to represent the number in binary notation

The sign of a binary number is represented by 0 as plus and 1 as minus

Sign bit 8 -bits

0 / 1

Now, Binary value of the given number

+124 – 01111100

+132 – 10000100

+124:-

Sign bit 8 -bits

0

0

1

1

1

1

1

0

0

+132:-

Sign bit 8 -bits

0

1

0

0

0

0

1

0

0

+124:-

Sign bit 8 -bits

0

0

1

1

1

1

1

0

0

+132:-

0

1

0

0

0

0

1

0

0

+256 :-

Carry bit

0

1

0

0

0

0

0

0

0

0

Overflow condition occured.

The magnitude has been overflowed into sign bit and sign into carry the given 8-bits are not sufficient for the result of the magnitude.

Using binary signed 2’s complement notation for integers. You may assume that the maximum size of integers is of 9 bits including the sign bit. (Please note that the numbers given here are in decimal notation).

i) Add – 256 and 206

ii) Subtract 224 from –99

iii) Add 124 and 132

Please indicate the overflow if it occurs. Also write how you identify overflow.

ii) Subtract 224 from –99

First, we have to represent the number in binary notation

The sign of a binary number is represented by 0 as plus and 1 as minus

Sign bit 8 -bits

0 / 1

Now, Binary value of the given number

99 – 01100011

224 – 11100000

-99 :-

Sign bit 8 -bits

1

0

1

1

0

0

0

1

1

+224 :-

Sign bit 8 -bits

0

1

1

1

0

0

0

0

0

In Binary, Subtraction is not done directly it is done by taking a MINUS sign for a positive number.

For subtraction changing +224 to -224:-

-224 :-

Sign bit 8 -bits

1

1

1

1

0

0

0

0

0

Now, covert it to signed 2’s complement notation:-

-99 :-

Sign bit 8 -bits

1

1

0

0

1

1

1

0

1

-224 :-

Sign bit 8 -bits

1

0

0

1

0

0

0

0

0

Simple trick to convert any binary value to its signed 2’s complement notation is Check for the first one (i.e. 1) in the magnitude of the number from Right to Left when you find it, Keep the number unchanged till one (i.e. 1) and remaining number reverse it by changing value from 0 to 1 and vice-verse.

-99 :-

Sign bit 8 -bits

1

1

0

0

1

1

1

0

1

-224 :-

1

0

0

1

0

0

0

0

0

-323 :-

Carry bit

1

0

1

0

1

1

1

1

0

1

Overflow condition occured.

The magnitude has been overflowed into carry the given 8-bits are not sufficient for the result of the magnitude.

using binary signed 2’s complement notation for integers. You may assume that the maximum size of integers is of 9 bits including the sign bit. (Please note that the numbers given here are in decimal notation).

i) Add – 256 and 206

ii) Subtract 224 from –99

iii) Add 124 and 132

Please indicate the overflow if it occurs. Also write how you identify overflow.

i) Add – 256 and 206

First, we have to represent the number in binary notation

The sign of a binary number is represented by 0 as plus and 1 as minus

Sign bit 8 -bits

0 / 1

Now, Binary value of the given number

206 – 11001110

256 – 100000000

This number value is of more than 8-bits (i.e.9-bits) in signed 2’s complement notation also the value remains the same. Hence this number cannot fit inside it.

To add this numbers we will need one more bit, hence Addition not possible.