Negative Numbers and Binary Subtraction

Negative Numbers and Binary Subtraction - Negative Numbers...

This preview shows pages 1–3. Sign up to view the full content.

Negative Numbers and Binary Subtraction We have seen how simple logic gates can perform the process of binary addition . It is only logical to assume that a similar circuit could perform binary subtraction. If we look at the possibilites involved in subtracting one 1-bit number from another, we can quickly see that three of the four possible combinations are easy and straight-forward. The fourth one involves a bit more: 0 - 0 = 0 1 - 0 = 1 1 - 1 = 0 0 - 1 = 1, with a borrow bit. That borrow bit is just like a borrow in decimal subtraction: it subtracts from the next higher order of magnitude in the overall number. Let's see what the truth table looks like. INPUTS OUTPUTS This is an interesting result. The difference, A-B, is still an Exclusive-OR function, just as the sum was for addition. The borrow is still an AND function, but is A'B instead of AB. What we'd like to do, now, is find an easy way to use the binary adder to perform subtraction as well. We already have half of it working: the difference output. Can we simply invert the A input so the AND gate will have the right signals? No, we can't, because that would invert the sense of the Exclusive-OR function. What would be really nice is to convert B to the negative equivalent of its value, and then use the basic adder just as it stands. To see if we can do that, let's consider negative binary numbers below. A B BORROW A - B 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 As we discovered when looking at binary counters , once a full count is obtained, the next clock pulse will cause the Binary Unsigned Decimal Signed Decimal

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
counter to read zero again. Likewise if we set up a counter to count backwards , the first clock pulse will cause the count to go from all zeroes to all ones. Thinking along these
This is the end of the preview. Sign up to access the rest of the document.

Negative Numbers and Binary Subtraction - Negative Numbers...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online