2.6. XOR and XNOR

The XOR logic gate requires the inputs to be different, for the output to be 1. For multiple inputs, however, the gate needs to be viewed differently. If we have an odd number of inputs that is 1, the gate will result in output 1.

Figure 2‑16 XOR truth table and expression

According to the following figure, it can be concluded that XOR can be realized using 6 transistors. If we look in more detail, we will notice that transistors Q1 and Q2 make an OR gate, transistors Q3 and Q4 a NAND gate, and transistors Q5 and Q6 an AND gate. If A input is 1 and B input is 0, then the result of the OR circuit is 1 which leads to saturation of the Q5 transistor. At the same time, the result of the NAND circuit 1, which leads to saturation of Q6 transistor and output is 1. Analogously follows the output in a situation when A input is 0 and B input is 1. If both A and B inputs are 0, the result of the OR circuit is 0 so the output is 0 because Q5 is cut-off. If both A and B inputs are 1, the result of the NAND circuit is 0 so the output is 0 because Q6 cuts off.

Figure 2‑17 Transistor realization of XOR gate

From the explanation above, it is clear how complex it is to implement an XOR gate using transistors. We can imagine how complex it would be to build a Pong machine with only discrete components like transistors. Fortunately, we can approach the problem by applying our paradigm. We can use the TTL chips of the gates we already built and simplify the process. As already mentioned, the XOR gate can be very easily realized with NAND, OR and AND gates according to the following figure.

Figure 2‑18 Logic gates realization of NOR gate
(Source: referenced)

But before we start with the realization, it is important to explain one more detail. Inputs A and B will be controlled by pushbuttons in such a way that pressing the pushbutton will allow a high voltage as an input value, as we have done with transistors. It is interesting to note that TTL chips have pull-up resistors at their inputs that ensure that the inputs are high, even when disconnected. What does that mean? The concept of pull-up resistors is very simple, and consists of connecting the input to a high voltage source through a resistor, according to the figure below. By pressing the button, the input will be grounded, so it is evident that there must be a resistor, to prevent a direct connection of voltage and ground or short circuit.

Figure 2‑19 Pull-up resistor
(Source: referenced)

The concept of pull-down resistors is identical to pull-ups if we replace the voltage source and ground. It assures us that the input is at low voltage until we set it to a high voltage by pressing the pushbutton. When we come to think of it, a pull-down resistor is just what we need, because we have to neutralize pull-up resistors at TTL inputs.

Let us, therefore, apply these concepts to our case, in which we will use a pushbutton to connect the inputs of the circuit to high voltage. At the moment when the button is not pressed, the value sent to the input of the TTL chip is not defined, so due to the pull-up resistor at its input, the chip will interpret this value as high. We need to prevent this, so we will ground the inputs of the circuit with pull-down resistors. This ensures that when the pushbutton is not pressed, we send a low voltage value to the chip input. When we press the button, one part of the voltage will be grounded across the resistor and the other part of the voltage will represent the high input to our chip.

References:

http://sullystationtechnologies.com/npnxorgate.html

https://commons.wikimedia.org/wiki/File:Pullup_Resistor_Diagram.png

Design a site like this with WordPress.com
Get started