Question

Referring to Friday’s class presentation on “condition flags” (Z=zero, N=negative, C=carry, V=overflow), assume the operation A-B...

Referring to Friday’s class presentation on “condition flags” (Z=zero, N=negative, C=carry, V=overflow), assume the operation A-B is performed using two’s complement arithmetic. For each of the following six relationships, write a logic expression in terms of Z, N, C, and/or V that evaluates to 1 if that relationship is true, based on the result of A-B.

A = B

A != B (not equal)

A > B

A ≥ B

A < B

A ≤ B

Homework Answers

Answer #1

1. A=B

let A=B=9

A= 1001, B=1001, 2's compliment of B= 0111

A-B= 1 0000

Z=1, N=0, C=1, V=1

2. A!=B

let A=9, B=8.

A=1001, B=1000, 2's compliment of B= 1000

A-B= 1 0001

Z=0, N=0, C=1, V=0.

3. A > B

let A=9, B=8.

A=1001, B=1000, 2's compliment of B= 1000

A-B= 1 0001

Z=0, N=0, C=1, V=0.

4. A>=B

let A=9, B=8.

A=1001, B=1000, 2's compliment of B= 1000

A-B= 1 0001

Z=0, N=0, C=1, V=0.

OR

let A=B=9

A= 1001, B=1001, 2's compliment of B= 0111

A-B= 1 0000

Z=1, N=0, C=1, V=1

5. A<B

let A=8, B=9.

A=01000, B=01001, 2's complient of B=10111.

A-B= 11111

Z=0, N=1, C=0, V=0.

6. A<=B

let A=8, B=9.

A=01000, B=01001, 2's complient of B=10111.

A-B= 11111

Z=0, N=1, C=0, V=0.

OR

let A=B=9

A= 1001, B=1001, 2's compliment of B= 0111

A-B= 1 0000

Z=1, N=0, C=1, V=1.

Hence Expression for Z, N, C, V:

Z+N+C+V=1

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT