Sunteți pe pagina 1din 6

ArithmeticCircuits

TUTORIALOBJECTIVES

Use data flip-flops to convert between serial and parallel signals. Create shift registers.

BinaryAddition
1
The hardware of our computer needs to perform binary arithmetic. The simplest is binary addition. In order to add two binary numbers together, we first need to design a circuit that can add two bits together. For example, if we want to add together the binary numbers: 101101 and 1100, then we first need to tackle adding 1 and 0. For now we will leave this circuit as a component to be designed later.

101101
1 0

1100
Bit Adder
1

1
Similarly if we wanted to add together the following: 0
0

1
1

Bit Adder ... The Bit Adder would output the result ...

2
As described below. 0
0

1 1
1

Bit Adder
1

1 And similarly for adding the bits 0 and 0: 0 0

Bit Adder ... The output from the Bit Adder would be ...

3
As described below. 0
0

0 1
0

Bit Adder
0

0 But now we run into a problem. What do we do when we try to add the bits 1 and 1 together? 1 1
1 1

Bit Adder
?

10? Obviously the answer is 10, but how can we output two bits on a single line? We cant. A line in digital circuitry can obviously only have the values 1 or 0. To solve this problem we simply introduce a second line used for the case when we try to add together the bits 1 and 1.

1
1

1
1

Bit Adder New Output 1


1 0

So now the output is 10. This new output acts as a second column for the binary representation of our output.

4
So finally, the Bit Adder looks like this: Bit A Bit B

Bit Adder Column 1 Column 0

And there are four possible inputs and outputs to this circuit: 0
0

0
0

0
0

1
1

1
1

0
0

1
1

1
1

Bit Adder
0 0

Bit Adder
0 1

Bit Adder
0 1

Bit Adder
1 0

5
So now that we have a circuit that can add two bits together, how do we go about adding together the entire binary number. Lets consider adding together: 1010 and 0100. 1010 0100 1010 0100 1010 0100 1010 0100

Bit Adder

Bit Adder

Bit Adder

Bit Adder

10 00

110 000

1110 0000

What we are doing here is adding up the bits from left to right. Notice that the left-hand bit from the Bit Adder is used as a carry in our addition (hence why we put it below).

Similarly, if we wanted to add together 1000 and 0110 we would start by doing 1000 0110

Bit Adder

... ... We input 0 and 1 into the bit adder, the output from the bit adder will give us the two bits ... and ...

6
Which would look like:

0 and 0

1000

0110

Bit Adder

0 Next we move onto the next column. 1000

0110

Bit Adder

...0 ...0 We input 0 and 1 into the bit adder, the output from the bit adder will give us the two bits ... and ...

7
Which now gives us:

0 and 1

1000

0110

Bit Adder

10 00

And if we continue add together the bits from the remaining two columns: 1000 0110 1000 0110

Bit Adder

Bit Adder

... 10 ... 00 then we will get the completed diagrams of ...

... ...10 ... ... 00

8
1000 0110 1000 0110
Bit Adder Bit Adder

110 000

1110 0000

All the examples so far have had carry bits of 0 - the left hand bit of the Bit Adders output was always 0. But if we consider adding 010 and 010, we run into a problem. 010 010 This is ok.

Bit Adder

0 010

0 010 The Bit Adder output is 1 and 0. The left bit of the output (the carry) is 1. This is ok.

Bit Adder

00 10 010 010

Bit Adder

We didnt add the carry! This is not ok!

000 010

Obviously 010 + 010 is not 000. The problem is that we dont have a circuit that can handle adding on the carry. So now we are going to create a second circuit that will be used with our Bit Adder circuit. This new circuit should be used to add together two bits and also the carry. 010 010

New Circuit

...00 ... 10 The new circuit will output the sum of the bits and the carry but also a different carry from this sum. In this example, the output will be 0+0+1 and the carry from this will be 0. 010 010
New Circuit

100 0 10

Bit A

Bit B

Bit A

Bit B

Carry

Bit Adder Column 1


Bit A 0 0 1 1 Bit B 0 1 0 1

Bit/Carry Adder Column 1


Bit A 0 0 0 0 1 1 1 1 Bit B 0 0 1 1 0 0 1 1

Column 0
Carry 0 0 0 1 Sum 0 1 1 1

Column 0
Carry 0 1 0 1 0 1 0 1 Carry 0 0 0 1 0 1 1 1 Sum 0 1 1 0 1 0 0 1

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