WEBVTT

00:00.760 --> 00:01.600
Hello everyone.

00:01.880 --> 00:07.000
Welcome back to another session in our course on computer organization and low level computing.

00:07.240 --> 00:12.400
Now in this lecture, we are diving deep into two of the most powerful and widely used logic gates in

00:12.400 --> 00:18.840
digital electronics, which is Nand, Nand, and Nor gates.

00:19.240 --> 00:24.120
Now, by the end of this lecture, you will not only know what these gates are, but also why they matter

00:24.120 --> 00:25.040
so much.

00:25.240 --> 00:33.440
So much, in fact, that you can build any other logic gate using just Nand, these Nans or just N or

00:34.200 --> 00:34.880
Nors.

00:35.240 --> 00:38.600
Now that's why they are called the Universal Gates.

00:38.640 --> 00:42.080
Now this lecture is designed to be detailed and beginner friendly.

00:42.080 --> 00:47.720
I will explain every symbol, operation, and logic step along the way.

00:48.840 --> 00:51.920
Now what are logic gates?

00:51.960 --> 00:58.760
Logic gates are tiny electronic components that perform basic logical functions, just like you do in

00:58.760 --> 01:00.880
a math or when making decisions.

01:00.880 --> 01:08.640
Let's say if it is raining then and no.

01:08.640 --> 01:12.800
Yeah, if it is raining and I am tired.

01:17.840 --> 01:20.880
Then do not go out.

01:23.760 --> 01:28.320
So that's basically a logic gate.

01:28.680 --> 01:39.440
Now each gate takes one or more input, which is uh represented as zeros or ones, which is off or on

01:39.640 --> 01:42.040
and produces a single output.

01:42.080 --> 01:48.240
It is either zero and one if not going out counts as zero.

01:48.280 --> 01:50.120
Yeah, we can count as zero as well.

01:51.480 --> 01:52.160
And yeah.

01:52.520 --> 01:59.480
And most logic gates are built using electronic switches called Transistors.

02:04.800 --> 02:06.760
And here's the thing about them.

02:06.920 --> 02:12.880
In many cases, transistors flip the logic of a signal.

02:13.320 --> 02:22.120
So this means when you input a one, you might get zero as an output.

02:22.560 --> 02:31.120
And when you input a zero, you might get a one instead.

02:32.160 --> 02:39.920
Now this inversion behavior is the foundation for gates like Nand and Nor.

02:40.120 --> 02:42.640
And we will see exactly how that works next.

02:47.560 --> 02:51.480
So what is a Nand gate or Nand gate.

02:52.440 --> 02:58.040
Now let's break the break down the name first here because it will make so much sense.

02:58.910 --> 03:08.870
So none here basically means not plus and that is as simple as it gets.

03:09.510 --> 03:16.310
It means take the output of an and gate and then flip it using a not gate.

03:17.470 --> 03:26.070
So let's recap the and gate because we have learned that learned the and and or gates and the other

03:26.070 --> 03:27.630
gates in previous lectures.

03:28.150 --> 03:30.670
So what how the Nand gate worked.

03:30.710 --> 03:34.550
Remember we have A and B input.

03:35.830 --> 03:37.430
We give it to.

03:41.110 --> 03:43.670
A b.

03:43.710 --> 03:46.430
And now this is and operator you see.

03:53.990 --> 03:56.310
So let's start the equations.

03:56.510 --> 03:58.470
So zero zero.

03:58.510 --> 04:00.110
If A is zero, P is zero.

04:00.390 --> 04:01.670
We will get zero.

04:01.950 --> 04:06.270
If A is zero, B is one, we will get zero.

04:06.630 --> 04:10.150
If A is one, B is zero, we will get zero.

04:10.150 --> 04:14.830
And if A is one and B is one, we will get one.

04:23.710 --> 04:28.150
Now this symbol you see here is the and symbol.

04:28.950 --> 04:34.430
Uh, like in math it is um also called a the logical conjunction.

04:34.950 --> 04:37.190
So now let's add a not gate.

04:37.550 --> 04:41.110
Remember a not gate simply flips the result.

04:41.110 --> 04:43.830
If the result is one it becomes zero.

04:43.870 --> 04:45.990
If it was zero, it becomes one.

04:46.190 --> 04:53.510
So when you combine and and z naught you get an A and D.

04:53.830 --> 05:02.790
So Nand gate outputs zero if both inputs are one and one, in all other cases, just the opposite of

05:02.830 --> 05:04.070
and right.

05:04.470 --> 05:08.510
So let's actually write this Nand here.

05:09.470 --> 05:17.070
So this A and B this is so easy right.

05:17.550 --> 05:19.470
So here is a symbol.

05:19.670 --> 05:26.750
This this is a small curved line means not or logical negation.

05:27.150 --> 05:29.550
So this is what not.

05:30.030 --> 05:33.870
And this is basically and right this is and.

05:36.990 --> 05:46.030
And you can also see this written as this ternary operator and this symbol in some books or just Nand

05:47.710 --> 05:48.950
and equation here.

05:54.110 --> 05:56.910
So Remember.

05:59.430 --> 06:02.510
We had what now?

06:02.750 --> 06:07.910
Since it is zero here, we will get one, one, one and zero.

06:08.150 --> 06:08.790
That's it.

06:10.110 --> 06:14.390
Uh, so we get zero if both inputs are one.

06:16.910 --> 06:20.470
We get one in all other cases.

06:34.190 --> 06:43.710
So a Nand gate looks like a regular Nand gate, which is flat packed D shape, but with a small circle

06:43.710 --> 06:44.590
at the output.

06:45.030 --> 06:53.070
So that little circle means here basically, or, uh, inversion or not.

06:55.670 --> 06:56.150
So.

06:58.670 --> 07:01.070
What about this nor gate here?

07:01.230 --> 07:04.110
So this is also very interesting.

07:04.150 --> 07:05.190
Interesting here.

07:05.630 --> 07:16.270
Now just like Nand is not plus and and nor gate as you know is just not or not or.

07:16.990 --> 07:18.510
So not plus or.

07:25.150 --> 07:29.190
So let's write our note or diagram.

07:31.830 --> 07:34.350
Or instead we can do like this.

07:35.030 --> 07:38.910
We have what a and b.

07:41.270 --> 07:49.470
But this is and as you remember from as you learned from this previous lecture, this is what or.

07:52.430 --> 07:55.260
So in or here we have zero and zero.

07:55.300 --> 07:56.020
We get what?

07:56.900 --> 07:57.540
Zero?

07:58.220 --> 07:59.540
We have zero and one.

07:59.540 --> 08:00.420
We get one.

08:01.140 --> 08:02.540
We have one and zero.

08:02.540 --> 08:07.500
Since we have ones here, we got one, one and one.

08:07.540 --> 08:10.620
Of course here we can get one here.

08:12.060 --> 08:15.620
So this symbol is the or symbol.

08:16.380 --> 08:20.380
In mathematics this is called the logical disjunction.

08:21.180 --> 08:25.140
Now as before we flip the output using a Not gate.

08:25.700 --> 08:36.900
So a Nor gate outputs one only if both inputs are zero and zero in all other cases.

08:37.820 --> 08:41.460
So how do we write the Nor gate?

08:42.500 --> 08:44.100
Again note.

08:47.060 --> 08:48.180
Small curved line.

08:51.260 --> 08:51.780
And.

08:54.060 --> 08:54.420
A.

09:00.180 --> 09:01.340
Or B.

09:01.620 --> 09:02.220
That's it.

09:03.020 --> 09:13.740
So what we will get here one if the both inputs are zero and zero in all other cases.

09:15.940 --> 09:22.140
And again the Nor symbol is just a regulator or gate symbol with a small circle at the output.

09:25.660 --> 09:34.460
Let's also write the symbols of Nand and Nor gates in circuits.

09:35.580 --> 09:36.020
So.

09:38.140 --> 09:40.060
Nor gate basically written like this.

09:40.620 --> 09:45.660
Same as or but small circle here.

09:47.820 --> 09:48.140
Oops.

09:48.180 --> 09:49.140
This was the end.

09:49.660 --> 09:50.060
Yeah.

09:51.420 --> 09:59.100
Nor Nand gate here and small circle at the top.

10:01.980 --> 10:09.660
And let's also write the Nor gate curved opposite C line and.

10:13.460 --> 10:16.180
Circle at the nose.

10:18.620 --> 10:27.700
And here where things get even cooler now there's a pair of logic identities called De Morgan's laws.

10:27.900 --> 10:29.980
And one of them says that.

10:32.340 --> 10:47.220
Note A and b equals note A or so, or symbol note A or not B.

10:48.700 --> 10:50.580
So you can read a lot this.

10:51.620 --> 10:59.580
Not A and B is the same as not A or not B.

11:00.340 --> 11:08.940
This tells us that you can redraw a Nand gate using an Or gate with inverted inputs.

11:09.900 --> 11:12.660
So let's look at it step by step.

11:15.180 --> 11:18.660
We will draw a new diagram here.

11:20.940 --> 11:24.860
This a b not a not b.

11:25.580 --> 11:34.460
Not not a or not b and not a.

11:37.820 --> 11:39.700
Not a and not b.

11:39.740 --> 11:40.140
Yeah.

11:41.100 --> 11:44.620
Here we will have a and b.

11:45.380 --> 11:51.140
So a is going to be equal to 0001.

11:51.140 --> 11:57.740
111011.

11:58.420 --> 12:01.060
So let's get calculating.

12:02.300 --> 12:06.100
So here we will have.

12:08.700 --> 12:21.060
Node A node a node b node a and not b.

12:22.940 --> 12:23.860
And also.

12:26.340 --> 12:29.740
Now note let's first write node a.

12:32.020 --> 12:36.780
Or not b not p.

12:37.340 --> 12:38.820
And here not.

12:41.420 --> 12:44.740
A and b.

12:45.420 --> 12:47.300
Yeah that's basically it.

12:49.420 --> 12:54.730
So here Uh, not a is going to be one again.

12:54.930 --> 13:06.570
One not A00 and not B is going to be one zero.

13:08.690 --> 13:14.330
One zero not A.

13:16.890 --> 13:31.730
Or not B will equal to not a not b one, one, one and zero.

13:35.810 --> 13:36.770
Not a.

13:40.410 --> 13:42.170
Or b.

13:45.090 --> 13:49.370
111 and zero.

13:49.970 --> 13:51.610
Now look at that.

13:51.650 --> 13:52.090
Here.

13:52.730 --> 13:54.010
These are the same.

13:55.530 --> 13:56.490
These are the same.

13:56.690 --> 13:57.610
The Morgan's law.

13:57.730 --> 13:58.170
So.

13:58.330 --> 13:59.050
And look at that.

13:59.050 --> 14:04.370
The output matches the Nand and the truth table perfectly.

14:05.770 --> 14:06.010
And.

14:06.050 --> 14:14.170
Yeah, uh, what you should remember from this lecture is Nand is basically not and nor is basically

14:14.170 --> 14:21.010
not or, and small circles in logic diagrams, uh, like this means inversion.

14:22.290 --> 14:23.330
Uh note here.

14:23.650 --> 14:29.250
And the Morgan's law allows us to write Nand and Nor in alternative forms.

14:29.690 --> 14:36.170
Nand and Nor gates are universal gates, meaning you can build any other gate using just Nand and Nor.

14:36.370 --> 14:43.450
And next up in this course, we will prove this universally by building not and, or and XOR gates using

14:43.450 --> 14:45.490
only Nans or only Nors.

14:45.850 --> 14:46.970
Now, thank you for watching.

14:47.010 --> 14:49.690
And I'm Typhoon and I'm meeting you in next lecture.
