[CS61C FA20] Lecture 17.2 - Combinational Logic Blocks: ALU — Transcript
Full transcript
- 0:00and welcome back now let's teach you how
- 0:02to build an
- 0:03arithmetic logic unit out of the pieces
- 0:05you know about already
- 0:06that's really cool so an aramaic
- 0:09arithmetic and logic unit is going to be
- 0:11a block a combinational logic block a
- 0:13high level block it's not built of small
- 0:14ands and ores it's i mean it has the
- 0:16nords inside but the idea is it's this
- 0:17big block
- 0:18that we're going to use to do the work
- 0:20of our computation
- 0:21when you have a mips when you have a
- 0:24mips if you have a risk five instruction
- 0:26that says add
- 0:27of something in something you know add i
- 0:29don't know uh
- 0:30t2 t1 t0 it says take t1 and t0 add them
- 0:34together
- 0:34and put them in t2 or and
- 0:38t2 t1 t0 means and t1 and t0 and put
- 0:41them into t2
- 0:42well who does that work in the data path
- 0:46it's going to be an
- 0:47alu an arithmetic and logic unit we're
- 0:49teaching you how to build that
- 0:51we're going to build a simple one for
- 0:52now but the idea is you could just
- 0:53extend that to build one that can handle
- 0:55every operation
- 0:56a shift left a shift right all those
- 0:58things amazing
- 0:59so we're going to show this with a very
- 1:01simple set of operations just
- 1:02add subtract and an or and we're going
- 1:05to have a single signal line on the side
- 1:07that has two bits to determine it's not
- 1:10the signal line it's not the mux
- 1:12anymore this alu is this beautiful shape
- 1:14and this signal line tells me
- 1:16which of these operations we're going to
- 1:18do and i'm writing these in kind of c
- 1:20terms are you adding subtracting
- 1:22are you bitwise ending or you're bitwise
- 1:24ordering depending on what the signal
- 1:26line says that's a controller for that
- 1:27so it's not a it's not a mux telling you
- 1:29who wins who drives the end
- 1:30that would be a different almost a
- 1:31similar shape but this alu is a
- 1:33different shape
- 1:34in which this signal line tells you what
- 1:35operation to do that's pretty cool
- 1:39well before i start anything let's start
- 1:42it
- 1:42start the truth tables how many rows how
- 1:45many inputs do i have
- 1:4632 here 32 there that's 64. two more for
- 1:49there at 66. all right let's go
- 1:50two minutes get your pencils out start
- 1:52sharpening 2 to the 66 different rows
- 1:55no we're not going to build that using
- 1:57truth tables we could
- 1:58a long time i'd be still working on it
- 2:00by the time i die let's actually be
- 2:02smart about it right like we saw last
- 2:03time with the mux
- 2:04with the 4 to 1 mux let's be smart about
- 2:06it what pieces can i reuse
- 2:08this is it this is the last slide on
- 2:10this lecture this is cool let's take it
- 2:12out let's take a look
- 2:14i'm going to reuse my muxes there's my
- 2:18muxes okay
- 2:20and i'm going to hierarchically choose
- 2:22whether
- 2:23those muxes choose the and
- 2:27or or wait add subtract i'm going to
- 2:29build one block to do both atoms
- 2:31subtract because they're so similar
- 2:32we're going to see the last lecture of
- 2:34the series how did to build an absolute
- 2:35a very clever adder and a subtractor box
- 2:38so what does the and look like what if i
- 2:41dig this and
- 2:41zoom that in what does that look like
- 2:43it's just 32 parallel ands that's all it
- 2:45is
- 2:46so nothing really special or magical
- 2:47about my and block
- 2:49or my or block okay
- 2:52i've got my a and b they're being fed
- 2:54into everybody
- 2:55this signal line the lower bit of s0 is
- 2:58determining both whether i add and
- 3:00subtract
- 3:00and whether i choose the and or
- 3:04if i happen to use an add or subtract
- 3:06well then my at s1 is going to be zero
- 3:09okay and i don't care what happens here
- 3:12all this work almost like that
- 3:13the person who loses the presidential
- 3:14thing this work has happened this guy is
- 3:17computing and doing his n and or and
- 3:19then they're being chosen here
- 3:21only to be not be chosen if i end up
- 3:23going with an atom subtract that's just
- 3:25the life that's hardware hardware is
- 3:26always operating okay well save some
- 3:28energy by turning it off you can't turn
- 3:30it off it's just
- 3:30always doing what it does it always has
- 3:32a voltage and switching the transistors
- 3:34are just always
- 3:34on there's been attempts to try to think
- 3:36about can you turn whole areas of the
- 3:38chip
- 3:38off that's been harder that's been an
- 3:40interesting piece of research but
- 3:42for now we're going to assume that that
- 3:43doesn't exist and we're just always
- 3:45computing
- 3:46only choosing whether we want of
- 3:47basically the add subtract or and and or
- 3:50and if it is n in order to these guys
- 3:51there okay
- 3:53that's it i'm going to need one bit to
- 3:55tell me whether i'm adding or
- 3:56subtracting
- 3:56i do need to calculate overflow and i
- 3:59have to think about
- 4:00am i overflowing on unsigned or signed
- 4:03numbers and that can be complicated so
- 4:05we're going to assume that a and b are
- 4:07the same
- 4:07and either both unsigned or both signed
- 4:09and that turns out overflow is a little
- 4:10different for those two cases
- 4:11so let's actually spend some time
- 4:12thinking about that little later but for
- 4:13now this is pretty cool right there's
- 4:15our alu
- 4:16this is my alu folks there's my aou
- 4:18watch me let me try this here
- 4:22pupe yeah actually i didn't do it right
- 4:23let me let me draw right
- 4:25i have to go like this poop
- 4:28look at this yeah you have to make the
- 4:30sound you have to make the sound here to
- 4:31make the sound
- 4:32and there's s0 coming in and there is s1
- 4:34over here
- 4:35and s0 is going to come in here and then
- 4:37somehow be sent to this guy also
- 4:39okay so that's my alu i have to write
- 4:42big a
- 4:43u that's pretty cool so that's my aou
- 4:45that's how it works
- 4:46now let's so and and or is done let's
- 4:48spend some time thinking about the adder
- 4:49and subtractor because that's a little
- 4:50more complicated we need a couple videos
- 4:52for that we'll see you there
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 17.2 - Combinational Logic Blocks: ALU by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,055 words across 164 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.