Let's begin our discussion with binary numbers. Now when you hear the word by, what do you think of? By is associated with the number 2. And so binary numbers have only two possibilities. 0 or 1. Now when dealing with circuits, 0 is, or it corresponds to a circuit being in the off state.
1 corresponds to a circuit being... and the on state. So if you're dealing with true and false statements, an off state will be considered false, and on state would be considered true.
If you're dealing with voltage, an off state would have zero volts, and an on state typically five volts, but something other than zero. Now before we go over and, or, and not gates, let's talk about the buffer gate. So here is the symbol of the buffer gate, and it basically looks like a triangle pointing towards the right.
On the left, we have the input. On the right, we have the output. So we're going to call the input A.
The output will also be the same. So if we were to make a truth table with the input and the output, if the input is on, which means it has a binary number of 1, the output will also be in the on state. If the input is in the off state, which means it has a binary of 0, the output will have the same binary number of 0 as well.
Now let's draw a circuit to represent this. And the principal element of this circuit will be an NPN transistor. This is the base, this is the collector, and this is the emitter. Now we're going to connect this to a power source and we're also going to use a light emitting diode. Now the light emitting diode, it's going to represent the output of the circuit.
Now let's connect this to a voltage source. So here is the input, which we'll call it input A. And what's going to happen? if we apply a voltage to point A.
So if the input is in an on state, will the LED will be on or off? Well once you apply a voltage to the base, the transistor will turn on. Current will flow from the collector to the emitter.
Therefore the LED will be in an on state. So this corresponds to a 1 for the input and the output. Now what about if the input is off?
So in this case we have a 0 at the input. If there's no voltage at the base then the transistor will be off. No current will be able to flow from the collector to the emitter.
So therefore the LED will be off as well. And so that's basically the buffer logic gate. So if you have a 1 in the input, you're going to have a 1 in the output.
If you have a 0 in the input, you have a 0 in the output. Now the next type of logic gate that we're going to talk about is the NOT gate. So here is the electrical symbol for it.
It looks like a buffer gate, but it has like a circle in the front. Now let's call the input A. The output will be the complementary of a.
You can also write it as a bar. Now let's write a truth table. So we're going to have the input and the output. So if we have a 0 at the input, the output will be a 1. And if we have a 1 at the input, the output will be 0. It's always going to be the opposite. So basically, if the input is in an off state, the output will be in an on state and vice versa.
Now how can we represent this using a transistor circuit? The circuit is going to be very similar to what we drew before, but there's going to be one key difference and that is the location of the LED. So here is our voltage source.
And on the left we have our input A. The emitter is attached to the ground, but the LED will be connected across the collector of the transistor and the emitter. So once again, this will be our output.
So let's say if the circuit... or rather input A is in the on state. Will the LED be in the on state or the off state?
Well, let's analyze it. So once we apply a voltage to the base of the transistor, current will be able to flow from the collector to the emitter. So current will flow from the positive 5 volts through the resistor. Now, once it gets to this point, it has two options. The current can flow to the right or it can flow to the left.
Now, electricity will usually, well, rather not usually, but will always take the path of least resistance. And if the transistor is on, then the path of least resistance is from the collector to the emitter. So therefore, no current will flow in this direction.
So this will be in the off state because the current has been diverted through the transistor. So notice that we have a complementary situation. The input is on but the output is off.
Likewise the reverse is true. So let's say that the input is off. There's no voltage applied at input A. So what's going to happen? Current will still flow to the resistor.
Now once it reaches this point, because the transistor is off, it cannot flow through the transistor. So therefore, it has no choice but to flow through the LED. So therefore, the LED is in an on state. So as we can see here, if we have a 0 at A, the output will be a 1. And if we have a 1 at A, the output is a 0. And so that's the basic function of a NOT gate.
It turns an off state into an on state and vice versa. It turns A into A'. Now the next logic gate that we're going to talk about is the AND gate.
And here is the symbol for an AND gate. We're going to have two inputs, A and B, and the output will be A times B. Now let's write a truth table.
And at the same time, let's draw a circuit for this. So we're going to need two transistors as opposed to one. So this is input A and this is input B. And let's connect it to a voltage source. So what happens if input A and B...
are in an off state. Will the LED be on or off? In this case both transistors will be off.
So no current can flow from the positive 5 voltage source to the ground. So therefore the output will be a zero because the LED is off. Now what if A is in an on state and B is in an off state? Will the LED be on or off? Current can flow through the resistor, through the LED, and through the first transistor.
However, because the second transistor is off, no current can flow through it. So therefore, no current will flow through the LED. So the LED will be in an off state.
So we're going to put a 0. The only way the LED can be on... is if both inputs A and B are on. Only under that circumstance can current flow through the LED and through both transistors to make it to the ground. So thus we have the word AND. The only way the output can be in an on state is if both inputs A and B are on the on state.
So even if B is on and A is off, no current will flow through the LED, only if A and B are on. Now let's move on to the OR circuit, and let's begin by drawing the symbol for that. So here's how it looks like.
So let's say this is input A and B. Now it's not going to be A times B as in the case of an AND circuit, but it's A plus B for the OR logic gate. Now let's make a table just like before, and let's draw a circuit that corresponds to it.
So this time what we're going to have is two NPN transistors, but they're going to be connected parallel to each other to make the OR logic gate. In the case of an AND logic gate, they were connected in series with each other. And so that's the key difference between the AND and the OR logic gate. Now let's say that transistor A and B are in the off state.
Will the LED be on or off? So clearly, no current can flow through the first transistor or through the second transistor. So therefore, no current will flow through the LED.
The LED will be off. So we can put a zero in the truth table. Now what about if the first transistor is on, but the second one is off?
What's going to happen? Current can flow through the resistor, through the LED, but through the transistor that is on. So therefore, there's a path from the positive voltage source to the ground. So the LED will be on. So let's put on 1. Now what if transistor B is on, but transistor A is off?
Current can still flow, but this time through transistor B. So the LED will be on. Now what if both transistors are on?
In this case, the LED will definitely be on. Current can flow. through transistor A or through transistor B. So thus we have the OR logic gate.
The LED will be on if A OR B is on. And so that helps me to remember the truth table for the OR logic gate. If we have a one in A OR B, doesn't matter which one, the output will be on. Now I want to talk about the NAND gate, but let's compare it with the AND gate. The NAND gate is basically the complement of the AND gate.
So here is the symbol for the AND gate. The NAND gate symbol looks very similar. The only difference is we're going to have a circle at the end.
So let's say this is input A and this is input B. The output of an AND gate, we said it's A times B. For an AND gate, it's going to be the complement of A times B. Now remember, the complement of a 0 is 1, and the complement of 1 is 0. Now let's look at the truth tables for these two types of gates.
So as we recall, the only way to get a 1 with an AND gate is if both inputs A and B have a 1. Besides that, it will be a 0. In the case of an AND gate, when both inputs A and B are on, the output will be off. So as you can see, this row... I mean this column rather is the complement of this column. Now we could use an AND gate and a NOT gate to construct a NAND gate.
So here is the AND gate and let's put a NOT gate next to it. So let's say this is input A, input B. The output of an AND gate is AB. And once you use a NOT gate, it basically takes the input and gives you the complement of that. So the complement of AB is just AB'.
And so the combination of these two logic gates will produce, or is equivalent to, a NAND gate. Now here's a question for you. Let's say if we have...
a NAND gate. And let's say if we take the two inputs of a NAND gate and connect them together. What type of logic gate do we now have? What would you say?
So let's compare it to the original NAND gate. So this would be A and B, and we would get A times B, but the complement of that result. Well now we only have one input because both of these will be A.
And so if we multiply these two, it would be a times a, and then we'll get the complement of that. What is a times a? Now you need to be familiar with some rules of Boolean algebra, and we're going to go over those rules soon.
But a times a is basically a. One way to help you see this is if you multiply 0 and 0, you get 0. If you multiply 1 and 1, you get one. Now keep in mind we're dealing with binary numbers and so in a binary system this is it works out to be true.
A times A is A. So this is the same as the complement of A. So notice that we went from A to A prime. This is the equivalent of a NOT gate. So that's how you could use a NAND gate.
to make a NOT gate. So these two are functionally equivalent. Now, let's understand how this works using a truth table. So let's write the truth table of a NAND gate.
Now, Once we connect the two inputs together, let's say once we make this circuit, here we have this circuit by the way, these two columns have to be the same. So therefore, these two possibilities... Cannot work. Because let's say if this is A, this has to be A as well. So meaning, let's say if we have a 1, we can't have a 1 and a 0. That's not possible.
It's either, if this is going to be a 1, both of these inputs will be a 1. Or, if we have a 0 here, both inputs will be a 0. So these are the only two possibilities. So if we have a the output is a 1. And if we have a 1, the output is a 0. And so that's the, this is the same table of a NOT gate. Now let's talk about the OR and the NOR gate.
The NOR gate is the complement of the OR gate, much in the same way as the NAND gate is the complement of the AND gate. And so let's draw the symbols. for both of these.
The NOR gate looks like the OR gate but with a circle at the end. So given inputs A and B, the output of the OR gate we said it's A plus B. For the NOR gate, it's going to be A plus B and then it's the complement of that result.
Now let's write out the truth tables. The OR gate The output of an OR gate will be in the ON state if either A or B is in the ON state. Now, in the case of the NOR gate, it's simply the reverse. If either A or B is in the ON state, the output will be in the OFF state.
Now, one of the first things that you need to be able to do if you're taking a course in Intro to Logic Design is that you need to be able to write a function given a block diagram. So let's start with the first one in the upper left corner. The first thing I like to do is identify what type of logic gates I'm dealing with. So this is an AND gate. I'm going to use a capital A to represent it.
Now, for the... Over here, notice that the inputs of the first AND gate are A and B. And when dealing with an AND gate, you need to associate it with multiplication.
And when dealing with an OR gate, associate it with addition. So what the AND gate is going to do is it's going to take the two inputs and basically multiply them together. So the output will be... a times b. Now the second AND gate will take this input, which is a, b, and multiply it by this input, which is c.
So thus we could say that the output of this entire circuit, represented by function f, is going to be the product of a, b, and c. So this is the answer for the first one. Now what about the second one? in the upper right corner.
Feel free to pause the video if you want to try it yourself. So let's begin by identifying each logic gate in the circuit. So we have two AND gates and here we have an OR gate. So the output of an AND gate is going to be basically the product of the inputs. So this is just going to be x times y and here the inputs are x and y prime.
So this is going to be x, y prime. Now the OR gate is going to take the two inputs and then it's going to add them together. So the output of the OR gate will give us the function x, y plus the other input x, y prime.
And so we can say that function f is equal to x, y plus x, y prime. So that's how we can write the function using or given a block diagram. Now let's consider the third one on the bottom left.
So this is an AND gate, and so is this one, and here we have an OR gate. So when dealing with an OR gate, we're going to take the two inputs and add them together. So this is going to be A plus B. And for the AND gate, we're going to take the two inputs and multiply them together. So this is A times B'.
Now, here we have another AND gate, so we're going to take these two inputs, multiply them together. So, we may need to use a set of parentheses. So, the function is going to be A plus B, so that's this input, times A B prime. You can put that in parentheses if you want to, but you really don't need to.
Now, let's focus on the last one. We have one AND gate and two OR gates. So for the first OR gate, we're going to take the two inputs and add them together.
So this is going to be x plus y. And for the second one, we're going to do the same thing. So this is going to be x prime plus z.
Now for the AND gate, we're going to take these inputs and then multiply them together. So in parentheses, we have the first one, x plus y, and then times the second one, x prime plus z. So f is equal to what we have here. Now, here is a challenge problem. Go ahead and write the function given the block diagram shown below.
Feel free to take a minute and work on this one. So let's identify the logic gates that we have. So here we have an AND gate.
an OR gate, another AND gate, and then we also have an OR gate at the right. Now let's focus on the first AND gate. We're going to take the inputs X and Y, and we're going to multiply them.
Now for the OR gate, we are going to add XY with the other input Z. So this will be XY plus Z. Now for this AND gate, we are going to multiply. these two together. So it's going to be x prime times x, y, plus z.
Now let's talk about the AND gate at the bottom. This is a three input AND gate, and the output of that AND gate is simply going to be the product of the three inputs. And so that's going to be x times y prime times z.
Now the last thing we need to deal with is the OR gate. And this is a three input OR gate. And all we need to do is add the three inputs together.
So anytime you're dealing with an OR gate, think of addition. When you're dealing with an AND gate, think of multiplication. So we could say the function f, the output of it, is going to be the first input, which is x prime times xy plus c.
plus the second input which is W plus the last input which is x, y prime, z. So this will give us the output of this circuit diagram using the inputs that we have here. So that's how you can write a function given a block diagram.
Now let's work on the reverse. Let's say if we're given a function, how can we draw the block diagram? Let's say the function is a, b, plus c.
Go ahead and draw the block diagram for that given function. So first, notice that a and b are multiplied to each other. So we're going to deal with an and gate. And notice that we have an addition symbol.
So we're going to use an OR gate between A, B, and C. So let's begin. Let's start with the AND gate.
So here are the two inputs, A and B, and then the output of that will be just A, B. Now we need to connect that with an OR gate, and then we need a new input, input C. So the OR gate will take the sum of these two inputs, and so we'll get the output AB plus C. And so that's it for that example.
Here's another function. Let's say we have F is equal to XY plus X prime Y plus Y prime Z. So go ahead and draw a block diagram for that given function. So notice that here we have what is called a product term.
So we're going to use a AND function for this product term. Here, this is another product term. So we're going to use another AND function to connect X prime with Y. And we need another one to connect Y prime with Z. So we need three AND logic gates.
Now, we could use one OR gate to basically add to three. and logic gates together. Because we have the plus symbol or a sum, we need to use an OR gate.
So this is going to be the first AND gate, and we're going to put X and Y together, and so that will give us the output XY. And then we're going to use another AND gate, and we're going to have this. the inputs x prime y and then another one so this is going to be y prime and then z now we're going to feed these three and gates into an or gate And so the output of the OR gate is going to be the sum of the three inputs. And so that's how we can draw a block diagram for this expression. Now, something else that you need to know.
This expression here. is something known as an SOP expression, which stands for sum of products. xy is a product, as mentioned before.
x'y is a product, and y'z is a product. So we have three product terms, and we're adding them. So that's a sum of products expression. Now another term you need to be familiar with is literals. So every variable that you see, whether complemented or uncomplemented, is a literal.
So x is a literal. y is a literal. x prime is 1. So we have a total of 6 literals in this expression. Now let's consider another example. So let's say that f is going to be a plus b prime and then times a plus b plus c times b prime plus c prime.
Go ahead and draw a block diagram. Now the last example was a sum of products example. This one is known as a POS which is product of sums.
This right here is a single sum term. The reason why it's a sum term is because you're adding A and B prime. So notice that we have a total of three sum terms, and we're multiplying each of those three sum terms together.
So thus, it is a product of sums expression. Now, how many literals do we have in this problem? So we have 1, 2, 3, 4, 5, 6, 7. So there's a total of seven literals in that expression. Now let's go ahead and draw the block diagram. Now, for a sum term, should we use an AND logic gate or an OR logic gate?
What would you say? Now remember, you want to associate OR. with addition or sums and you want to associate and with multiplication or basically products so because we have a sum term we're going to use an or logic gate for each one so we're going to need three or gates and we're going to feed these three or gates into a single and gate because we do have multiplication here.
So let's go ahead and draw the diagram. So let's start with our first or gate. This is going to be a two input or gate based on what we see here. So the first input is going to be A, the second one is going to be B prime, and the output of this or gate will be A plus B prime. Now moving on to the second OR gate, it's going to be a three input OR gate.
The inputs will be A, B, and C. The output is going to be A plus B plus C. And for the last OR gate, this is a two input OR gate with the inputs B prime and C prime.
So this is going to be B prime plus C prime. Now let's feed these three OR gates into a single AND gate. So the output of this AND gate is going to be the sum, I mean not the sum, but the product of these three expressions.
And so you just got to multiply them. This is going to be everything that we see here. So I'm not going to write it again. And so this is the block diagram for the function f.
Now let's work on number 3. Describe each of the following expressions as an SOP expression, sum of products, or POS expression, product of sums, both or neither. And at the same time, discuss the number of variables, literals, product terms, and sum terms. and identify any min or max terms. So let's start with this one.
Let's say we have the expression x y prime plus x y z prime plus x prime y z w plus x y prime z prime. So is this a sum of products expression or a product of some expressions? or is it both or neither? So this is a product term.
Each one of these are product terms. Now just to review, one literal could be a product term. So x is a product term, y prime is a product term, or if you multiply them, these are product terms.
So what we have here is a sum of products expression. We have four product terms and as we can see there's a plus sign separating them. So it's a sum of products expression. Now how many different variables do we have in this expression? Notice that we have x, y, z, and let's not forget w.
So we have a total of four different variables. Now how many literals do we have? So here we have two literals. It could be complemented or uncomplemented.
Here we have three literals. This has four, and then this is three. So if we add them together, there's a total of 12 literals in this expression. Now, what about if we have a min term or a max term? What would you say?
In this case, since we're dealing with an SOP expression, a sum of product expression, we need to identify the standard product terms, or the min terms. Now, a midterm is basically a standard product term that includes each variable of the problem. So, it has to include all four variables, either complemented or uncomplemented.
So, this term right here is... the min term in this expression because it has all four variables now let's move on to our next example consider this expression x plus y times x prime plus z and then times y plus z prime times x plus y plus z prime. So is this a sum of products expression or a product of sums expression?
So x plus y, this is a sum term. x prime plus z is also a sum term. So notice that we have a total of four sum terms and each of them are multiplied to each other. So this is going to be a product of sums expression.
We have the product of four sum terms. Now how many variables do we have in this expression? So I see three variables x, y, and z. Now how many literals are there in this expression? So here we have two literals in the first sum term.
The second sum term has two literals, the third one has two, and the last sum term has three literals. So thus we have a total of nine literals in this problem. Now we're not going to have any min terms because this is not a sum of product expressions. But we do have a max term because this is a product of sums expression. So what is the max term in this particular problem?
So which sum term includes each variable? of the problem, either complemented or uncomplemented. So this is the sum term that has all the variables.
So therefore, this is considered the max term. Now let's move on to our next example. Let's say we have the expression xy'zw. So this expression, is it an SOP expression, a POS expression, both or neither? What would you say?
It turns out that this is both a sum of products expression and you could describe it as a product of sums expression. So in terms of, let's say, SOP, we could say that this is the sum of one product term. Now, in the case of a POS expression, you can also describe it as the product of four sum terms.
Now, if that statement confuses you, see it this way. X, you can think of X as X plus 0. Y prime, you can see it as Y prime plus 0. And then Z plus 0 and W plus 0. Now, in this form... It looks more like a product of four-sum terms. At least that's one way I think of it.
But that particular expression can be described as both a SOP and a POS expression. Now, how many variables do we have? And how many literals?
So for this expression... We have a total of four variables, w, x, y, and z. We also have four literals, w, x, y', and z. So that's all we could say about this expression.
Let's move on to our next example. Consider the expression a plus b plus c'plus d plus e'. So can we describe this as an SOP or POS expression? Like the other example, you could represent it as both POS and SOP. So as an SOP expression, we can say that this represents the sum of five product terms.
And as a POS expression, we could say that this represents the product of one sum term. So imagine if we put it inside a single set of parentheses. In this case, this would appear as one sum term. Now it's important to understand that If you have just one literal, let's say it's either x or y prime, one literal can be considered a product term or a sum term. So just keep that in mind.
Now for this particular example, we have a total of five literals. A, B, C prime, D, and E prime. We also have five variables, A, B, C, D, and E. And so that's it for that expression. So make sure that you understand the difference between a product term, a sum term.
and a literal. So a product term could be just a single variable, x, it could be y prime, or it could be multiple literals multiplied to each other, like x, y prime, or x, y, z. So those are product terms. A sum term can be an individual literal.
It could be x, it could be z prime. Or it could be a sum of multiple literals like x plus y or even x plus y prime plus z. So those are sum terms. And a literal is just a variable.
It could be x, y prime. It could be complemented or uncomplemented. So that's a literal.
Now let's consider one more expression. Let's say we have A multiplied to B plus C D prime. What type of expression do we have?
So here we have a single term, like a literal, and this is a product term. And it looks like just a mixture of SOP and POS. It turns out that this expression is neither. It's neither a sum of products or a product of sums expression.
Now this expression has four variables. As we can see it's A, B, C, and D and it has four literals. If we list them, it's A, B, C, and D'.
And that's all we can say about this expression. So this is an example of an expression that is neither SOP or POS. Now let's say if C wasn't there.
What type of expression will we have now? Would you still say it's neither? Because this is now a sum term.
When you have C here, this is no longer a sum term. But when you take away C, now we have a sum term. And A is considered a sum term.
You can write that as A plus 0. So that's a sum term. And then B plus D prime. That's another sum term. So this is the product of two sum terms. So this would be...
a POS expression. But once you put C into the mix, this is no longer a sum term, nor is it a product term. So this would be neither. Now let's review some basic rules of Boolean algebra. Now whenever you see a plus sign, Know that you're dealing with the OR logic gate.
And if you see like multiplication or a product term, remember you're dealing with the AND logic gate. So the first law that we're going to go over is the commutative property. A plus B is the same as B plus A.
And A times B is the same as B times A. The next one is the associative property. So A plus B plus C is the same as A plus B plus C. And A times BC is the same as AB times C.
So that's the associative property. And as you can see, the order for the AND and OR operators doesn't matter. The next one is the identity rule. a plus 0 is equal to a and a times 1 is also equal to a.
The next one is the null property. a plus 1 is equal to 1 and a times 1 I mean a times 0 rather is equal to 0. Now if you're analyzing this using old school algebra this equation might make sense to you but this one might be a little confusing. For instance if a is 0, 0 plus 1 equals 1. Okay that makes sense.
But what if a is 1? 1 plus 1, does it really equal 1? Well, in old school algebra, 1 plus 1 is 2. But when dealing with Boolean algebra, 1 plus 1 does equal 1. And let's prove that using logic gates. So here we're dealing with the OR logic gate. So let's draw that.
now we're going to have two inputs a and b but be we're going to say is always equal to 1 now the output will be a plus b now let's make a truth table now remember the output will be a one if Either input A or input B is in the on state. So A could be 1 or 0. B is always 1. So this is B. So if A and B are both in the on state, then this logic gate will be on. So we're going to give it a value of 1. Here, B is on. A is off.
So if one of the inputs is on for the OR gate, the output will be on. So in this case, if A and B are in the on state, we can see that the output is 1. Here, if B is on, A is off, the output is still 1. But this is the one that we're working with. So 1 plus 1 does equal 1 when dealing with logic gates.
This means that if A is on and B is on, then the output a plus b will be on as well. And that's the way you have to think about it when dealing with these types of Boolean algebra expressions. Now the next rule that we're going to talk about is the complements. A plus a prime is going to be 1. And a times a prime will always be 0. So this is the complement property.
Now, using numbers, if you have a 0 and a 1, let's say if A is 0, A prime has to be 1. This is going to be 1. So when dealing with the OR logic gate, if one of the inputs is in the OFF state and the other is in the ON state, the output will be ON. So that's what 0 plus 1 equals 1 means. Now, for this one, we're dealing with the AND gate.
So, let's draw that circuit. So, let's say if, we'll call this A and A'. So, if A is on, that means the other one, A', will be off. Now, when dealing with the AND logic gate, The only way the output will be on is if both inputs A and B, or in this case A and A prime, are both on.
Because keyword and. Well, this will never happen. Because if A is on, A prime will automatically be off.
So the two inputs will never be on at the same time. So no matter what, this is always in the off state. So we're going to have a binary number of 0. Therefore, whenever you use an AND logic gate with the A and A'inputs, the output will always be 0. It will always be off.