
After going through some basics in the previous episode, today we will look at a couple of more gates and, with that excuse, we will see how to use truth tables and some simple Boolean algebra to design a logic circuit.
The XOR Gate
Let’s begin by talking about the XOR gate.

Here is its truth table, which describes how this gate works:

You can see how whenever the two inputs are different, the output is a 1, and it is a 0 when the inputs are different.
We could say that this kind of gate tells us if a number of digital signals are all the same or are different.
The XOR port is available in integrated circuits that contain a number of them, like this one in the picture. And from the picture you can also read the full name of the gate: the Exclusive OR. Another way to say that the circuit provides at its output an OR operation, but exclusively if the inputs are different. Like they say, if one or the other is at 1, but not both.

Let’s see now how we can draw the schematic of such circuit starting from the truth table. There are two methods to use. The first one is to look at all the rows that have a 1 at the output. We will look at the other method in a later episode.
So, here are the two rows that have ones on the output:

Let’s look now at the corresponding inputs. For each of these two rows, we write the name of the input as is, if it is represented by a 1, and as a NOT input if it is represented by a 0.
For the first of the two rows, we therefore write

And yes, we consider this as an AND operation, so we write down the two inputs as if they were multiplied by each other.
Now we are going to add to this expression the one for the other row that has an output of 1. Keep in mind that when we say “add” in boolean algebra, we intend the OR operation.
Following the same rule we used for the first raw, we then write:

The result of this whole operation is our output U:

We have now a Boolean expression that can be easily translated to a schematic, if we just keep in mind what each of the symbols represents.

And this is the schematic of the XOR gate, made with 2 AND gates, 2 NOT gates, and 1 OR gate.
We can quickly double check if this circuit works really as described by the truth table.
Consider first the rows with an output of 1. In them, A and B are opposite. And now look at the circuit. Because in each AND we get both A and the opposite of B, we can be sure that we are inputting two identical values, either both zeros or both ones, on each of the two ports. And while we are inputting both 0s on one port, the other port gets both 1s, and vice-versa. The result is that one AND gate will have an output of 1 and the other will have an output of 0. And since these outputs go to the OR gate, the output of the OR gate will be 1 in both cases.
If we look now at the rows of the truth table where the output is 0, you’ll see that the inputs are either both at 1 or both at 0. Back to the schematic, if A and B are both 1 or both zero, each of the AND gates will have at their input a 1 and a 0, because of the presence of the NOTs. Therefore, the two AND gates will both have, simultaneously, an output of 0. And since these are the inputs of the OR, the output of the OR will be 0 in both cases.
The XNOR Gate
Let’s now work on the XNOR gate.
Here is it’s truth table:

since this is a NOT XOR, the outputs are exactly the inverse of the XOR gate.
As such, when we refer to the symbol for the XNOR gate, we just draw the one for the XOR gate and then we put a NOT at its output.

Like with the XOR gates, we have ICs that can provide multiple XNOR gates, like this one in the picture, which provides 4 gates with 2 inputs each:

Let’s now repeat the previous exercise to draw the schematic for this gate. These are the rows that present a 1 at their output.

For the first row, since both A and B are at zero, we have to write NOT A and NOT B. Then we write the OR symbol, and then we add the part relative to the second row with an output of 1. In this case, both the inputs are at 1, and so we simply write down the names of the inputs. This boolean expression now represents the truth table for the XNOR, so we put it equal to U.

And here is the corresponding schematic:

We can verify that this circuit satisfies the truth table, by noticing that while one of the two AND gates takes A and B, the other one takes NOT A and NOT B. As a result, only if A and B are exactly the same, one of the two AND gates will output a 1. Otherwise, if A and B are different, the AND gates will always have a 0 and a 1 as inputs, which will cause them to output a 0. And so, in the case A and B are the same, the OR gate will receive a 0 and a 1 at the inputs, therefore giving an output of 1. Instead, in the case where A and B are different, the OR gate will receive 0 on both inputs, therefore giving a 0.
Conclusion
Whenever you have a truth table that describes a certain logic function, is always possible to write the Boolean expression equivalent to the truth table, and from that, we can finally draw the schematic for such function.
Note also that if we have a truth table with more than 2 inputs, we can still go through the exact same procedure, just keep in mind that we will need gates with more than 2 inputs.
And finally, I would also like to remind you that this series of tutorials is also backed by a corresponding video series available on YouTube. The following page provides the links to the YouTube Videos, as well as the link for the whole series, and the links to all the files involved in the tutorials, with schematics and anything else that might be needed: