Exclusive-OR and Exclusive-NOR gates
To study the uses of the Exclusive-OR and Exclusive NOR gates, especially in equality detector and parity generator circuits
The Exclusive-OR (XOR) and Exclusive-NOR (XNOR) are very useful gates often used in equality detectors and parity generator circuits.
The Exclusive-OR and Exclusive-NOR gates
- Write the Boolean expressions and truth tables for the Exclusive-OR and Exclusive-NOR gates. Compare their truth tables. What are the relationships between AxorB and AxnorB?
- Test one of the EX-OR gates by connecting its two inputs to switches and its output to an LED. Verify that the gate operates as indicated by the truth table.
- Construct an EX-NOR circuit and verify that it operates as indicated by its truth table.
- Construct the following circuits.
Figure 2 - Three-Input XOR and XNOR Gates
- An EX-NOR or equivalent circuit can also be called a one-bit comparator since:
AxnorB = 1 If A = BImplement an EX-NOR function using AND, NOT and OR gates.
AxnorB = 0 If A ≠ B
Implement an EX-OR function using:
- AND, NOT and NOR gates;
- AND, NOT and OR gates;
Figure 1 - Exclusive-OR and Exclusive-NOR Gates
The Equality Detector:
There are many applications in a computer where it is necessary to compare the value of two numbers and determine if they are equal. The comparator considered above will indicate if two bits are equal. To determine if two complete binary numbers are equal, corresponding bits of the binary numbers can be compared using a comparator circuit. The output from a number of comparator circuits can be brought into an AND function to determine if the two numbers as a whole are equal. Design a circuit that will determine if two 4-bit binary numbers are equal. Designate one 4-bit number as A and the other as B. Construct the circuit on your board and verify its operation by setting one number for A and trying B for all 16 possible states. Note the condition of the switches of B which will cause the output to be 1. Repeat this procedure for two or three different settings of A. Demonstrate your circuit to your instructor.
Parity Bit Generator:
There are a number of ways to check that a binary number transmitted from one device to another is accurate. One way is to count the number of 1's in a binary number and, if there are an odd number of 1's, add another bit (called a parity bit) equal to 1 to the end of the number. If the sum of the number of 1's in a binary number is even, a parity bit equal to 0 is added to the end of the number.
If a number and its parity bit are checked at any later time there should always be an even number of 1's in the composite number. This number is said to have even parity. Data transmitted over a long distance often has a parity bit added so that the receiving computer can check the accuracy of the number before accepting it.
- Construct the parity bit generator in Figure 3, connecting the inputs to the switches and the parity bit output to an indicator lamp. Connect the output of the four switches to indicator lamps as well to give an indication of the binary number being read into the circuit. Test the circuit and write its truth table. Show it to your instructor.
Figure 3 – Parity Bit Generator
- Explain how successive Exclusive-OR circuits can detect that an odd number of 1's is present in a number and then generate a 1 parity bit.
- The circuit shown in Figure 3 is used in the transmission end of a communication line. The four bits plus the parity bit are sent through the line. It is possible that there is a fault in the line and a bit may be changed, hence it is necessary to check the data at the receiving end. Design a circuit that would accomplish this. This is called an odd error detection circuit.