Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1Learning Outcomes

At this point, we have a datapath that can support R-, I-, S-, B-, and J-Type instructions. There is just one instruction format left: the U-Type (upper immediate) instruction. Review U-Type instructions before continuing.

2Updates needed for U-Type

To support U-Type:

There are two updates we need to make:

3Tracing the lui Datapath

Figure 1:The lui datapath. Use the menu bar to trace through the animation or download a copy of the PDF/PPTX file.

  1. Instruction Fetch: At the beginning of the clock cycle, read PC and fetch the current instruction from IMEM.

    Before the next rising clock edge, set pc + 4 to the input of PC.

  2. Instruction Decode: Build the immediate imm for U-Type instructions. Also configure control logic (see below).

  3. Execute: Get the value imm and set as the ALU output.

  4. Memory: (We don’t access DMEM, so skip this.)

  5. Write Back: Write the ALU output to the destination register and connect output of the WBSel mux to RegFile’s wdata input.

    Around the next rising clock edge, wdata, RegWEn, and rd should be held stable through setup and hold time of RegFile.

4Tracing the auipc Datapath

Figure 2:The auipc datapath. Use the menu bar to trace through the animation or download a copy of the PDF/PPTX file.

  1. Instruction Fetch: At the beginning of the clock cycle, read PC and fetch the current instruction from IMEM. Feed pc to EX phase.

    Before the next rising clock edge, set pc + 4 to the input of PC.

  2. Instruction Decode: Build the immediate imm for U-Type instructions. Also configure control logic (see below).

  3. Execute: Compute pc + imm using the ALU. Because control signals are ASel=1 and BSel=1, the two muxes before the ALU will select pc and imm, respectively. Because ALUSel=Add, the ALU will add these two values together.

  4. Memory: (We don’t access DMEM, so skip this.)

  5. Write Back: Write the ALU output to the destination register and connect output of the WBSel mux to RegFile’s wdata input.

    Around the next rising clock edge, wdata, RegWEn, and rd should be held stable through setup and hold time of RegFile.

Footnotes
  1. Review Control Signals for Stores for an explanation of “don’t care.”