YouTube2Text

[CS61C FA20] Lecture 22.3 - Pipelining II: Pipelining Datapath — Transcript

by CS 61C Departmental · 1,252 words · 221 segments · language en · Watch on YouTube

Full transcript

  1. 0:13Hi. Welcome back to our pipelining
  2. 0:16module.
  3. 0:17Previously we have seen how pipelining
  4. 0:20is applied to laundry processing and we
  5. 0:23have also outlined how should we
  6. 0:25pipeline our RISC-V data path.
  7. 0:28Our conclusion there is that if we would
  8. 0:31like to build a five-stage pipeline, we
  9. 0:33should define divide the
  10. 0:35the execution into five stages.
  11. 0:38Instruction fetch, instruction decode,
  12. 0:40execute, memory access, and write back.
  13. 0:43So, let's take a look at our
  14. 0:45um
  15. 0:46single-cycle data path that we are well
  16. 0:49familiar with by now and see how should
  17. 0:51we pipeline it. So, here is our
  18. 0:53single-cycle data path. Um
  19. 0:56it has familiar blocks that we have seen
  20. 0:58before like the program counter,
  21. 0:59instruction memory, this fixed plus four
  22. 1:03adder, um immediate generation register
  23. 1:06file, branch
  24. 1:08com- comparator,
  25. 1:10um ALU,
  26. 1:12and the data memory, and multiplexers
  27. 1:14that help configure this data path to
  28. 1:16execute a particular instruction. And of
  29. 1:18course, there is the control logic that
  30. 1:21configures the data path.
  31. 1:25We have also outlined that there are
  32. 1:28different stages of execution inside
  33. 1:30this data path. And those are the stages
  34. 1:33that we are going to break down into
  35. 1:35different pipeline stages.
  36. 1:38To recap, these stages are the
  37. 1:40instruction fetch, instruction decode
  38. 1:42with register read,
  39. 1:44um ALU execute stage, memory access, and
  40. 1:47write back.
  41. 1:49The instruction fetch starts
  42. 1:51on the rising edge of a clock
  43. 1:53by um
  44. 1:55incrementing the program counter.
  45. 1:58And it finishes by having the data read
  46. 2:02out of the instruction memory.
  47. 2:04Remember, our memory read and register
  48. 2:08access are treated as combinational, um,
  49. 2:11logic operations,
  50. 2:12um, meaning that they do not rely on
  51. 2:14clocks and as soon as the data is stable
  52. 2:17at the output, we conclude we assume
  53. 2:21that that operation has been concluded,
  54. 2:23has been finished. So, as soon as the
  55. 2:26instruction here instruction bits are
  56. 2:28stable at the output of the instruction
  57. 2:30memory, we move on to the next stage.
  58. 2:33Uh, the next stage is the instruction
  59. 2:34decode. When when we will
  60. 2:36decode this memory and read the
  61. 2:38registers. Again, registers are read
  62. 2:41like a combinational logic. So, as soon
  63. 2:44as those values are stable at the at the
  64. 2:47output of the
  65. 2:48register file,
  66. 2:50the instruction decode phase is done. We
  67. 2:53move on to the
  68. 2:55execution phase or the execute phase,
  69. 2:58uh, where we perform the ALU operation
  70. 3:00and that one is done when the output at
  71. 3:02the ALU is valid. We move on to the
  72. 3:05memory access phase if we are accessing
  73. 3:08memory in loads or stores and when we
  74. 3:11are done with that,
  75. 3:12we move on to the write back where we
  76. 3:15write back into the destination register
  77. 3:18in the
  78. 3:20um,
  79. 3:21register file on the rising edge of a
  80. 3:23clock.
  81. 3:25So, how do we pipeline? Well, we simply
  82. 3:27insert registers at appropriate places.
  83. 3:30At the
  84. 3:31in on the boundary between each of these
  85. 3:33execution phases, we need to put
  86. 3:36registers. So, we are going to have
  87. 3:38registers here that are conveniently
  88. 3:40labeled as IFID, IDEX, EXMA, and MAW WB
  89. 3:47to separate,
  90. 3:49uh, various execution phases.
  91. 3:52Um
  92. 3:54let's take a look at the few of the
  93. 3:55highlights here. Uh all of this looks
  94. 3:57fairly familiar.
  95. 3:59Um
  96. 4:01first at the end of the instruction
  97. 4:04fetch phase, we
  98. 4:06have two registers. We uh have a
  99. 4:09register for the program counter and for
  100. 4:11the instruction.
  101. 4:12The latter one is particularly
  102. 4:14interesting. Keep in mind that we have
  103. 4:16five instructions in flight. While one
  104. 4:18of them is being fetched, we have copies
  105. 4:21of the previously fetched four
  106. 4:23instructions down the stream. So, we
  107. 4:25need to save those instructions. That's
  108. 4:27why we have them in this register, then
  109. 4:30in the registers
  110. 4:31below that and so on.
  111. 4:35Each one of these pipeline registers
  112. 4:38will have to hold the bits that
  113. 4:40correspond to the to the instruction
  114. 4:43that is being executed in that
  115. 4:45particular stage. Otherwise, we will
  116. 4:48know what that stage is doing. So, that
  117. 4:50stage has to keep the instruction, but
  118. 4:52also control bits that correspond to
  119. 4:55that.
  120. 4:57The other thing to that should be
  121. 4:59noticed here is that um
  122. 5:02we are sending down the program counter
  123. 5:03and there we are pipelining the program
  124. 5:05counter value, um but we are not sending
  125. 5:08down the PC plus four value.
  126. 5:11Um instead, we are recreating PC plus
  127. 5:14four value in the memory access stage.
  128. 5:19Um
  129. 5:20that's a design decision. Um it is
  130. 5:22cheaper to have uh fixed function adder,
  131. 5:25plus four adder, instead of using one,
  132. 5:29two, three
  133. 5:30uh registers to store
  134. 5:33three 32-bit PC plus four values. The
  135. 5:36other thing that we notice here, we are
  136. 5:38using um the PC value more upstream here
  137. 5:42in the first three stages of execution,
  138. 5:44and then we need only PC plus four down
  139. 5:47in um
  140. 5:49uh the memory access stage.
  141. 5:52To send it down to be written back if
  142. 5:54needed.
  143. 5:57And that is essentially it. It looks
  144. 5:59fairly
  145. 6:01straightforward, although there are a
  146. 6:02few catches that we are going to see a
  147. 6:05bit later.
  148. 6:13The other thing that I just want to
  149. 6:15highlight here is
  150. 6:17this fact that we actually have five
  151. 6:19instructions that are instructions that
  152. 6:21are in flight here. Um
  153. 6:23the fifth one is not shown that is in
  154. 6:25the write-back stage. So the oldest
  155. 6:26instruction, the first the one that made
  156. 6:28it the furthest down the pipe that first
  157. 6:30the first one that went into the pipe
  158. 6:32made it the furthest down the pipe is
  159. 6:34the one in the memory access stage,
  160. 6:36which is or.
  161. 6:38Then the one that is a little younger
  162. 6:40than that one is SLT. And then we have
  163. 6:43uh store word. And the one that is being
  164. 6:47presently
  165. 6:49um
  166. 6:50fetched is load word.
  167. 6:53Keep in mind that we do have to pack
  168. 6:56everything that is associated with that
  169. 6:57instruction into that pipeline stage. So
  170. 7:01the instruction that is in the memory
  171. 7:03access will have its copy in the
  172. 7:05register here and also
  173. 7:08the values that correspond to it in the
  174. 7:11the associated registers that precede
  175. 7:14that stage. And the same thing here
  176. 7:17happens um
  177. 7:19uh before the
  178. 7:21uh execute stage. We have copies of
  179. 7:23everything that is needed for that
  180. 7:25particular instruction because we're
  181. 7:27going to get new values for the previous
  182. 7:30for the next instruction, which is store
  183. 7:32word.
  184. 7:35The other thing to keep in mind besides
  185. 7:37the instruction bits, we also need to
  186. 7:41save the decoded control bits. Remember
  187. 7:44we have control logic that tells us what
  188. 7:47each stage should be doing, how each
  189. 7:49stage should be configured.
  190. 7:51So once when we decode the instruction,
  191. 7:54we in addition to our instruction, we
  192. 7:56need to send down the stream all the
  193. 7:58control bits that correspond to that
  194. 8:00instruction.
  195. 8:02Um so um
  196. 8:05each of these um
  197. 8:07registers that are storing the program
  198. 8:08counter are going to be a bit wider to
  199. 8:11save the necessary control signals.
  200. 8:15So for example, our
  201. 8:17uh memory access stage register
  202. 8:20um
  203. 8:21or the register that is sitting between
  204. 8:22the memory access and the write back has
  205. 8:24to con- save the control signals that
  206. 8:27correspond to that final write back
  207. 8:31um over there. And then um you know,
  208. 8:34between write back and memory access
  209. 8:37uh between the the execute and memory
  210. 8:39access, we need to
  211. 8:40save the bits that correspond to the
  212. 8:42memory access and the write back stages
  213. 8:45and so on.
  214. 8:49That is basically it. Um
  215. 8:51there are some things, however, that are
  216. 8:54particular to the
  217. 8:56to the
  218. 8:58situation where we have multiple
  219. 8:59instructions in flight and which are
  220. 9:02called hazards. We're going to take a
  221. 9:05look at the hazards next. See you then.

About this transcript

This page contains the full transcript of [CS61C FA20] Lecture 22.3 - Pipelining II: Pipelining Datapath by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,252 words across 221 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 choose a caption track available on the video.

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, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.