DLC Lab Report 03
DLC Lab Report 03
DLC Lab Report 03
BANGLADESH
Faculty of Engineering
Laboratory Report Cover Sheet
Students must complete all details except the faculty use part.
Please submit all reports to your subject supervisor or the office of the concerned faculty.
Adders and subtractors are digital circuits which are capable of adding and subtracting binary
digits. They are the most important part in the design of Arithmetic Logic Unit (ALU). In this
experiment different types of adders and subtractors will be designed and their behavior will be
observed
The Boolean expression for half and full adder is given below:
Half Adder,
S=A⊕B
C=AB
Full Adder,
S = A ⊕ B ⊕ Cin
Cout = Cin (A ⊕ B) + AB
Truth table for half adder –
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
A B Cin S C
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
A subtractor is also a combinational circuit that calculates the difference of two binary digits. This
is done by taking the two’s complement of the subtrahend and then adding it with the minuend. So
the subtractor circuit can be designed with the help of adder circuits. Like adders, there are two
types of subtractor circuits, half subtractor and full subtractor.
A half subtractor performs a subtraction between two single bits and produces their difference and
another output called borrow. A full subtractor performs a subtraction two single bits, taking into
account a borrow bit. It outputs the difference of the subtraction and a borrow bit.
Half subtractor
Difference = A ⊕ B
Borrow = A' B
Full subtractor
D = A ⊕ B ⊕ Bin
Bout = A' Bin + A' B + B Bin
X Y D B
0 0 0 0
0 1 1 0
1 0 0 0
1 1 1 1
X Y Bin D B
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
Full adder blocks can be connected for summation of n-bit systems. To design a 2 bit full adder,
two 1 bit full adders are connected in parallel connection as shown in the figure below. The same
process can be used for designing n-bit Full Adder for addition of words having a length of n-
bits.
Fig. 1.3: 2-bit Full adder design using 1 bit full adder blocks
Here, the LSB of both word A and B (A0 and B0) are connected in the first stage full adder block
and Cin of this block (Cin0) is connected to ground (as there is no carry in available at the initial
stage). The MSB of both word A and B (A1 and B1) are connected in the first stage full adder
block and Cin of this block (Cin1) is connected to the previous stage Cout (Cout0). Summation
output for the LSB is available from the first stage Sum (S0). The next stage block outputs Sum
(S1) and Carry out (Cout1) provide the MSBs for the next stage output (S1 and and S2).
Part II (Comparator)
A magnitude comparator is a device that takes in two sets of inputs in its input and compares them
to provide an output, if they are equal, greater than or less than the other. In this experiment 1-bit
comparator will be designed at first and using the 1-bit comparator block, 2-bit comparator will be
designed.
Theory and Methodology: Magnitude Comparators are combinational logic circuits that take 2 sets
of data as its inputs and tests whether the value represented by one binary word is greater than,
less than, or equal to the value represented by another binary word.
Fig.2.1: Block Diagram of 1 Bit Magnitude Comparator
Depending on the input combination for a 1-bit magnitude comparator, following behavior table
can be developed using the logic expressions.
For comparing, the following process is used as writing the logic equations.
For A=B,
If (A1=B1) & (A0=B0), then (A=B);
For A>B,
If (A1>B1) then (A>B) or
if (A1=B1) & (A0>B0), then (A>B);
For A<B,
If (A1<B1) then (A<B) or
if (A1=B1) & (A0<B0), then (A<B)
Apparatus:
1. Computer
2. Browser on PC
3. WinLogiLab Software
Simulation And Result:
Half Adder
Full Adder
Half Subtractor
Full Subtractor
1-Bit Comparator
2-Bit Comparator
Discussion:
Half and full adders and subtractors and 1-bit Magnitude Comparators are the combinational
circuit. Adders are used not only within the arithmetic logic units but also in other parts of the
processor. A subtractor are often designed using an equivalent approach as that of an adder.
Magnitude Comparators are used in central processing units (CPUs) and microcontrollers (MCUs).
We will implement the circuit within the trainer board and match the theoretically obtained truth
table by matching outputs for individual input configuration.
Conclusion:
We have successfully completed the experiment. We got all the result are as expected. Design of
a half , full adder and subtractor and 1-bit Magnitude Comparators circuits are the important topic
for digital logic design. When putting the input, we have to be careful.
References: