Preview

Subtractor: Addition and Mode Switch

Good Essays
Open Document
Open Document
845 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Subtractor: Addition and Mode Switch
THE 4-BIT ADDER SUBTRACTOR

Introduction
To be able to perform arithmetic, you must first be familiar with numbers. Therefore, although we give a few helping examples, this article is not about binary numerals.
The main interactive circuit at the top of this page is an arithmetic circuit capable of performing both addition and subtraction on any two 4-bit binary numbers. The circuit has a Mode switch that allows you to choose between adding (M=0) and subtracting (M=1). To understand why this circuit works, let’s review binary addition and binary subtraction. We use 4-bit numbers in the examples because the main interactive circuit is a 4-bit adder–subtractor.
Binary addition is certainly easier than decimal addition. You just add 0s and 1s. For example to add the numbers five (0101) and six (0110) together, we just add the respective bits: Decimal numerals | Binary numerals | 6
+5 | 0110
+0101 | 11 | 1011 |
For binary subtraction, we use 2’s complement to keep things simple. For instance, to perform the operation six (0110) minus five (0101), we first obtain the 2’s complement of five and then add it to six:

Step one: Getting the 2’s complement of 5 1. Flip every bit in five to get 1010. 2. Add one to 1010 to get: 1010 + 1 = 1011.
Step two: Adding the 2’s complement of 5 to 6: 1. Decimal numerals | Binary numerals | 6
+(-5) | 0110
+1011 | 1 | 10001. |

We show the carry bit in green because normally it does not count towards the result.

Design
Now that we have reviewed our binary addition and subtraction skills, let’s look at what the circuit is doing. If you fix your gaze on the full–adders while you play around with the input switches, you will see that no matter what operation you think you are doing, the full–adder’s job never changes: the full–adder adds up the signals that appear at its inputs. This is surely not a strange behavior. In reality, whether you are doing binary addition or binary

You May Also Find These Documents Helpful