Computer Science, asked by sasikotapati28, 11 months ago

Analyze the status of the following flags Carry, Zero, Overflow, Sign and Even Parity for given data addition and subtraction: 1111 1001, 1010 1011

Answers

Answered by prettystefina11
1

Addition:

Rules for addition;

1)  1 + 1 = 0      Carry = 1

2)  1 + 0 = 1

3)  0 + 1 = 1

4)  0 + 0 = 0

The carry flags are shown in bold

    1 1 1 1     1 1

    1 1 1 1  1 0 0 1

+  

    1 0 1 0 1 0 1 1

——————————

1   1 0 1 0 0 1 0 0                 Overflow = 1

Carry flag = on (carry flag is used)

Zero = off (if zero is used when the carry is used)

Overflow = on (the final carry flag is 1)

Sign = off (on if the number is negative)

Even parity = on (Number of ones)

Subtraction:

Rules in subtraction;

1)  1 - 1 = 0

2) 1 - 0 = 1

3) 0 - 0 = 0

4) 0 - 1 = 1 (Borrow 2’s complement from the next available 1)

         Example:

                0  1 1

              1  1  0

              0 0 1

         —————-

               1 0 1

In the above example,

First operation : 0 - 1

Borrow from the next 1 and become 2’s complement, so the remaining answer is 1.

When 1 is borrowed, it becomes 0.

So, the next step is 0 - 0 = 0

Next step will be 1 - 0 = 1

So, the answer os 1 0 1

The carry flags are shown in bold    

                       11   1

                   0  0  11 11

        1  1  1  1   1  0  0  1

-  

        1  0  1  0  1  0  1  1

—————————————

        0  1  0  0  1  1  1  0

Carry flag = on (carry flag is used)

Zero = on (if zero is used when the carry is used)

Overflow = off (the final carry flag is 0)

Sign = off (on if the number is negative)

Even parity = on (Number of ones)

Similar questions