CS302 - Lab Manual - Week No
CS302 - Lab Manual - Week No
CS302 - Lab Manual - Week No
Background
The XOR gate (sometimes EOR gate, or EXOR gate) is a digital logic gate that implements an exclusive or;
that is, a true output (1) results if one, and only one, of the inputs to the gate is true (1). If both inputs are
false (0) or both are true (1), a false output (0) results. Next is the circuit representation of the XOR gate and
its truth table.
A B F1
0 0 0
0 1 1
1 0 1
1 1 0
Next is one way to build an XOR gate using NAND gates only
The XOR logic gate can be used as a one-bit adder (or a Half-Adder; HA)that adds any two bits together to
output one bit (the sum) and another bit that represents the carry out. As shown below
The XOR logic gate can be used as a one-bit full adder that adds any three bits together to output one bit (the
sum) and another bit that represents the carry out. As shown below
Inputs Outputs
A B Cin Cout S
0 0 0 0 0
1 0 0 0 1
0 1 0 0 1
1 1 0 1 0
0 0 1 0 1
1 0 1 1 0
0 1 1 1 0
1 1 1 1
Lab Tasks
Task 1: XOR built from basic gates
Draw using EWB the following circuits then fill their truth tables:
A B F1
0 0
0 1
1 0
1 1
What do you notice?
Each one of the above circuits can be replaced with one single logic gate that gives the same truth table,
that’s the Exclusive OR Gate or XOR.
A B F No. of 1's
0 0 0 Even
0 1 1 Odd
1 0 1 Odd
1 1 0 Even
A B F
0 0
0 1
1 0
1 1
The above circuit can be replaced with one single logic gate that gives the same truth table, that’s the
Exclusive NOR Gate or XNOR.
A B F No. of 1's
0 0 1 Odd
0 1 0 Even
1 0 0 Even
1 1 1 Odd
A B C A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
(a) Find out the Boolean functions S and C, and write them in the corresponding blanks.
(b) Draw using EWB the HA circuit then find its truth table by using the logic converter.
S=
C=
P Q S C
0 0
0 1
1 0
1 1
P Q S C
0 0
0 1
1 0
1 1