When Claud Shannon discovered that Boolean True and False was equivalent to the electrical states of On and Off, he opened the gates that led to the development of machines that could follow lines of reasoning by performing calculations and carrying out logic.

The first computers by today’s standards were very simple, extremely limited and slow but they were the first steps in a technological journey that has profoundly changed the course of humanity.

Before the dawn of the Age of Computing, a “calculator” was the game given to a role held by a person. Organisations would employ whole teams of “calculators” whose purpose was to carry out long, complex, algorithmic jobs. For example, large companies would employ them to process finances.

Even with a large team of calculators, these jobs often took long time to complete, they were expensive to carry out and were prone to human error. The motivation to solve this problem by using faster and more reliable machines was considerable to say the least.

Calculation

Modern computers perform calculations and logic operations. Consider the 4 basic types of calculation:

  • Addition
  • Subtraction
  • Multiplication
  • Division

All of these types of calculation can be performed by using addition in different ways.

  • To subtract, we can add the inverse of one number to another (100-50 is the same as 100 add -50).
  • To multiply, we can add a number to itself a given number of times.
  • To divide, we can count the number of times a number needs to be added to itself in order to reach a particular value.

If these calculations are carried out in binary (instead of decimal/denary), then it is possible to create an electronic circuit using Boolean Logic that uses the rules of binary addition.

To recap the rules and method, work by adding one pair of bits together at a time, starting with the least significant (furthest to the right) bits:

  • 0 + 1 = 1
  • 1 + 1 = 10 (Write 0 and carry the 1)
  • 1 + 1 + 1 = 11 (Write 1 and carry the 1)

We can make a logic circuit that produces these results. We start by creating the Truth Table.

To create a truth table, first we identify the inputs. In the case of binary addition there are two inputs:

  • The ‘first’ bit (We will refer to this as A).
  • The ‘second’ bit (The “other” bit that’s added to the first. We will refer to this as B).

The process of binary addition produces two outputs, the “sum” bit (S) and the “carry” bit (Cout).

It is simpler at first to think of this problem as two separate circuits that share the same inputs. The first circuit will produce the “sum” S and the second, the “carry” (Cout)

When we draw a truth table we need to write every possible combination of zeroes and ones, in this case there are 2 inputs which means we will have 22 (4) possible combinations. Remember, although there are two outputs for now we are going to consider each output separately.

Input AInput BOutput S
00
01
10
11
When creating a truth table it is important to methodically write down every possible combination of ones and zeroes. One way to do this is to “count up” in binary, starting with a zero in every input and ending when you have a one in every input.

Now we need to look again at the rules of binary addition, for each set of inputs, what should the sum part of the output be? We write these output values next to each pair of inputs as shown below.

Input AInput BOutput S
000
011
101
110
Completed truth table for binary addition, showing only the “sum” part of the calculation. Compare the inputs and outputs here with the rules of binary addition above.

We can see that the sum part of binary addition can be produced just by using a single Xor gate. Now, lets consider the carry.

Input AInput BCout
000
010
100
111
This truth table shows the “carry” part of binary addition, again, compare the inputs here with the rules of binary addition.

From this truth table we can see that the carry bit output can be obtained by applying an And to both inputs A and B.

Usually, we combine both of these truth tables into one as shown below.

Input AInput BOutput SCout
0000
0110
1010
1101
The combined truth table showing all of the inputs for binary addition as well as the sum and cout outputs.
A binary “half adder”

Binary Half Adder

This circuit is known as a “half adder”. Look back at the rules of binary addition, there are actually three inputs. These are the two bits that are being added together + the carry bit from the previous column.

To simplify the concept of this we can abstract the half adder circuit above as shown below.

A rectangle labelled "Half Adder". Two horizontal are attached to the left side and are labelled A & B.
Two similar lines are attached to the  right side are labelled S &Cout.
In this abstracted diagram, the detail of the components has been hidden. The diagram only shows the inputs and outputs.

We can use two half adders to add together (bit A + B bit) + the carry bit.

The S (sum) output of a first half adder feeds into an input of a second half adder (this takes care of (bit A + B bit)). The other input of this second half adder comes from the Carry bit. Using this allows the result of A+B to be added with a carry bit.

The two Cout outputs from both of the half adders are combined together with an Or gate, if either part of the calculation results in a carry, this will then be accounted for.

Top left is a half adder with inputs A and B.
In the centre is a second half adder. The S output of the first half adder feeds into this, a longer line connects to Cin, which is below the inputs A and B.
One output of this second half adder is labelled S.
An Or gate joins the Cout outputs from both of the half adders.
A binary “full adder”
One half adder adds bits A and B together. The Sum of this calculation is one input of the second half adder. The other input of this is the Cin (“Carry In”). Both Cou (“Carry out”) outputs are combined with an Or gate.

The diagram above shows how we can add two single bits (and a carry bit).

Consider a more realistic example, an eight bit calculation: 10101010 + 11101010

A8A7A6A5A4A3A2A1
10101010
B8B7B6B5B4B3B2B1
11101010
CarryC8C7C6C5C4C3C2C1
11101010
S9S8S7S6S5S4S3S2S1
110010100

We can “daisy chain” 8 full adders together to allow calculations like this to take place as shown below.

8 rectangles arranged vertically, each rectangle is labelled as "Full Adder".
Each Full Adder has 3 inputs on the left, labelled A1, B1, Cin1 down to A8, B8, Cin8.
Each FUll adder has 2 outputs, a S1 to S8 and A Cout1 to Cout8.
Cout1 feeds into Cin2 and so on...
An 8 bit “adder
An arrangement of 8 full adders. The Carry out of the first adder feeds into the Cin of the next. This circuit can add together 2 a bit numbers. To add bigger numbers, more full adders will be required.

By admin