YouTube2Text

[CS61C FA20] Lecture 17.2 - Combinational Logic Blocks: ALU — Transcript

by CS 61C Departmental · 1,055 words · 164 segments · language en · Watch on YouTube

Full transcript

  1. 0:00and welcome back now let's teach you how
  2. 0:02to build an
  3. 0:03arithmetic logic unit out of the pieces
  4. 0:05you know about already
  5. 0:06that's really cool so an aramaic
  6. 0:09arithmetic and logic unit is going to be
  7. 0:11a block a combinational logic block a
  8. 0:13high level block it's not built of small
  9. 0:14ands and ores it's i mean it has the
  10. 0:16nords inside but the idea is it's this
  11. 0:17big block
  12. 0:18that we're going to use to do the work
  13. 0:20of our computation
  14. 0:21when you have a mips when you have a
  15. 0:24mips if you have a risk five instruction
  16. 0:26that says add
  17. 0:27of something in something you know add i
  18. 0:29don't know uh
  19. 0:30t2 t1 t0 it says take t1 and t0 add them
  20. 0:34together
  21. 0:34and put them in t2 or and
  22. 0:38t2 t1 t0 means and t1 and t0 and put
  23. 0:41them into t2
  24. 0:42well who does that work in the data path
  25. 0:46it's going to be an
  26. 0:47alu an arithmetic and logic unit we're
  27. 0:49teaching you how to build that
  28. 0:51we're going to build a simple one for
  29. 0:52now but the idea is you could just
  30. 0:53extend that to build one that can handle
  31. 0:55every operation
  32. 0:56a shift left a shift right all those
  33. 0:58things amazing
  34. 0:59so we're going to show this with a very
  35. 1:01simple set of operations just
  36. 1:02add subtract and an or and we're going
  37. 1:05to have a single signal line on the side
  38. 1:07that has two bits to determine it's not
  39. 1:10the signal line it's not the mux
  40. 1:12anymore this alu is this beautiful shape
  41. 1:14and this signal line tells me
  42. 1:16which of these operations we're going to
  43. 1:18do and i'm writing these in kind of c
  44. 1:20terms are you adding subtracting
  45. 1:22are you bitwise ending or you're bitwise
  46. 1:24ordering depending on what the signal
  47. 1:26line says that's a controller for that
  48. 1:27so it's not a it's not a mux telling you
  49. 1:29who wins who drives the end
  50. 1:30that would be a different almost a
  51. 1:31similar shape but this alu is a
  52. 1:33different shape
  53. 1:34in which this signal line tells you what
  54. 1:35operation to do that's pretty cool
  55. 1:39well before i start anything let's start
  56. 1:42it
  57. 1:42start the truth tables how many rows how
  58. 1:45many inputs do i have
  59. 1:4632 here 32 there that's 64. two more for
  60. 1:49there at 66. all right let's go
  61. 1:50two minutes get your pencils out start
  62. 1:52sharpening 2 to the 66 different rows
  63. 1:55no we're not going to build that using
  64. 1:57truth tables we could
  65. 1:58a long time i'd be still working on it
  66. 2:00by the time i die let's actually be
  67. 2:02smart about it right like we saw last
  68. 2:03time with the mux
  69. 2:04with the 4 to 1 mux let's be smart about
  70. 2:06it what pieces can i reuse
  71. 2:08this is it this is the last slide on
  72. 2:10this lecture this is cool let's take it
  73. 2:12out let's take a look
  74. 2:14i'm going to reuse my muxes there's my
  75. 2:18muxes okay
  76. 2:20and i'm going to hierarchically choose
  77. 2:22whether
  78. 2:23those muxes choose the and
  79. 2:27or or wait add subtract i'm going to
  80. 2:29build one block to do both atoms
  81. 2:31subtract because they're so similar
  82. 2:32we're going to see the last lecture of
  83. 2:34the series how did to build an absolute
  84. 2:35a very clever adder and a subtractor box
  85. 2:38so what does the and look like what if i
  86. 2:41dig this and
  87. 2:41zoom that in what does that look like
  88. 2:43it's just 32 parallel ands that's all it
  89. 2:45is
  90. 2:46so nothing really special or magical
  91. 2:47about my and block
  92. 2:49or my or block okay
  93. 2:52i've got my a and b they're being fed
  94. 2:54into everybody
  95. 2:55this signal line the lower bit of s0 is
  96. 2:58determining both whether i add and
  97. 3:00subtract
  98. 3:00and whether i choose the and or
  99. 3:04if i happen to use an add or subtract
  100. 3:06well then my at s1 is going to be zero
  101. 3:09okay and i don't care what happens here
  102. 3:12all this work almost like that
  103. 3:13the person who loses the presidential
  104. 3:14thing this work has happened this guy is
  105. 3:17computing and doing his n and or and
  106. 3:19then they're being chosen here
  107. 3:21only to be not be chosen if i end up
  108. 3:23going with an atom subtract that's just
  109. 3:25the life that's hardware hardware is
  110. 3:26always operating okay well save some
  111. 3:28energy by turning it off you can't turn
  112. 3:30it off it's just
  113. 3:30always doing what it does it always has
  114. 3:32a voltage and switching the transistors
  115. 3:34are just always
  116. 3:34on there's been attempts to try to think
  117. 3:36about can you turn whole areas of the
  118. 3:38chip
  119. 3:38off that's been harder that's been an
  120. 3:40interesting piece of research but
  121. 3:42for now we're going to assume that that
  122. 3:43doesn't exist and we're just always
  123. 3:45computing
  124. 3:46only choosing whether we want of
  125. 3:47basically the add subtract or and and or
  126. 3:50and if it is n in order to these guys
  127. 3:51there okay
  128. 3:53that's it i'm going to need one bit to
  129. 3:55tell me whether i'm adding or
  130. 3:56subtracting
  131. 3:56i do need to calculate overflow and i
  132. 3:59have to think about
  133. 4:00am i overflowing on unsigned or signed
  134. 4:03numbers and that can be complicated so
  135. 4:05we're going to assume that a and b are
  136. 4:07the same
  137. 4:07and either both unsigned or both signed
  138. 4:09and that turns out overflow is a little
  139. 4:10different for those two cases
  140. 4:11so let's actually spend some time
  141. 4:12thinking about that little later but for
  142. 4:13now this is pretty cool right there's
  143. 4:15our alu
  144. 4:16this is my alu folks there's my aou
  145. 4:18watch me let me try this here
  146. 4:22pupe yeah actually i didn't do it right
  147. 4:23let me let me draw right
  148. 4:25i have to go like this poop
  149. 4:28look at this yeah you have to make the
  150. 4:30sound you have to make the sound here to
  151. 4:31make the sound
  152. 4:32and there's s0 coming in and there is s1
  153. 4:34over here
  154. 4:35and s0 is going to come in here and then
  155. 4:37somehow be sent to this guy also
  156. 4:39okay so that's my alu i have to write
  157. 4:42big a
  158. 4:43u that's pretty cool so that's my aou
  159. 4:45that's how it works
  160. 4:46now let's so and and or is done let's
  161. 4:48spend some time thinking about the adder
  162. 4:49and subtractor because that's a little
  163. 4:50more complicated we need a couple videos
  164. 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.