Sunteți pe pagina 1din 21

PHYSICS PROJECT

Sanchit Karve born2c0de born2c0de@hotmail.com

ADDING TWO 2-BIT NUMBERS USING A BINARY FULL ADDER

CONTENTS

1. INTRODUCTION 2. ADDING BINARY NUMBERS 3. AIM 4. APPARATUS 5. PROCEDURE 6. CIRCUIT DIAGRAM 7. TRUTH TABLE 8. CONCLUSION 9. REFERENCES

INTRODUCTION
If you look at the history of computer technology, the Boolean Gate has remained a constant component of the computer. The technologies used to implement those gates, however, have changed dramatically over the years. The very first electronic gates were created using relays. These gates were slow and bulky. Vacuum tubes replaced relays. Tubes were much faster but they were just as bulky, and they were also plagued by the problem that tubes burn out (like light bulbs). Once transistors were perfected (transistors were invented in 1947), computers started using gates made from discrete transistors. Transistors had many advantages: high reliability, low power consumption and small size compared to tubes or relays. These transistors were discrete devices, meaning that each transistor was a separate device. Each one came in a little metal can about the size of a pea with three wires attached to it. It might take three or four transistors and several resistors and diodes to create a gate. In the early 1960s, integrated circuits (ICs) were invented. Transistors, resistors and diodes could be manufactured together on silicon "chips." This discovery gave rise to SSI (small scale integration) ICs. An SSI IC typically consists of a 3-mm-square chip of silicon on which perhaps 20 transistors and various other components have been etched. A typical chip might contain four or six individual gates. These chips shrank the size of computers by a factor of about 100 and made them much easier to build.

The devices used in digital circuits operate in ON and OFF state. It can also be represented as HIGH and LOW or 1 and 0 respectively. Since a digital system can have only one of the two states 1 and 0, the binary system is used to design them. The two states can also be designated as TRUE or FALSE. George Boole introduced the concept of binary system in the study of mathematical theory of logic and developed what is now known as Boolean Algebra. GATES are the most basic digital devices. A gate has one or more than one input and produces an output that is a function of the current input value(s). Irrespective of the complexities of a digital system, only a few basic operations can be performed which are AND, OR and NOT.

The Adder is a digital circuit which forms the sum and carry of two or more numbers. Adder circuits are essential inside microprocessors as part of the ALU, or arithmetic logic unit, where the processing and manipulation of binary numbers takes place. It uses three gates XOR, AND and OR to perform addition.

AND Gate
The AND gate performs a logical "and" operation on two inputs, A and B:
AND Gate A 0 0 1 1 B 0 1 0 1 Q 0 0 0 1

The idea behind an AND gate is, "If A AND B are both 1, then Q should be 1." You can see that behavior in the logic table for the gate. You read this table row by row, like this:
AND Gate A 0 0 1 1 B 0 1 0 1 Q 0 0 0 1 If A is 0 AND B is 0, Q is 0. If A is 0 AND B is 1, Q is 0. If A is 1 AND B is 0, Q is 0. If A is 1 AND B is 1, Q is 1.

OR Gate
The next gate is an OR gate. Its basic idea is, "If A is 1 OR B is 1 (or both are 1), then Q is 1."
OR Gate A 0 0 1 1 B 0 1 0 1 Q 0 1 1 1

XOR Gate
The XOR gate is also known as "exclusive or".
XOR Gate A 0 0 1 1 B 0 1 0 1 Q 0 1 1 0

The idea behind an XOR gate is, "If either A OR B is 1, but NOT both, Q is 1." The reason why XOR might not be included in a list of gates is because you can implement it easily using the original three gates listed. Here is one implementation:

If you try all four different patterns for A and B and trace them through the circuit, you will find that Q behaves like an XOR gate. Since there is a well-understood symbol for XOR gates, it is generally easier to think of XOR as a "standard gate" and use it in the same way as AND and OR in circuit diagrams.

INTEGRATED CIRCUITS

An integrated circuit (IC) is a semiconductor silicon wafer on which thousands or millions of tiny resistors, capacitors, and transistors are fabricated. Large ICs with millions of transistors may be half an inch or more on a side while small ICs may be less than one-tenth of an inch on a side.

A pin diagram shows the assignment of device signals to package pins. Shown below are the pin diagrams of the XOR,AND and OR gates which are required for construction of the 2 bit Full Adder.

ADDING BINARY NUMBERS


A key requirement of digital computers is the ability to use logical functions to perform arithmetic operations. The basis of this is addition; if we can add two binary numbers, we can just as easily subtract them, or get a little fancier and perform multiplication and division. How, then, do we add two binary numbers? Let's start by adding two binary bits. Since each bit has only two possible values, 0 or 1, there are only four possible combinations of inputs. These four possibilities, and the resulting sums, are: 0 + 0 = 0 + 1 = 1 + 0 = 0 1 1

1 + 1 = 10 The fourth line indicates that we have to account for two output bits when we add two input bits: the sum and a possible carry. Let's set this up as a truth table with two inputs and two outputs, and see where we can go from there.

INPUTS A 0 0 1 1 B 0 1 0 1

OUTPUTS CARRY SUM 0 0 0 1 0 1 1 0

The Carry output is a simple AND function, and the Sum is a XOR. Thus, we can use two gates to add these two bits together. The resulting circuit is shown below.

But we have to add multi-bit numbers together. If each pair of bits can produce an output carry, it must also be able to recognise and include a carry from the next lower order of magnitude. This is the same requirement as adding decimal numbers -- if you have a carry from one column to the next; the next column has to include that carry. We have to do the same thing with binary numbers, for the same reason. As a result, the circuit to the left is known as a "half adder", because it only does half of the job. Hence we need a circuit that will do the entire job.

To construct a full adder circuit, we'll need three inputs and two outputs. Since we'll have both an input carry and an output carry, we'll designate them as CIN and COUT. At the same time, we'll use S to designate the final Sum output. The resulting truth table is shown to the right. INPUTS A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 OUTPUTS CIN COUT S 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1

It looks as if COUT may be either an AND or an OR function, depending on the value of A, and S is either an XOR or an XNOR, again depending on the value of A. Looking a little more closely, however, we can note that the S output is actually an XOR between the A input and the half-adder SUM output with B and CIN inputs. Also, the output carry will be true if any two or all three inputs are logic 1.

What this suggests is also intuitively logical: we can use two half-adder circuits. The first will add A and B to produce a partial Sum, while the second will add CIN to that Sum to produce the final S output. If either half-adder produces a carry, there will be an output carry. Thus, COUT will be an OR function of the half-adder Carry outputs. The resulting full adder circuit is shown below.

The circuit above ( 1 bit full adder ) is really too complicated to be used in larger logic diagrams, so a separate symbol, shown below, is used to represent a one-bit full adder. In fact, it is common practice in logic diagrams to represent any complex function as a "black box" with input and output signals designated. It is, after all, the logical function that is important, not the exact method of performing that function.

Similarly, a two bit Full Adder can be represented as follows.


B 2 B 1 A1 A0

Cin

2 BIT ADDER

Cout

S1

S0

which represents the actual circuit diagram as shown below.


B1 B0 A1 A0

Cout

Cin

S1

S0

The only difference between a 1 bit and a 2 bit full adder is that the 2 bit full adder receives 4 bits as INPUT including a CARRY IN bit and outputs 2 SUM Bits and a CARRY OUT bit.

AIM

To construct a 2-bit Binary Adder using the XOR, AND and OR gate.

APPARATUS

Bread Board ( x 2 ) Connecting Wires Light Emitting Diodes (LED) ( x 3 ) 9V Battery ( x 1 ) 74LS86 (XOR) Circuit ( x 1 ) 74LS08 (AND) Circuit ( x 1 ) 74LS32 (OR) Circuit ( x 1 )

PROCEDURE

Plug the 74LS86 XOR chip, 74LS32 OR chip, and 74LS08 AND chip into the bread board in order (left to right): XOR, AND, and OR.

The gates should be connected as shown in the circuit diagram.

Note that the XOR, AND, and OR gate make up the full adder circuit for each of the two bits. Inputs A1-A2 (number 1) and B1-B2 (number 2) should be connected to four of the data switches. A fifth data switch should be connected to Carry In. Note that A1 and B1 are the LSBs of the numbers, and A2 and B2 the MSBs.

The Sum 1-2 and Carry Out should go to three adjacent LED inputs. Make sure that all switches are in the low (0) position.

Check all connections and then turn on the power. Turn on A1 and note Sum 1 light up. Now turn on B1 and note that Sum 1 goes off but Sum 2 goes on. This means that the carry (Carry 1) has propagated to the Bit 2 sum and made the output of the adder binary 2. Turn on the A2 and B2 switches and note that Carry Out now turns on (since the two twos being added make a sum of 4, and our adder is only a 2-bit adder). Experiment with the adder. Then complete the following additions, noting what sum lights are on, and whether the Carry Out light is on: 1+2, 0+2 , 1+2+carry, 1+1+carry, carry +3+1, carry+3+3,2+2+carry. Tabulate the results.

CIRCUIT DIAGRAM
The gates should be connected as follows:

TRUTH TABLE
A
00 00 00 00 00 00 00 00 01 01 01 01 01 01 01 01 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11

B
00 00 01 01 10 10 11 11 00 00 01 01 10 10 11 11 00 00 01 01 10 10 11 11 00 00 01 01 10 10 11 11

Cin
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Sum
00 01 01 10 10 11 11 00 01 10 10 11 11 00 00 01 10 11 11 00 00 01 01 10 11 00 00 01 01 10 10 11

Cout
0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1

Final Sum
000 001 001 010 010 011 011 100 001 010 010 011 011 100 100 101 010 011 011 100 100 101 101 110 011 100 100 101 101 110 110 111

CONCLUSION
Adders are widely used in many electronic devices. Adders can be used to add numbers, subtract numbers (negative addition), multiply (repetitive addition) as well as divide numbers (repetitive subtraction). The limitation of this project is that it can only compute sums up to a maximum value of 7. Adders form an integral part of ALUs [Arithmetic Logic Unit] and are widely used in high-performance DSP Applications. [Digital Signal Processing]

REFERENCES
www.play-hookey.com www.howstuffworks.com Introduction to Digital Systems University of Texas at Dallas www.doctronics.co.uk

S-ar putea să vă placă și