[CS61C FA20] Lecture 16.1 - Combinational Logic: Truth Tables — Transcript
Full transcript
- 0:00and welcome back now we're at our third
- 0:02series
- 0:03of this sds series four lecture series
- 0:05where we talked about
- 0:06combination logic so far we've seen
- 0:08introduction to synchronous digital
- 0:10systems
- 0:11state registers how those work timing
- 0:13that's a really important piece of it
- 0:14now we're part of
- 0:15now we're kind of at the don't worry
- 0:17about the analog element of it let's
- 0:18just talk about the logic part of it
- 0:20this is a little bit more fun a little
- 0:21bit more digital
- 0:22and thinking about the analog real you
- 0:24know the realities of the analog world
- 0:26are not as much
- 0:26as not as present here in the
- 0:27combinational logic world so let's talk
- 0:29about combinational logic and jump on it
- 0:31we start with truth tables and maybe
- 0:33you've seen truth tables before
- 0:34maybe you haven't um in terms of that's
- 0:38funny i learned truth tables
- 0:39how to do them i think i was in
- 0:43fifth grade we were doing basic truth
- 0:44tables i think i saw them again in
- 0:46eighth and ninth grade
- 0:47this is just me i went to my school
- 0:48different places across the world from
- 0:50from here
- 0:50but hopefully you've seen this before if
- 0:52not i'll try to go slowly with this
- 0:54here's a box here's a truth tables are
- 0:57on combinational logic if you remember
- 0:58from a lecture or two ago
- 1:00combinational logic circuits are those
- 1:01that have no state and no memory
- 1:03in some set of inputs the output will
- 1:05always be the same if i go back and
- 1:07put them back again it'll still be the
- 1:09same there's no memory to these things
- 1:10this is just pure combinational logic
- 1:12pure functions if you will in the 621a
- 1:14and cs10 sense
- 1:15so this is a four input one output box
- 1:18um i've got a y here on the right
- 1:21you're going to see these this is kind
- 1:24of how we typically draw this and back
- 1:26in the days when you're doing truth
- 1:27tables you might have drawn t
- 1:28and f's stop doing that you want to use
- 1:30zeros and ones and in fact
- 1:32as you're counting them you want to
- 1:34basically count up from
- 1:36like a nibble his four bits count them
- 1:38up zero all zeroes to all ones you don't
- 1:40want to put like i've seen people draw
- 1:42these
- 1:42where they write t and f's first or t
- 1:44nets look too close together
- 1:45and also they write all t's first no the
- 1:47first row should be all zeros always
- 1:49and the last row should be all ones
- 1:51however many however many bits you have
- 1:52okay
- 1:54so this is a box i can buy this box at
- 1:57fry's electronics
- 1:58and this is whatever that box does for
- 2:01all zeros what does that box do for all
- 2:02zeros and a one
- 2:04so what's actually interesting about
- 2:05this i'm going to ask you a question
- 2:07how many of these boxes does fry's have
- 2:09to sell
- 2:10that's a fun question think about how
- 2:12many different
- 2:13of these boxes that's a stock i mean if
- 2:16they have to have one each
- 2:17for all the different ones that have a
- 2:19different pattern here
- 2:21i'll give you example the and gate which
- 2:23is true only when all of them are ones
- 2:25has a one down here and all a big old
- 2:28zero for everybody else
- 2:29that's one of the boxes they said they
- 2:31have an and okay
- 2:33so how many other devices do they have
- 2:35to sell if they want to cover
- 2:36every single possible case i give you
- 2:39think about it
- 2:40and i'll give you an answer in a second
- 2:43and welcome back here's how here's how
- 2:46many
- 2:47it's kind of cool turn your head
- 2:49sideways so you're looking at this
- 2:51number with your
- 2:52left side here and your right side there
- 2:55how many different bits do you have
- 2:56there i count 16. two to the four is 16.
- 3:00each possible bit pattern is a different
- 3:04box
- 3:05how many different bits is that we call
- 3:07that the signature of the box
- 3:09how many bit patterns are there with 16
- 3:10bits 2 to the 16.
- 3:13that's 64 000. so you have to have
- 3:1764 kibi
- 3:20this is mean 64k different f boxes if
- 3:24you're going to have this
- 3:25for every one if you have if fry's is
- 3:27going to stock every possible
- 3:28combination is that kind of cool
- 3:3064 000 ish that's a lot
- 3:33okay so that's pretty cool what do you
- 3:36think about that
- 3:37here's another two-table example this is
- 3:39going to be one
- 3:41if one but not both of a and b are one
- 3:44by the way
- 3:44i love this i love this example this
- 3:47example if i said
- 3:48um halloween is coming up where the fall
- 3:51here so halloween is coming up
- 3:52if a kid comes to your door and they say
- 3:55trick or treat
- 3:57they mean this table this table is for
- 4:00trick-or-treat this is a halloween table
- 4:02why it says trick or treat
- 4:06trick or treat but not both
- 4:09here's here's trick or treat
- 4:13but not both okay so
- 4:17they mean it's a one if one or the other
- 4:19is true but not both
- 4:20what it means in halloween if you know
- 4:22if you give the person a treat you
- 4:23expect them not to toilet paper your
- 4:25house
- 4:25it's the idea is it's a contract right
- 4:27if i give you the treat you're not going
- 4:29to do a trick on me
- 4:30so this it means this table this is the
- 4:32halloween table so remember
- 4:34see this link always remember this table
- 4:36as the halloween table is an example of
- 4:37that pretty cool right
- 4:39by the way i want to show you another
- 4:41way to think about this table no one
- 4:43this is rarely taught it's like pro tip
- 4:46if you think about it when a is 0
- 4:49how does b relate to the output
- 4:52is exactly the same when a is one
- 4:56how does b relate to the output it flips
- 4:59it
- 5:00it's like not b so in fact i can
- 5:03summarize this table by saying
- 5:04this is a two element two row table when
- 5:07a is zero
- 5:08output is y is just b what output is one
- 5:11output of y is
- 5:12not b it's a kind of tighter way of
- 5:14thinking about the table i want you to
- 5:15get used to that and comfortable with
- 5:16that
- 5:16if i change this to any pattern of four
- 5:18things by the way how many
- 5:20i get to that how many of these would
- 5:22fry's have to have for every one of
- 5:24those
- 5:24i should be able to kind of reduce this
- 5:26into this kind of table when a is zero
- 5:28what is it when a is one what is it okay
- 5:31so
- 5:31that's kind of neat by the way if these
- 5:33were both zero i would have written a
- 5:34zero here
- 5:35these are both one i would have written
- 5:37a one here if it's zero one i write b
- 5:39here if it's one zero i write not b so
- 5:41that's how you kind of compress this
- 5:42table to that way
- 5:43kind of neat right all right
- 5:47here's an example for the truth table of
- 5:48a two bit adder
- 5:50okay we've seen this before we used
- 5:51adders before in our last series of
- 5:53lectures
- 5:53this again is a two bit adder where the
- 5:55output now i was saying before while the
- 5:57two matter without overflow
- 5:59because sometimes you put some numbers
- 6:00in and it's bigger than that right n and
- 6:02n
- 6:02and output saying well somehow we don't
- 6:03worry about that at this early stage
- 6:05whether it's overflow
- 6:06but in fact if i had two bit adder i
- 6:08mean you can think about this
- 6:10the biggest number of this guy can be
- 6:11one one that's three the biggest number
- 6:13this guy can be is one one three plus
- 6:14three is six
- 6:15that's one one zero i kind of knew that
- 6:17because i'm doubling this
- 6:19and you double it you just add a zero
- 6:21there so there's no way to think about
- 6:22binary numbers in that way so i have to
- 6:23have three can be able to handle all the
- 6:25cases
- 6:26c is really is the fun thing c is really
- 6:29should be three bits
- 6:30and by the way i've been shocked before
- 6:32this slash tells you
- 6:34how many bits wide that line is if you
- 6:36haven't talked about it before that's
- 6:37the way to think about this
- 6:39so this is a two bit adder this is all
- 6:41the logic of a two bit adder
- 6:43again i think of the grouping of a
- 6:44really being a one and a zero
- 6:46here's b really meaning b1 and b0 and
- 6:49here's c being c2 through c0
- 6:52so let's ask a question how many rows
- 6:55does this have
- 6:57well just like before the number of
- 7:00inputs
- 7:00is four bits of inputs therefore that's
- 7:03a nibble input
- 7:04therefore i have to handle all the cases
- 7:06of 16 different cases for that
- 7:08okay well that's nice i can do that if
- 7:11you need me to build that i could
- 7:12probably
- 7:13build that that's not that's not a
- 7:14problem except that when i extend that
- 7:16to 32 bits
- 7:18and now i've got two 32-bit inputs and i
- 7:21have and this is an unsigned adder we
- 7:22have to worry about anything other than
- 7:2410 values and i've got this guy maybe
- 7:26this is 30 you know maybe this is 32
- 7:28and this sorry 32 and 32 and this might
- 7:32be 33 again
- 7:33what's the biggest output here the
- 7:35biggest output is there this better be
- 7:3733 bits
- 7:37because i've got all ones with a zero
- 7:39because i've doubled all ones all ones
- 7:41are zero
- 7:42okay well you might ask the question
- 7:45again
- 7:46how many rows do i have anybody figure
- 7:49that out
- 7:50was that the right way to do this is the
- 7:52right way to build a 32-bit adder by
- 7:53looking at the truth table for it that's
- 7:55i'm kind of
- 7:55revealing that revealed that that might
- 7:57not be the right way to do it well how
- 7:58wide is this
- 7:59that's an input 32 bits that's simple 32
- 8:01bits well before it was the total number
- 8:03of bits is my input that's how many rows
- 8:05i have two to that
- 8:07i i counted the 64.
- 8:10that's a lot at 16 eggs be rows
- 8:15too many rows way too many rows
- 8:18so this is not the way to do this so
- 8:20let's let's actually take a step back
- 8:22at some point we'll talk about how to do
- 8:23that another way i'll give another
- 8:25example
- 8:26here is a three input majority circuit
- 8:29i say majority it's almost like three
- 8:31people are all deciding should we
- 8:32should we go that way or that way that's
- 8:34all one two three one two three
- 8:36shoot and the majority wins so for all
- 8:38zeros let's do it let's see
- 8:40let's see if this actually adheres to
- 8:41that they're all zeros
- 8:43majority wins zero if there's two zeros
- 8:46and a one
- 8:46zero wins again two zeros and a one zero
- 8:49wins
- 8:50two zeros and a one zero wins every
- 8:53other case there's more ones than zeros
- 8:55two ones two ones two ones three ones
- 8:59and then one wins okay
- 9:00we call this the majority circuit that's
- 9:02kind of neat this is like breaking a tie
- 9:04you know picking a tie for that
- 9:05so that's kind of fun so that's the i
- 9:09gave you a couple of examples of truth
- 9:10table
- 9:11and uh that's the basics of this
- 9:14sometimes we don't use the truth table
- 9:15to build
- 9:16circuits like for the adder we might
- 9:17have to find a better way to do that
- 9:18we'll actually talk about that
- 9:19later but this is the way to think about
- 9:21this you want to be writing zeros to
- 9:23ones
- 9:23you want to be counting from all zeros
- 9:25to all ones in a way don't use t's and
- 9:27f's
- 9:27and that's it thank you so much we'll
- 9:29see you at the next lecture
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 16.1 - Combinational Logic: Truth Tables by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 2,005 words across 310 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.