[CS61C FA20] Lecture 16.2 - Combinational Logic: Logic Gates — Transcript
Full transcript
- 0:00and welcome back we're still in the
- 0:02lecture series on combinational logic
- 0:04let's talk about
- 0:05logic gates so here are basic three
- 0:09logic gates that we're going to use as
- 0:10building blocks for larger circuits
- 0:13the first you've seen before probably
- 0:15you're releasing the truth table for it
- 0:17and this truth table says it's an and
- 0:19gate it's an and gate
- 0:20this is the truth table for and by the
- 0:22way remember you're always going to draw
- 0:24this
- 0:24as the counting from however many bits
- 0:26of input just from all zeros to all ones
- 0:28so make sure you do that when you do
- 0:29throw these
- 0:30and and if that's the case you're always
- 0:32going to see and have this signature
- 0:34zero zero zero one or in general for
- 0:36even inputs all zeros and only one one
- 0:38at the end which is
- 0:39all of them have to be true this is the
- 0:41block diagram we use for that
- 0:43so as we look at this we'll say it and
- 0:45and that has a
- 0:46it's like a half circle in a way so
- 0:48here's a straight line with the half
- 0:49circle there for my and
- 0:51or is similar to the logical or you
- 0:54probably have you've seen this before in
- 0:55a lot you've done this in cs 10 or
- 0:57b you've done this bitwise does not bid
- 0:59wise this is a
- 1:00single bit this is this would be this
- 1:02would be double and okay that's my and
- 1:04this is or we're talking about a single
- 1:06bit we're talking about not
- 1:07bitwise all right or says i'm a one
- 1:11if and only if uh
- 1:14at least one of them are a one so this
- 1:16is all of them this is
- 1:17any of them okay this is the any block
- 1:19any of them any of these guys is a one
- 1:22then i'm a one here okay
- 1:25link and the shape looks like this kind
- 1:28of a curve here and then a curve there
- 1:30and then a curve there and then be
- 1:31really pretty
- 1:33a not gate is drawn like a triangle with
- 1:35a circle at the end of it and that
- 1:36basically does the invert
- 1:38of that okay the inverse if it's a if a
- 1:41is high then its output is low a is low
- 1:43output is high so that's the block for
- 1:44this
- 1:46now when i'm thinking about an versus or
- 1:48those two shapes are brand new and
- 1:49you're going to forget them
- 1:50so here's again ann's truth table here's
- 1:52the and's gate symbol
- 1:54how do we remember them i want to give
- 1:56you a way to never forget that so turn
- 1:58your memory on high resolution
- 2:00to never forget this
- 2:02[Music]
- 2:03isn't that cool a and d has the shape d
- 2:07and nobody taught this i don't know i
- 2:08came up with this i know when you taught
- 2:10this to me but i'm not sure if i ever
- 2:11came up with this but this is a way to
- 2:12a mnemonic for you this d looks exactly
- 2:15like the shape
- 2:16if you use the right font of the gate
- 2:18symbol so please remember that from now
- 2:20on never get and or
- 2:21confused because or has nothing
- 2:23equivalent but and has this d
- 2:25that looks exactly like the and symbol
- 2:27again back to the logic gates
- 2:29we talked about before or i should have
- 2:32mentioned
- 2:33that that should be called inclusive or
- 2:35because inclusive or means you're one of
- 2:37the other or both
- 2:38exclusive or says one or the other
- 2:42but not both okay so exclusive or is
- 2:45special
- 2:46and says if they're by the way from now
- 2:48on i would like
- 2:49every halloween people to say trick x or
- 2:52treat
- 2:53cause this is what they meant they meant
- 2:55exor so from now on tell all your
- 2:57friends and kids and
- 2:58cousins and brothers and sisters to say
- 3:00trick x or treat
- 3:01because i don't want anybody because
- 3:02really it's not trick or treat if i give
- 3:04you a treat i don't want a trick
- 3:05that's the idea that's the contract i'm
- 3:07getting
- 3:08nand is almost identical to and except
- 3:10it's this little bubble at the end says
- 3:12invert the output so and would have had
- 3:14a 0 0 0
- 3:151 here i say you know the bubble means
- 3:17invert all of those
- 3:19and exactly the same as nor nor is 0 1 1
- 3:221
- 3:22and i invert all of those guys to give
- 3:24me my
- 3:25nor value by the way this is exactly the
- 3:28same as saying a
- 3:29and b here pass through an or
- 3:33passed into a not gate so basically
- 3:37whenever you see this bubble
- 3:38this bubble really means i took this
- 3:40picture and shrunk it down
- 3:42just to its essence just to the circle
- 3:44at the end and you can do this to the
- 3:45input too i could also have
- 3:46if i had an if i had a not gate here on
- 3:48the input it was not getting the input
- 3:50i would have drawn a circle here on the
- 3:52input so you can convert these not gates
- 3:54and push them into the both touching the
- 3:55bigger blocks either at the input or the
- 3:57outputs
- 3:58output side and you can know that we'll
- 3:59see that a little later but that's the
- 4:00idea of
- 4:01that circle now let's think about if you
- 4:04have logic gates
- 4:05extending them to n dimensions to n
- 4:07dimensions and inputs
- 4:09um most of them make sense if i have an
- 4:11and if i have a
- 4:12tan input and it means you're a one only
- 4:14if all ten are one if you have a ten
- 4:16input or if it's a one if
- 4:17any of the ten inputs is is one that's
- 4:20the same thing
- 4:21xor is the only one that isn't so clear
- 4:23what happens just to make sure you
- 4:25understand what an
- 4:25input xor does what really xor is doing
- 4:27is counting the number of
- 4:29ones and when the number ones is odd
- 4:32it's a one
- 4:32let's go through it here we go let's
- 4:34count number of ones
- 4:36zero one one two
- 4:39one two two three which of these are odd
- 4:43numbers
- 4:43i'm gonna circle all the odd numbers oh
- 4:45look it's working
- 4:48it's working palm olive it works look at
- 4:50that okay
- 4:51so every time you have an odd number of
- 4:54ones on
- 4:55all your input input lines on an xor
- 4:57your output is a high
- 4:58high high high otherwise you have an
- 5:01even number
- 5:02two zero and two here and it's a zero
- 5:03and this works for n inputs so think of
- 5:05xor with n inputs as doing that counting
- 5:07the number of ones
- 5:08and really saying are the number ones
- 5:10odd odd yes that's what it's doing okay
- 5:13good now here is a truth table for our
- 5:17majority circuit
- 5:18and by the way i mentioned before when i
- 5:20have two lines that aren't crossing i i
- 5:22like to do this
- 5:23okay and that says they're not the same
- 5:24but even if i did this
- 5:26if i don't draw a circle here the circle
- 5:29means they are connected they are really
- 5:30the same line they are touching
- 5:32if i do this even though i prefer and
- 5:34the best way to draw it like this
- 5:36if you see this you should be able to
- 5:38live with it to say well it doesn't have
- 5:39a big circle so therefore they're not
- 5:41connected therefore i'm drawing like
- 5:42this because it's
- 5:43too many lines to draw this thing
- 5:44underneath but i'm going to say that
- 5:45they are not connected
- 5:47so this is connected connected and these
- 5:49are not connected okay
- 5:52so here's a picture and if you see let
- 5:55me actually
- 5:55bold here see look at this guy that's a
- 5:57big one that's a connection
- 6:00that's a connection the rest of them are
- 6:01not connected so even though they're
- 6:02crossing they're not connected make sure
- 6:03you know that
- 6:04all right what is this doing i can go
- 6:06from truth table to gates
- 6:08well let's see how this works let's see
- 6:09if this is true i haven't shown you kind
- 6:10of
- 6:11pedantically how to do it step by step
- 6:13but let's see if this actually is
- 6:14consistent with what
- 6:15this is right so i claim this this is
- 6:18these are i claim these are one in the
- 6:19same let's see let's test it
- 6:21well this first guy is saying a
- 6:24and b if it is b and that line and
- 6:27here's an
- 6:28a in that line so it's saying
- 6:31this is an or of a and b so the output
- 6:34is an or so let's try
- 6:35so when is a and b true only here that's
- 6:38a and b
- 6:39well it's one the output is a one
- 6:43or meaning ors is true if any of them
- 6:44are one so it's true if that's true
- 6:46or b and c so now let's do that let's go
- 6:50to b and c now
- 6:51when does b and c go high well here and
- 6:54here
- 6:55yep it's a one there it's or
- 6:59or when a and c and
- 7:02by the way these it doesn't matter
- 7:04whether a and c are here or here this
- 7:05commutative operation
- 7:06and a and c is the same as c and a
- 7:09useful
- 7:10so here's a and c when are they high
- 7:14here and here right there's my a
- 7:17and c and a and c and it's high there so
- 7:20this actually works
- 7:21this is really cool this simple circuit
- 7:25covers my majority so that's kind of
- 7:27neat i can see i can now think about how
- 7:28to go from truth table to gates
- 7:30that's kind of fun we even saw this
- 7:33before
- 7:33this was our remember what this was i
- 7:36just showed you a sec a lecture ago
- 7:38this is my truth table for my three
- 7:40input
- 7:41it's going to go high when i have three
- 7:43ones in a row right i'm trying to be
- 7:44kind of a three one detector that will
- 7:47go high for every three ones i get and
- 7:49then it'll reset itself
- 7:50and wait for the next three ones in a
- 7:51row so if i get four it goes low again
- 7:53until i get six
- 7:54it goes high again well take a look
- 7:58here's my output line what's my output
- 8:00line is only look my output line is only
- 8:02one
- 8:03i only have three bits when let's think
- 8:05about this
- 8:06when p by the way here's his ps line
- 8:09this is important to talk about this now
- 8:11it's really nice
- 8:13if i have a single letter for each of as
- 8:16i'm talking about
- 8:18boolean algebra which i'll talk about a
- 8:20little bit later it's really nice when i
- 8:21have only a single letter for each input
- 8:23but sometimes i have
- 8:24multiple letters in like a word here's
- 8:27ps is to an acronym previous state
- 8:29but i also have a word input it's a
- 8:31little bit harder
- 8:32to then write the boolean out lot the
- 8:34boolean algebra form for that
- 8:36so for now you don't have to worry about
- 8:37it because they're just lines here but
- 8:39this ps is a grouping there's ps
- 8:43sub one which is that set of bits
- 8:46here's this guy is p s sub one
- 8:50and they can imagine that this is p s
- 8:53sub zero so this this circuit to
- 8:55determine the output
- 8:56only has three inputs p s of one p s of
- 8:59zero and input
- 9:00okay so this output is true
- 9:04only in the single case now if i only
- 9:07have single case
- 9:08what is that case what's the case where
- 9:11this guy's a one
- 9:12this guy's a zero and this guy's a one
- 9:14let's do it
- 9:16ps is a one this is a zero but
- 9:19i inverted it becomes a one look at that
- 9:21bloop
- 9:22and input so you can see a way to map
- 9:25a connection from a single row and how
- 9:28to make
- 9:29that row always true you make it an and
- 9:31it's true only in an and of case let's
- 9:33say i had 20 inputs
- 9:34when this is high i just write the term
- 9:38if it's ever low i invert the term see
- 9:41that i put invert the term
- 9:43so this is i can read this this is high
- 9:46remember
- 9:46here's an example of me pushing my not
- 9:48gate up to that little bubble there okay
- 9:50up to
- 9:51there's my bubble there okay so it's
- 9:53only high
- 9:54when ps1
- 9:58and and not
- 10:02ps0
- 10:04input this output is high only with a
- 10:06single gate this single gate which is
- 10:08really kind of two gates it's an and
- 10:09a three input and and a knot in the
- 10:12front of it
- 10:13i can cover this that's kind of cool so
- 10:15we've kind of shown
- 10:16i haven't really shown you again step by
- 10:18step how to do this but we've kind of
- 10:18shown how we can think about a truth
- 10:20table
- 10:20being mapped to gates and thinking of
- 10:22this as again
- 10:24one-to-one equivalent to this it's
- 10:26really very beautiful in that way
- 10:27kind of neat all right we'll learn more
- 10:29about this in the next lecture see you
- 10:30there
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 16.2 - Combinational Logic: Logic Gates by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 2,190 words across 334 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.