YouTube2Text

[CS61C FA20] Lecture 20.2 - Single-Cycle CPU Control: Datapath Control — Transcript

by CS 61C Departmental · 1,858 words · 333 segments · language en · Watch on YouTube

Full transcript

  1. 0:01[Music]
  2. 0:10hello welcome back to our cpu design
  3. 0:13module
  4. 0:14we have designed the data path so it's
  5. 0:16time to figure out how to design
  6. 0:19the that control unit that we need
  7. 0:22it that we need to configure the data
  8. 0:25path
  9. 0:26so remember our picture of how the the
  10. 0:29processor
  11. 0:30look and work with the memory we had the
  12. 0:33processor
  13. 0:34and inside the processor we had two main
  14. 0:36units the data path
  15. 0:38and the control unit the control unit
  16. 0:41is essentially what we have already seen
  17. 0:45we just haven't designed it yet this is
  18. 0:48the data path a different view of the
  19. 0:49data path a detailed view of a data path
  20. 0:52and the control unit is primarily the
  21. 0:54control logic
  22. 0:55that is at the bottom of this picture
  23. 0:59inside the data path we have the number
  24. 1:01of functional units
  25. 1:03like the program counter the fixed adder
  26. 1:08instruction memory immediate generation
  27. 1:10unit
  28. 1:11register file branch comparator
  29. 1:14alu data memory and a number of
  30. 1:17multiplexers that allowed us to
  31. 1:19configure this data path
  32. 1:20to execute instructions control unit
  33. 1:23was that that was setting up these
  34. 1:26multiplexers
  35. 1:27and other configuration options inside
  36. 1:31the data path
  37. 1:31to execute different instructions
  38. 1:35so in order to really understand how is
  39. 1:38this going to be done
  40. 1:40let's take a look at execution of a few
  41. 1:42instructions
  42. 1:43and see how does the control unit
  43. 1:46handle them and simultaneously try to
  44. 1:50understand
  45. 1:51how does the
  46. 1:55how many of these different computations
  47. 1:59inside or different actions inside the
  48. 2:02processor happen concurrently
  49. 2:07so we can do that by revisiting some of
  50. 2:10the
  51. 2:11those instructions that we have
  52. 2:12introduced early on before we
  53. 2:14had the complete data path um the idea
  54. 2:17now would be to
  55. 2:19see how they work with a complete data
  56. 2:21path where
  57. 2:22everything is in place to execute all
  58. 2:24the other instructions
  59. 2:26so let's visit one of the early
  60. 2:28instructions which was the store
  61. 2:30word that's the instruction that takes
  62. 2:32the value from the
  63. 2:33operand from the register rs 2
  64. 2:37and writes it into the memory into a
  65. 2:40location that is pointed by the base
  66. 2:42address which is in register rs1
  67. 2:44and the offset which is the immediate
  68. 2:48every instruction in our data path
  69. 2:51starts execution on
  70. 2:52uh clock tick so on the rising edge of a
  71. 2:55clock we are going to write a new value
  72. 2:57into the program counter it takes a
  73. 3:00little bit of a time
  74. 3:02for that to appear at the output of the
  75. 3:04program counter
  76. 3:05at this wire here um you know and that
  77. 3:08time is what we characterize and
  78. 3:10clock to output delay
  79. 3:14so that clock to output delay after a
  80. 3:16clock out to output delay
  81. 3:18we get a valid program counter
  82. 3:21address um here pointing to the
  83. 3:23instruction memory but it is also
  84. 3:25ready to be updated and perhaps used
  85. 3:28later on
  86. 3:29down the the stream in the data path
  87. 3:32let's visit what is happening so there
  88. 3:34are two things that are happening
  89. 3:35concurrently we are fetching an
  90. 3:37instruction from the instruction memory
  91. 3:38and we are updating the program counter
  92. 3:41so as we add this plus four to the
  93. 3:44program counter we get a new value at
  94. 3:45the input of this multiplexer
  95. 3:48but it is not going to propagate through
  96. 3:50the multiplexer
  97. 3:51until we know what is
  98. 3:55the new value of the pc select control
  99. 3:58signal
  100. 3:59we'll need in order to let it go through
  101. 4:02we need to know
  102. 4:04what is the the actual instruction that
  103. 4:06is being
  104. 4:07executed and how does it affect pc
  105. 4:10select signal
  106. 4:12now concurrently we got our instruction
  107. 4:15while we are adding plus four
  108. 4:16we got our instruction from the
  109. 4:18instruction memory one thing that should
  110. 4:19be kept in mind
  111. 4:20propagation delays through the
  112. 4:22instruction memory and this
  113. 4:24fixed another are comparable to each
  114. 4:27other
  115. 4:29why is that i mean you may be puzzled
  116. 4:31with this
  117. 4:33we said early on that getting anything
  118. 4:35from memory is like
  119. 4:36going to sacramento and
  120. 4:39addition is not doesn't take us as long
  121. 4:42as going to sacramento
  122. 4:44um keep in mind that this is a local
  123. 4:46copy of
  124. 4:48a subset of instructions that we have
  125. 4:49brought from the memory such that we
  126. 4:51have them handy inside the room
  127. 4:53so we can just take a look at them
  128. 4:55that's a concept of a cache
  129. 4:57that is going to be introduced in the
  130. 4:58next module but you
  131. 5:00we don't need to know anything about the
  132. 5:01cache we just need to know that the
  133. 5:03instructions are handy
  134. 5:05they're accessible to us and the time
  135. 5:08that it takes
  136. 5:09us to get them is comparable to the time
  137. 5:12to add for to the program counter
  138. 5:16so as soon as we get an instruction we
  139. 5:18can do
  140. 5:19multiple things concurrently with
  141. 5:22different data that we got from that
  142. 5:24instruction we know
  143. 5:26that addresses of
  144. 5:29different registers in the register
  145. 5:31files are always
  146. 5:32in the fixed location so we can go ahead
  147. 5:34and get
  148. 5:35data from those locations even if we
  149. 5:37don't need it if this
  150. 5:39instruction is not operating on the
  151. 5:42on the registers it doesn't cost us
  152. 5:44anything
  153. 5:45we can get that data and then toss it
  154. 5:48later if we don't need it
  155. 5:50but we don't have to wait for the
  156. 5:51control to proceed with that
  157. 5:53simultaneously we can generate an
  158. 5:55immediate we do need to know what kind
  159. 5:57of intermediate
  160. 5:59we want so this is going to be
  161. 6:03gated by the control logic but the third
  162. 6:06thing that we are going to do
  163. 6:09concurrently is determine which kind of
  164. 6:12instruction
  165. 6:12it is and what should be the values of
  166. 6:15control signals
  167. 6:16so the control logic is essentially a
  168. 6:19number of logic gates
  169. 6:20boolean logic gates that we have already
  170. 6:22seen that
  171. 6:25takes bits from the instruction
  172. 6:28and determines the control signals based
  173. 6:31on them
  174. 6:32so in this case since this is a store
  175. 6:35word instruction
  176. 6:36it'll set the pc select value to plus
  177. 6:38four
  178. 6:39as soon as it does that it will let
  179. 6:43pc plus four propagate to the input
  180. 6:45program counter but it is not going to
  181. 6:46be written into a program counter
  182. 6:48until we get to the next clock tick
  183. 6:52all the other control signals are set
  184. 6:54simultaneously
  185. 6:56immediate select this select select to s
  186. 6:59type
  187. 6:59register write enable
  188. 7:02um is uh a zero because we are not
  189. 7:06writing anything back into the
  190. 7:07register file at the end of a store we
  191. 7:10don't care about the branches
  192. 7:12b select is select set to be uh
  193. 7:16picking an immediate a select is picking
  194. 7:19the out
  195. 7:19the the rs1 value
  196. 7:22lu select is going to do the addition of
  197. 7:25the offset
  198. 7:26with the base address uh
  199. 7:29read write signal is going to be set to
  200. 7:31right and right back select is a
  201. 7:33don't care so while we were doing that
  202. 7:37we are also busy with
  203. 7:42getting the data out of the register
  204. 7:43file and
  205. 7:45generated the immediate it is likely
  206. 7:47that immediate generation may take a bit
  207. 7:50longer than getting data from the
  208. 7:51registers
  209. 7:52because it is gated by figuring out
  210. 7:55which kind
  211. 7:56of an immediate we want but it's still
  212. 7:58comparable
  213. 7:59so we'll get approximately about the
  214. 8:01same time the values of rs1 and rs2
  215. 8:04and the immediate and we can proceed
  216. 8:06with executing the rest of the
  217. 8:07instruction
  218. 8:08they're going to propagate through the
  219. 8:10multiplexers alu is going to add the two
  220. 8:13values
  221. 8:14and then we have everything we need to
  222. 8:16finish the instruction
  223. 8:18uh rs1 plus the offset is pointing to
  224. 8:20the appropriate address
  225. 8:22in the data memory and the operand
  226. 8:25and the value that we would like to
  227. 8:27write into it is sitting at
  228. 8:29data right port of the data memory
  229. 8:35the only thing that we need to finish
  230. 8:38this instruction
  231. 8:39is to raise the clock
  232. 8:43a again so on this clock tick
  233. 8:46both the program counter and the data
  234. 8:48memory get updated
  235. 8:50and we have finished this instruction
  236. 8:52and we have actually simultaneously
  237. 8:54starting execution the next instruction
  238. 8:56let's take a look
  239. 8:57at another instruction that we visited
  240. 9:00early on
  241. 9:01and we are going to do that a little bit
  242. 9:03faster this time this is
  243. 9:05branch if equal instruction
  244. 9:08so it also starts on the clock tick um
  245. 9:10multiple things happen
  246. 9:12concurrently we increment
  247. 9:16the pc to a value please pc plus four
  248. 9:20but keep in mind that this is
  249. 9:23not going to be ready for writing into
  250. 9:25the program counter anytime
  251. 9:27soon because that will be about the last
  252. 9:30thing
  253. 9:31that happens in the branch the branch
  254. 9:34does not get completed until we know
  255. 9:35whether we are taking it or not
  256. 9:39so we are fetching this instruction but
  257. 9:41we are also lighting up this spot
  258. 9:43showing
  259. 9:43that we have a program counter value
  260. 9:47sitting in front of the a multiplexer
  261. 9:51and this happens with every instruction
  262. 9:52we just don't take it
  263. 9:55don't proceed with this pc value
  264. 9:59unless these are branches or jumps so
  265. 10:02concurrently with fetching the register
  266. 10:04values
  267. 10:05and me you know generating the immediate
  268. 10:09um we decode what is this instruction
  269. 10:13and set the control bits we can't do
  270. 10:16anything with the pc
  271. 10:17select until we know the outcome of the
  272. 10:19branch
  273. 10:20but we can set that immediate is of a
  274. 10:22branch type
  275. 10:24register right is zero we are not
  276. 10:26writing anything back to the registers
  277. 10:28this is in branch if equal so sideness
  278. 10:32does not matter branch if less than
  279. 10:35um we don't care about the outcome of
  280. 10:38that so we are not going to take into
  281. 10:39the consideration when calculating the
  282. 10:41control signals
  283. 10:43b select is set to 1 to take the the pc
  284. 10:46as the input
  285. 10:47a select is set b select is
  286. 10:50taking the
  287. 10:541 which is the value of the
  288. 10:57immediate a select is taking value 1
  289. 11:01to take the the program counter
  290. 11:05alu select is set to add the
  291. 11:10the the the two inputs and
  292. 11:13memory is set to read because we are not
  293. 11:15writing anything to the memory
  294. 11:17and right back select is i don't care
  295. 11:19[Music]
  296. 11:22so we got everything now by the time
  297. 11:24while we are setting that
  298. 11:26we can take our operands that we were
  299. 11:29fetching
  300. 11:30from the memory they're ready and so is
  301. 11:32the immediate
  302. 11:33and we are ready to proceed
  303. 11:36we can figure out what is now the
  304. 11:41result of a branch comparison and we got
  305. 11:44our
  306. 11:44result whether the values are equal or
  307. 11:47not
  308. 11:48that allows us to set the pc select
  309. 11:53to taken or not taken value
  310. 11:56but we cannot complete the instruction
  311. 11:58until we know
  312. 11:59where do we go if the branch is taken so
  313. 12:02that we'll we'll figure that out
  314. 12:04after the alu completes its
  315. 12:07operation its addition and
  316. 12:11presents this new value at the input of
  317. 12:14the multiplexer
  318. 12:17at that point we have both of those
  319. 12:19signals valid
  320. 12:20one of them that is set by the pc select
  321. 12:22propagates into the program
  322. 12:24counter and that completes the
  323. 12:25instruction although the clock
  324. 12:28ticks everywhere the only state that
  325. 12:31gets updated
  326. 12:32is the value of the program counter so
  327. 12:34that is what
  328. 12:35wraps up the branch if equal instruction
  329. 12:39and that is it we are going to take a
  330. 12:42look
  331. 12:43at more detailed timing in the next
  332. 12:46segment
  333. 12:47see you then

About this transcript

This page contains the full transcript of [CS61C FA20] Lecture 20.2 - Single-Cycle CPU Control: Datapath Control by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,858 words across 333 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.