Hello everyone.
Welcome back to another session in our course on computer organization and low level computing.
Now in this lecture, we are diving deep into two of the most powerful and widely used logic gates in
digital electronics, which is Nand, Nand, and Nor gates.
Now, by the end of this lecture, you will not only know what these gates are, but also why they matter
so much.
So much, in fact, that you can build any other logic gate using just Nand, these Nans or just N or
Nors.
Now that's why they are called the Universal Gates.
Now this lecture is designed to be detailed and beginner friendly.
I will explain every symbol, operation, and logic step along the way.
Now what are logic gates?
Logic gates are tiny electronic components that perform basic logical functions, just like you do in
a math or when making decisions.
Let's say if it is raining then and no.
Yeah, if it is raining and I am tired.
Then do not go out.
So that's basically a logic gate.
Now each gate takes one or more input, which is uh represented as zeros or ones, which is off or on
and produces a single output.
It is either zero and one if not going out counts as zero.
Yeah, we can count as zero as well.
And yeah.
And most logic gates are built using electronic switches called Transistors.
And here's the thing about them.
In many cases, transistors flip the logic of a signal.
So this means when you input a one, you might get zero as an output.
And when you input a zero, you might get a one instead.
Now this inversion behavior is the foundation for gates like Nand and Nor.
And we will see exactly how that works next.
So what is a Nand gate or Nand gate.
Now let's break the break down the name first here because it will make so much sense.
So none here basically means not plus and that is as simple as it gets.
It means take the output of an and gate and then flip it using a not gate.
So let's recap the and gate because we have learned that learned the and and or gates and the other
gates in previous lectures.
So what how the Nand gate worked.
Remember we have A and B input.
We give it to.
A b.
And now this is and operator you see.
So let's start the equations.
So zero zero.
If A is zero, P is zero.
We will get zero.
If A is zero, B is one, we will get zero.
If A is one, B is zero, we will get zero.
And if A is one and B is one, we will get one.
Now this symbol you see here is the and symbol.
Uh, like in math it is um also called a the logical conjunction.
So now let's add a not gate.
Remember a not gate simply flips the result.
If the result is one it becomes zero.
If it was zero, it becomes one.
So when you combine and and z naught you get an A and D.
So Nand gate outputs zero if both inputs are one and one, in all other cases, just the opposite of
and right.
So let's actually write this Nand here.
So this A and B this is so easy right.
So here is a symbol.
This this is a small curved line means not or logical negation.
So this is what not.
And this is basically and right this is and.
And you can also see this written as this ternary operator and this symbol in some books or just Nand
and equation here.
So Remember.
We had what now?
Since it is zero here, we will get one, one, one and zero.
That's it.
Uh, so we get zero if both inputs are one.
We get one in all other cases.
So a Nand gate looks like a regular Nand gate, which is flat packed D shape, but with a small circle
at the output.
So that little circle means here basically, or, uh, inversion or not.
So.
What about this nor gate here?
So this is also very interesting.
Interesting here.
Now just like Nand is not plus and and nor gate as you know is just not or not or.
So not plus or.
So let's write our note or diagram.
Or instead we can do like this.
We have what a and b.
But this is and as you remember from as you learned from this previous lecture, this is what or.
So in or here we have zero and zero.
We get what?
Zero?
We have zero and one.
We get one.
We have one and zero.
Since we have ones here, we got one, one and one.
Of course here we can get one here.
So this symbol is the or symbol.
In mathematics this is called the logical disjunction.
Now as before we flip the output using a Not gate.
So a Nor gate outputs one only if both inputs are zero and zero in all other cases.
So how do we write the Nor gate?
Again note.
Small curved line.
And.
A.
Or B.
That's it.
So what we will get here one if the both inputs are zero and zero in all other cases.
And again the Nor symbol is just a regulator or gate symbol with a small circle at the output.
Let's also write the symbols of Nand and Nor gates in circuits.
So.
Nor gate basically written like this.
Same as or but small circle here.
Oops.
This was the end.
Yeah.
Nor Nand gate here and small circle at the top.
And let's also write the Nor gate curved opposite C line and.
Circle at the nose.
And here where things get even cooler now there's a pair of logic identities called De Morgan's laws.
And one of them says that.
Note A and b equals note A or so, or symbol note A or not B.
So you can read a lot this.
Not A and B is the same as not A or not B.
This tells us that you can redraw a Nand gate using an Or gate with inverted inputs.
So let's look at it step by step.
We will draw a new diagram here.
This a b not a not b.
Not not a or not b and not a.
Not a and not b.
Yeah.
Here we will have a and b.
So a is going to be equal to 0001.
111011.
So let's get calculating.
So here we will have.
Node A node a node b node a and not b.
And also.
Now note let's first write node a.
Or not b not p.
And here not.
A and b.
Yeah that's basically it.
So here Uh, not a is going to be one again.
One not A00 and not B is going to be one zero.
One zero not A.
Or not B will equal to not a not b one, one, one and zero.
Not a.
Or b.
111 and zero.
Now look at that.
Here.
These are the same.
The Morgan's law.
So.
And look at that.
The output matches the Nand and the truth table perfectly.
And.
Yeah, uh, what you should remember from this lecture is Nand is basically not and nor is basically
not or, and small circles in logic diagrams, uh, like this means inversion.
Uh note here.
And the Morgan's law allows us to write Nand and Nor in alternative forms.
Nand and Nor gates are universal gates, meaning you can build any other gate using just Nand and Nor.
And next up in this course, we will prove this universally by building not and, or and XOR gates using
only Nans or only Nors.
Now, thank you for watching.
And I'm Typhoon and I'm meeting you in next lecture.