Lab8 2-Bit Binary Adder-Subtractor
Lab8 2-Bit Binary Adder-Subtractor
Group No.:14
This Lab Activity has been designed to familiarize the students with design and working of binary
adders using basic logic gates.
Objectives:
Lab Instructions
✓ This lab activity comprises three parts, namely Pre-lab, Lab tasks, and Post-Lab Viva
session.
✓ The lab report will be uploaded on LMS three days before scheduled lab date. The students
will get hard copy of lab report, complete the Pre-lab task before coming to the lab and
deposit it with teacher/lab engineer for necessary evaluation. Alternately each group to
upload completed lab report on LMS for grading.
✓ The students will start lab task and demonstrate design steps separately for step-wise
evaluation (course instructor/lab engineer will sign each step after ascertaining functional
verification)
✓ Remember that a neat logic diagram with pins numbered coupled with nicely patched circuit
will simplify trouble-shooting process.
✓ After the lab, students are expected to unwire the circuit and deposit back components
before leaving.
✓ The Total duration for the lab is 3 hrs.
✓ A lab with in-complete lab tasks will not be accepted.
✓ The students will complete lab task and submit complete report to Lab Engineer before
leaving lab.
✓ There are related questions at the end of this activity. Give complete answers.
1.What do you understand by half and full adders and why are these circuits so
named?
Half Adder is a combinational logic circuit that adds two 1-bit digits. The half
adder produces a sum of the two inputs. A full adder is a combinational logic
circuit that performs an addition operation on three one-bit binary numbers.
The full adder produces a sum of the three inputs and carry value
2. Give the truth table and circuit for half adder and half subtractor.
HALF ADDER HALF SUBSTRACTOR
A B S C A B D B
0 0 0 0 0 0 0 0
0 1 1 0 0 1 1 1
1 0 1 0 1 0 1 0
1 1 0 1 1 1 0 0
HARDWARE IMPLEMENTATION:
HARDWARE IMPLEMENTATION:
• This design can be extended to n-binary addition by cascading the circuit n time. The S of each
circuit will represent the result for each digit of the final number. The Cout must be connected
to the Cin of the following circuit. The last circuit will give the final carry out.
• Such design will be slow because each stage will have to wait for the preceding stage to
generate and a carry out to proceed. This is known as the ripple carry circuit.
• To reduce the time taken we can replace the circuit with lookahead carry arrangement, but
this is cost for hardware.
6. Extend your design to 2-bit binary adder and subtractor. Draw the block diagram of the circuit
with inputs, outputs and carry
7. Draw the schematic diagram of the circuit with complete pin configuration, number, each gate
input output and carry. Carry out the hardware implementation of your 2-bit adder subtractor
and show the results to lab instructor
HARDWARE IMPLEMENTATION:
HARDWARE IMPLEMENTATION:
Verilog Code:
Waveform/Output:
module bitadder(E1,E2,E3,E4,Co,Cin,A1,A2,A3,A4,B1,B2,B3,B4);
input A1,A2,A3,A4,Cin,B1,B2,B3,B4;
module test3;
reg A1,A2,A3,A4,Cin,B1,B2,B3,B4;
wire E1,E2,E3,E4,Co;
bitadder c1(E1,E2,E3,E4,Co,Cin,A1,A2,A3,A4,B1,B2,B3,B4);
integer i,j,k,l,m,n,o,p,q;
initial
begin
for( i=0;i<2;i=i+1)begin
#100 Cin=i;
for(j=0;j<2;j=j+1)begin
#100 A4=j;
for(k=0;k<2;k=k+1)begin
#100 A3=k;
for(l=0;l<2;l=l+1)begin
#100 A2=l;
for(m=0;m<2;m=m+1)begin
#100 A1=m;
for(n=0;n<2;n=n+1)begin
#100 B4=n;
for(o=0;o<2;o=o+1)begin
#100 B3=o;
for(p=0;p<2;p=p+1)begin
#100 B2=p;
for(q=0;q<2;q=q+1)begin
#100 B1=q;
end
end
end
end
end
end
end
end
end
end
endmodule
WAVEFORM: