You are on page 1of 12

UNIVERSITY OF ENGINEERIG AND

TECHNOLOGY, LAHORE
KSK CAMPUS

“DLD PROJECT ”
4-Bit Binary Calculator
Kiran Shakeel (677)
Namra Ghulam Mustafa (675)
Ameer Hamza (672)
Asif (674)

Submitted to: Mam Anam Iftikhar


ABSTRACT:
How It Works:

The basic adding circuit is just that, basic! It consists of a XOR gate and an
AND gate to give you the basic output with a carry bit.

The XOR gate is short for exclusive or. In a regular OR gate, 0 and 0 equal 0,
1 and 0 equal 1, 1 and 1 equal 1. In an exclusive or gate, 0 and 0 equal 0, 1
and 0 equal 1, 1 and 1 equal 0. This is important because when adding 1 and
1 in binary you get 10, so the ones place has a zero, something that can't be
done with a basic OR gate.

OR:
A B Y
0 0 0
1 0 1
0 1 1
1 1 1

XOR:
A B Y
0 0 0
1 0 1
0 1 1
1 1 0

So now, when you add 1 and 0, you get 1, but hold on...When you add 1 and
1, you get 0?? That can't be right! In order to fix that, we need to be able to
have 1 and 1 equal 10. Welcome to the AND gate. As the name implies, an
AND gate equals 1 when A=1 AND B=1. This it tied in parallel with the XOR
gate and is the carryout bit, so that when you add 1+1, you CAN get 10!

Ok, so we can add 1 and 1, but what if we want to add 11 and 11, well the
problem is that there is no carrying bit on the second adder. We need a full
adder. In order to make a full adder, we have to use 2 XOR gates, 2 AND
gates and an OR gate. The circuit for the full adder is shown below:

The full adder works by putting inputs A and B through a XOR gate, then
taking the output from that and XORing it with the Carry-in. This gives you the
bit output. To make the Carry-out, you have to put A and B through an AND
gate, and put the output of the A XOR B gate and the Carry-in through an
AND gate as well. When you put those 2 outputs into an OR gate, you get a
Carry-Out bit. So now we can put a bunch of these together and get a
calculator.
Now that we have full adders, its time to put them together to make a
calculator. To connect all of the adders together, you have to connect the
carry-outs to the carry-ins in a cascading fashion. So the carry-out of the first
adder connects to the carry-in of the second adder and so on.

Below shows the concept. The blocks represent the adders and the arrows
are the carry-ins and carry-outs.
“Table of content”

➢ Introduction

➢ Literature Review

➢ Requirements

➢ Project design and implementation

➢ Use
Introduction:
A 4-bit adder means that it takes 4 bits of input. In
binary a bit is a 1 or a 0 and large numbers are
represented as a series of 1's and 0's. A 4bit adder
can sum the values from zero represented by 0000
to 15 represented by 1111. There is usually a carry bit
as well in case the result cannot be stored in 4 bits.
For example, 15 + 15 = 30 which is represented by
11110 in binary. A 5th carry bit is used to store the
most significant bit.
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001
10 = 1010
11 = 1011
12 = 1100
13 = 1101
14 = 1110
15 = 1111

Requirements:
1 Breadboard, maybe 2 - It should have atleast 50-60 rows
2 74xx AND chips - I used the 74hc08
2 74xx XOR chips - I used the 74hc86
1 74xx OR chip - I used the 74hc32
1-2 DIP Switches - I used 2 8 switch DIP switches (I'm gonna expand
to 8 bits)
8 1K ohm -or greater- resistors
Lots of wire

Implementation and design:


Step 1: Building It on a Breadboard
There are a few tricks to building this on a breadboard. The organization of
the chips on the board is very important, I found that putting the chips in this
order works well: XOR, AND, OR, AND, XOR, then the DIP switches.

Another good idea is to build each adder one at a time and on one side of the
logic gates. There are 2 XOR and 2 AND gates on each side of the chips so
that makes construction a lot easier. The order that I put the wires on were:
connections to the DIP switches, inter-gate connections, and finally
connections to the LEDs.

To wire up the switches, you first (this may only apply to cmos versions of the
chips, I haven't been able to experiment TTL versions yet) connect the side
not connected to the adder inputs to the supply voltage. Next connect the
other side (the pins connected to the adder inputs) to ground through a 1K
ohm, or greater, resistor.

The LED's are connected to the outputs of the adders through a 1K ohm
resistor. If you are using the 74LS series or similar (any series that can't
source 5 mA or more) you will have to connect the output to a transistor to get
to the required current.

Step 2: For Those Who Don't Understand or Are So-So, With


Binary

If you understand the phrase "There are 10 kinds of people in the world, those
who understand binary and those who don't" go on to the next step! If not,
stay here!

The number system we know and love is base 10. This means that each new
column of numbers is 10x the last column (if you don't believe me, divide 10
by 10 and you get 1 or divide 100 by 10 and you get 10, these relate to the
100's, 10's, and 1's columns). Binary, or base 2, is different in that each
column is a power of 2 (so each new column is 2x the last) and it uses only 1s
and 0s.

Let's look at binary numbers. Take the number 10 for example. In binary, 10
is 2 in base 10 because the first column is the 1's column and the second is
the 2's column (1*2=2). If we break this number down, we get 1 in the 2's
place and 0 in the 1's. 2+0=2, so 10 is 2. Another number example could be
101. Now we have 3 columns to work with. In binary this is the 4's column
because 1*2=2, in the 2nd column, and 2*2=4 in the 3rd column. Let's break
this down, there is a 4 and a 1 and no 2s. 4+1=5 so 101=5.

Now that you get the basics of binary, we can learn to convert to binary from
base 10. To convert to binary, you have to subtract the power of 2 that it is
greater than the number until you reach 0. This may sound confusing, as it is
hard to explain without examples, so that’s what we are going to do. Let's
take the number 15. 15 is greater than 8 (powers of 2 include 1, 2, 4, 8, 16,
32, etc.) so we do 8-15=7. We also put a 1 in the 8's column. The next power
of 2 is 4. 7-4=3, so we put a 1 in the 4's column. Next is 2. 3-2=1, so we put a
1 in the 2's column. And finally, 1-1=0, so we put a 1 in the 1's column. When
we put all of these together, we get 1111.

Now let's lake the number 11. 11-8=3, so we put a 1 in the 8's column. 3 isn't
bigger than 4, so we have to put a 0 in the 4's column. 3-2=1, so we put a 1 in
the 2's column. And finally, 1-1=0, so we again put a 1 in the 1's column. This
gives us the binary number, 1011.

Now you have a 4-bit binary calculator

Use:

“It is basically used in binary digit bit to


add 4 - bits in it”

You might also like