Docsity

2 bit binary adder and subtractor, Lecture notes of Computer Science

Toggle sidebar
bg1
Department of Electrical Engineering
Faculty Member:___Asma Majeed_______ Dated: ____26-11-19_____
Semester:______3rd _______ Section: _____B_______
EE-221: Digital Logic Design
Lab 8: 2-bit binary Adder and Subtractor
PLO4/CLO4 PLO4/CLO4 PLO5/CLO5 PLO8/CLO6 PLO9/CLO7
Name Reg. No Viva / Lab
Performanc
e
Analysis
of data in
Lab Report
Modern
Tool Usage
Ethics and
Safety
Individual
and Team
Work
Total
marks
Obtained
5 Marks 5 Marks 5 Marks 5 Marks 5 Marks 25 Marks
Maryam Mahmood 257913
Rushna Shah 249747
EE-221: Digital Logic Design Page 1
Group No.: 5
pf3
pf4
pf5
pf8
pf9
Discount

On special offer

Partial preview of the text

Download 2 bit binary adder and subtractor and more Lecture notes Computer Science in PDF only on Docsity!

Department of Electrical Engineering

Faculty Member:___Asma Majeed_______ Dated: ____26-11-19_____

Semester:______3rd^ _______ Section: _____B_______

EE-221: Digital Logic Design

Lab 8: 2-bit binary Adder and Subtractor

PLO4/CLO4 PLO4/CLO4 PLO5/CLO5 PLO8/CLO6 PLO9/CLO Name Reg. No Viva / Lab Performanc e Analysis of data in Lab Report Modern Tool Usage Ethics and Safety Individual and Team Work Total marks Obtained 5 Marks 5 Marks 5 Marks 5 Marks 5 Marks 25 Marks Maryam Mahmood 257913 Rushna Shah 249747

Group No.: 5

Lab 8: 2-bit binary Adder and Subtractor

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.

This Lab Activity has been designed to familiarize the students with design and working of

binary adders using basic logic gates.

Objectives:

 Design and Implementation of Half Adder

 Design and Implementation of a Full Adder using Half Adders

 Extending the design to add 2-bit binary numbers

 Verification of 4-bit adder IC

 Gate-Level Verilog code for 4-bit adder

Inputs Outputs

X Y Cin Sum Carry 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

  1. Now add the subtraction option in your design and show the logic diagram of full adder with subtractor.

M = 1 =>Subtraction M = 0 =>addition

  1. Can you extend your design to n-bit binary addition? How does input carry propagates through full adder stages for such design and influences the speed? How can you overcome this problem? Yes, the design can be extended to n-bit binary addition. The carry propagates through full adder with 2 gate-delays per stage (Ci → Ci+1) (AND → OR). So to solve this problem, we simplify our circuit as to minimize propagation delay and use more complex hardware.

Lab Tasks: (3 marks)

  1. Get the 4-bit binary adder IC from the lab and verify its functionality. Give IC number and pin- layout of the IC. Didn’t perform.
  2. Give the Gate-Level Verilog Code for four-bit adder and show the results on Simulation. Your code should contain following modules: half adder full adder (by instantiating half adder ) 4_bit_ binary_ adder (by instantiating full adder ) test bench_ 4_bit_binary_adder (for 4_bit_ binary_ adder ) Verilog Code: module half_adder(A,B,S,C); input A,B; output S,C;

xor XOR(S,A,B); and AND(C,A,B); endmodule module full_adder(A,B,Cin,S,Cout); input A,B,Cin; output S,Cout; wire s,c,c2; half_adder h_d1(A,B,s,c); half_adder h_d2(s,Cin,S,c2); or OR(Cout,c,c2); endmodule module bit4_Binary_Adder(A3,A2,A1,A0,B3,B2,B1,B0,Cin0,S3,S2,S1,S0,Cout3); input A3,A2,A1,A0,B3,B2,B1,B0,Cin0; output S3,S2,S1,S0,Cout3; wire Cin1,Cin2,Cin3,Cout0,Cout1,Cout2; full_adder f1(A0,B0,Cin0,S0,Cout0); full_adder f2(A1,B1,Cout0,S1,Cout1); full_adder f3(A2,B2,Cout1,S2,Cout2); full_adder f4(A3,B3,Cout2,S3,Cout3); endmodule module adder_test_module(); reg A3_,A2_,A1_,A0_,B3_,B2_,B1_,B0_,Cin0_; wire S3_,S2_,S1_,S0_,Cout3_; bit4_Binary_Adder b4_adder(A3_,A2_,A1_,A0_,B3_,B2_,B1_,B0_,Cin0_,S3_,S2_,S1_,S0_,Cout3_); initial begin B0_ = 1'b0; B1_ = 1'b0; B2_ = 1'b0; B3_ = 1'b0; Cin0_ = 1'b0; A0_ = 1'b0; A1_ = 1'b0; A2_ = 1'b0; A3_ = 1'b0;

B0_ = 1'b0; B1_ = 1'b0; B2_ = 1'b0; B3_ = 1'b0; Cin0_ = 1'b1; A0_ = 1'b0; A1_ = 1'b0; A2_ = 1'b0; A3_ = 1'b0;

B0_ = 1'b0; B1_ = 1'b0; B2_ = 1'b1; B3_ = 1'b0; Cin0_ = 1'b0; A0_ = 1'b0; A1_ = 1'b0; A2_ = 1'b1; A3_ = 1'b0;

B0_ = 1'b0; B1_ = 1'b0; B2_ = 1'b0; B3_ = 1'b0; Cin0_ = 1'b1; A0_ = 1'b1; A1_ = 1'b0; A2_ = 1'b0; A3_ = 1'b0;

B0_ = 1'b0; B1_ = 1'b0; B2_ = 1'b1; B3_ = 1'b1; Cin0_ = 1'b0; A0_ = 1'b1; A1_ = 1'b0; A2_ = 1'b1; A3_ = 1'b1;

B0_ = 1'b0; B1_ = 1'b0; B2_ = 1'b0; B3_ = 1'b0; Cin0_ = 1'b1; A0_ = 1'b1; A1_ = 1'b1; A2_ = 1'b0; A3_ = 1'b0;