[CS61C FA20] Lecture 22.3 - Pipelining II: Pipelining Datapath — Transcript
Full transcript
- 0:13Hi. Welcome back to our pipelining
- 0:16module.
- 0:17Previously we have seen how pipelining
- 0:20is applied to laundry processing and we
- 0:23have also outlined how should we
- 0:25pipeline our RISC-V data path.
- 0:28Our conclusion there is that if we would
- 0:31like to build a five-stage pipeline, we
- 0:33should define divide the
- 0:35the execution into five stages.
- 0:38Instruction fetch, instruction decode,
- 0:40execute, memory access, and write back.
- 0:43So, let's take a look at our
- 0:45um
- 0:46single-cycle data path that we are well
- 0:49familiar with by now and see how should
- 0:51we pipeline it. So, here is our
- 0:53single-cycle data path. Um
- 0:56it has familiar blocks that we have seen
- 0:58before like the program counter,
- 0:59instruction memory, this fixed plus four
- 1:03adder, um immediate generation register
- 1:06file, branch
- 1:08com- comparator,
- 1:10um ALU,
- 1:12and the data memory, and multiplexers
- 1:14that help configure this data path to
- 1:16execute a particular instruction. And of
- 1:18course, there is the control logic that
- 1:21configures the data path.
- 1:25We have also outlined that there are
- 1:28different stages of execution inside
- 1:30this data path. And those are the stages
- 1:33that we are going to break down into
- 1:35different pipeline stages.
- 1:38To recap, these stages are the
- 1:40instruction fetch, instruction decode
- 1:42with register read,
- 1:44um ALU execute stage, memory access, and
- 1:47write back.
- 1:49The instruction fetch starts
- 1:51on the rising edge of a clock
- 1:53by um
- 1:55incrementing the program counter.
- 1:58And it finishes by having the data read
- 2:02out of the instruction memory.
- 2:04Remember, our memory read and register
- 2:08access are treated as combinational, um,
- 2:11logic operations,
- 2:12um, meaning that they do not rely on
- 2:14clocks and as soon as the data is stable
- 2:17at the output, we conclude we assume
- 2:21that that operation has been concluded,
- 2:23has been finished. So, as soon as the
- 2:26instruction here instruction bits are
- 2:28stable at the output of the instruction
- 2:30memory, we move on to the next stage.
- 2:33Uh, the next stage is the instruction
- 2:34decode. When when we will
- 2:36decode this memory and read the
- 2:38registers. Again, registers are read
- 2:41like a combinational logic. So, as soon
- 2:44as those values are stable at the at the
- 2:47output of the
- 2:48register file,
- 2:50the instruction decode phase is done. We
- 2:53move on to the
- 2:55execution phase or the execute phase,
- 2:58uh, where we perform the ALU operation
- 3:00and that one is done when the output at
- 3:02the ALU is valid. We move on to the
- 3:05memory access phase if we are accessing
- 3:08memory in loads or stores and when we
- 3:11are done with that,
- 3:12we move on to the write back where we
- 3:15write back into the destination register
- 3:18in the
- 3:20um,
- 3:21register file on the rising edge of a
- 3:23clock.
- 3:25So, how do we pipeline? Well, we simply
- 3:27insert registers at appropriate places.
- 3:30At the
- 3:31in on the boundary between each of these
- 3:33execution phases, we need to put
- 3:36registers. So, we are going to have
- 3:38registers here that are conveniently
- 3:40labeled as IFID, IDEX, EXMA, and MAW WB
- 3:47to separate,
- 3:49uh, various execution phases.
- 3:52Um
- 3:54let's take a look at the few of the
- 3:55highlights here. Uh all of this looks
- 3:57fairly familiar.
- 3:59Um
- 4:01first at the end of the instruction
- 4:04fetch phase, we
- 4:06have two registers. We uh have a
- 4:09register for the program counter and for
- 4:11the instruction.
- 4:12The latter one is particularly
- 4:14interesting. Keep in mind that we have
- 4:16five instructions in flight. While one
- 4:18of them is being fetched, we have copies
- 4:21of the previously fetched four
- 4:23instructions down the stream. So, we
- 4:25need to save those instructions. That's
- 4:27why we have them in this register, then
- 4:30in the registers
- 4:31below that and so on.
- 4:35Each one of these pipeline registers
- 4:38will have to hold the bits that
- 4:40correspond to the to the instruction
- 4:43that is being executed in that
- 4:45particular stage. Otherwise, we will
- 4:48know what that stage is doing. So, that
- 4:50stage has to keep the instruction, but
- 4:52also control bits that correspond to
- 4:55that.
- 4:57The other thing to that should be
- 4:59noticed here is that um
- 5:02we are sending down the program counter
- 5:03and there we are pipelining the program
- 5:05counter value, um but we are not sending
- 5:08down the PC plus four value.
- 5:11Um instead, we are recreating PC plus
- 5:14four value in the memory access stage.
- 5:19Um
- 5:20that's a design decision. Um it is
- 5:22cheaper to have uh fixed function adder,
- 5:25plus four adder, instead of using one,
- 5:29two, three
- 5:30uh registers to store
- 5:33three 32-bit PC plus four values. The
- 5:36other thing that we notice here, we are
- 5:38using um the PC value more upstream here
- 5:42in the first three stages of execution,
- 5:44and then we need only PC plus four down
- 5:47in um
- 5:49uh the memory access stage.
- 5:52To send it down to be written back if
- 5:54needed.
- 5:57And that is essentially it. It looks
- 5:59fairly
- 6:01straightforward, although there are a
- 6:02few catches that we are going to see a
- 6:05bit later.
- 6:13The other thing that I just want to
- 6:15highlight here is
- 6:17this fact that we actually have five
- 6:19instructions that are instructions that
- 6:21are in flight here. Um
- 6:23the fifth one is not shown that is in
- 6:25the write-back stage. So the oldest
- 6:26instruction, the first the one that made
- 6:28it the furthest down the pipe that first
- 6:30the first one that went into the pipe
- 6:32made it the furthest down the pipe is
- 6:34the one in the memory access stage,
- 6:36which is or.
- 6:38Then the one that is a little younger
- 6:40than that one is SLT. And then we have
- 6:43uh store word. And the one that is being
- 6:47presently
- 6:49um
- 6:50fetched is load word.
- 6:53Keep in mind that we do have to pack
- 6:56everything that is associated with that
- 6:57instruction into that pipeline stage. So
- 7:01the instruction that is in the memory
- 7:03access will have its copy in the
- 7:05register here and also
- 7:08the values that correspond to it in the
- 7:11the associated registers that precede
- 7:14that stage. And the same thing here
- 7:17happens um
- 7:19uh before the
- 7:21uh execute stage. We have copies of
- 7:23everything that is needed for that
- 7:25particular instruction because we're
- 7:27going to get new values for the previous
- 7:30for the next instruction, which is store
- 7:32word.
- 7:35The other thing to keep in mind besides
- 7:37the instruction bits, we also need to
- 7:41save the decoded control bits. Remember
- 7:44we have control logic that tells us what
- 7:47each stage should be doing, how each
- 7:49stage should be configured.
- 7:51So once when we decode the instruction,
- 7:54we in addition to our instruction, we
- 7:56need to send down the stream all the
- 7:58control bits that correspond to that
- 8:00instruction.
- 8:02Um so um
- 8:05each of these um
- 8:07registers that are storing the program
- 8:08counter are going to be a bit wider to
- 8:11save the necessary control signals.
- 8:15So for example, our
- 8:17uh memory access stage register
- 8:20um
- 8:21or the register that is sitting between
- 8:22the memory access and the write back has
- 8:24to con- save the control signals that
- 8:27correspond to that final write back
- 8:31um over there. And then um you know,
- 8:34between write back and memory access
- 8:37uh between the the execute and memory
- 8:39access, we need to
- 8:40save the bits that correspond to the
- 8:42memory access and the write back stages
- 8:45and so on.
- 8:49That is basically it. Um
- 8:51there are some things, however, that are
- 8:54particular to the
- 8:56to the
- 8:58situation where we have multiple
- 8:59instructions in flight and which are
- 9:02called hazards. We're going to take a
- 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.