Professional Documents
Culture Documents
Object 1
ENTITY half_adder IS
--- Half Adder
PORT(a,b:IN BIT; s,c :OUT BIT);
END half_adder;
ARCHITECTURE half_adder_beh OF half_adder IS
BEGIN
s <= a XOR b;
-- Implements Sum for Half Adder
c <= a AND b;
-- Implements Carry for Half Adder
END half_adder_beh;
ENTITY full_adder IS
PORT(a,b,c: IN BIT ;
sum, carry : OUT BIT);
END full_adder;
module ha(s,co,a,b);
output s,co;
input a,b;
xor1 u1(s,a,b);
and1 u2 (co,a,b);
endmodule
module fa(s,co,a,b,ci);
output s,co;
input a,b,ci;
xor1 u1(s,a,b,ci);
and1 u2(n1,a,b);
and1 u3(n2,b,ci);
and1 u4(n3,a,ci);
or1 u5(co,n1,n2,n3);
endmodule
Input-B
0
1
0
1
Output-S
0
1
1
0
Output-C
0
0
0
1
Half Substractor
The half substractor truth table and schematic (fig-2) is mentioned below. The boolean expressions
are:
D= A (EXOR) B
Br=A'.B
Input-A
0
0
1
1
Input-B
0
1
0
1
Output-D
0
1
1
0
Output-Br
0
1
0
0
Full Substractor
The full substractor truth table and schematic (fig-3) is mentioned below. The boolean expressions
are:
D= A (EXOR) B (EXOR) C
Br=A'.B + B.Cin + A'.Cin
Input-A
0
0
0
0
1
1
1
1
Input-B
0
0
1
1
0
0
1
1
Input-Cin
0
1
0
1
0
1
0
1
Output-D
0
1
1
0
1
0
0
1
Output-Br
0
1
1
1
0
0
0
1