Overview of a Binary Adder How a Digital Binary Adder Operates By: Shawn R Moser A binary adder is a digital electronic component that is used to perform the addition of two binary numbers and return the sum and carry of their values. These circuits are used throughout electronics in order to add, and even subtract, numbers together. To explain how a binary adder works, a few concepts must be explained: 1.) How numbers are represented in a binary number system and how arithmetic is performed on such numbers 2.) How logic gates operate on binary numbers 3.) How the half-adder, the building block to the full-adder, is constructed out of logic gates 4.) How The full adder is implemented using the half-adder 5.) How the full-adder can be chained together to produce an adder of any sized number Concepts Necessary to Understand a Binary Adder A binary adder relies on basic concepts of binary numbers and logic gates. In order to fully explain this product, a brief overview of these topics is in order. The most important of which is how numbers are represented in a binary, also referred to as base-2, number system. Binary Number Representation Numbers in the everyday world are expressed in a system referred to as base-10. This means that any number is made up of digits ranging from 0 through 9. In digital electronics, this numbering system does not work due to the difficulty of building circuits that except many discrete levels of electricity. For this reason, computers use a system of numbers consisting of only two discrete-levels called binary. In the binary number system, each digit can only be two values, either 1 or 0. Each individual digit that can have either of these values is referred to as a bit, which is short for binary digit. A group of bits can be used to represent any positive integer, just as any group of regular 0 through 9 digits can be used to represent a number in the standard base-10 system. In order to create the adder, an understanding of how binary numbers correspond to their base-10 counterparts needs to be explained. Binary numbers are converted to decimal through the following simple process: 1.) Each bit in a binary number is arranged in increasing order of significance, with the left-most bit being the most significant to the right-most being the least significant. This is the same as a base-10 number, where the right-most number is the least significant. 2.) The right-most bit is given the value of 2 0, the next bit 2 1, and so on until the last bit in the number is reached. 1
3.) The binary number is then processed by each individual bit. Depending on the bits value, it is or is not added to an initial 0 sum for the number: If the bit has the value of 1, then that bits corresponding power of 2 is added to the sum If the bit has the value of 0, then that bits corresponding power of 2 is not added to the sum. With this process, any generic binary number can be converted to a base-10 number. In addition to the binary number system, there is one other concept that the binary adder relies upon: logic gates. Logic Gate Types Logic gates are simple electronic circuits that perform Boolean logical functions. Logic gates are basic building blocks for most digital circuits. Often in circuit design, and in the case of the adder, they have two inputs and one output. They represent logical function in circuitry, such as Boolean AND, OR, and NOT. The way that these logical functions work is by outputting a value depending on the particular input combination. A metaphor for such gates is to think of them as a junction of pipes. The pipe coming out of the gate will only allow water to flow out of it if certain pipes going into the gate have water flowing from them. The adder is made with AND, OR, and exclusive OR gates. The AND Gate The AND gate has two single-bit inputs. The gate outputs a value of 1 if both inputs are a 1. Otherwise, the gate outputs a binary value 0. The OR Gate Figure #1: The 2-Input AND Gate Symbol The OR gate takes two inputs that can be either binary value. The gate will output a value of 1 if either, or both input are 1. Otherwise, the get outputs a binary value 0. Figure #2: The 2-Input OR Gate Symbol 2
The Exclusive OR Gate The exclusive OR, or XOR for short, gate has two single-bit inputs. The gate will output a value of 1 if only an individual input has the value 1. The gate will output a binary-value 0 if both inputs have a matching value. Figure #3: The 2-Input XOR Gate Symbol Each of the logic gates can be attached directly to a voltage corresponding a binary 0 or a binary 1. The inputs of each can be wired to one another, meaning that the output of one gate can be used as the input of another gate. These gates are attached together in a particular manner to create the half-adder circuit. Construction of a Half-Adder: Building Block to a Full-Adder An adder for a binary number is first made using what is called a half-adder. This adder is called a halfadder because it will add two single bits and produce a carry that will be used for the next-highest order bit. This is compared to the full-adder which will make use of the carry bit of a previous addition in order to add a set of binary digits together. The half-adder has the following logic table: Inputs Outputs Operand 1 Operand 2 Carry Sum 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 Table #1: Logic Table for the half-adder circuit As one can see, this half-adder will sum the two operand, which are the inputs, and output a sum of 1 if only one of the inputs is 1 and output a carry of 1 if both of the inputs is 1. This is synonymous with the concept of addition of regular numbers, where if the sum of two digits is greater than 9, then higher digit is carried over to the next highest order number. This circuit output is created using a combination of the previously mentioned XOR and AND gates. Each gate will handle a component of the outputs: the AND gate will take the inputs and output the carry bit and the XOR gate will take the inputs and output the Sum bit. 3
Figure #4: Half-Adder Circuit Source: Mano, M. & Cilletti, M. (2013). Digital Design 5 th Edition. New Jersey: Prentice Hall. Construction of a Full-Adder The full-adder is an extension of the half-adder. The adder works by taking the carry bit from a previous full-adder, and using it in the addition of the two operand bits. This means, that this adder can be used to add together binary numbers that consist of more than one bit. This adder functions by taking in to consideration this carry bit, the two operands, and passing them through a set of gates that will create a sum output. Table #2 shows the logic table for the carry and the sum outputs considering the input of operand 1 and operand 2 along with a carry-over input that may come from any previous adders. Input Output Operand 1 Operand 2 Carry-Over Carry Sum 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 Table #2: Logic Table for the full-adder circuit The implementation of the full-adder is performed by chaining together two separate half-adder circuits. The first half-adder s sum output is connected to input of the second half-adder. Along with this, the carry-over from any previous adder, which is also a binary value, is used as the second input to the second half-adder. The sum output from this second adder is used to determine the sum that is output for the adder device. The carry from the first half-adder is connected to an OR gate along with the carry from the second halfadder. By using an OR gate, the output for the full-adder s carry will be 1 if either of the carry bits from the half-adders are 1. Figure #5 shows the circuit diagram for the full-adder and outlines the location of each half-adder contained within the full-adder. 4
Figure #5: Full-Adder Sum Circuit Source: Mano, M. & Cilletti, M. (2013). Digital Design 5 th Edition. New Jersey: Prentice Hall. The full-adder, unlike the half-adder, can account for the carry of bits from other bit adders. By connecting the carry from a previous adder to the carry-over of another full-bit adder, the adders can be chained together in manner that will allow them to operate on operands existing of multiple bits. Construction of a Multiple-Bit Adder Full-adder circuits can then be chained together so that binary number representations consisting of more than one bit can be added together. To do so produces a ripple-carry adder. Figure #4 displays how two full-adder circuits, represented by the boxes for each, can be wired together to add two numbers, each consisting of three bits. Each full-adder receives a single bit input for that particular bit position of both binary operands, along with a carry from the adder for the less-significant bit. Figure #4: A chained 3-bit adder Adder circuits like these can be used to sum any integer value, as long as enough full-adders are added together. Most digital electronics make large use of such circuits, and they can be found in billions of devices throughout the world. 5