Skip to content

BypassNetwork

- Version: V2R2

  • Status: OK
  • Date: 2025/02/27
  • commit:xxx

Glossary of Terms

Terminology Explanation
Full name Description
BypassNetWork Bypass Network

Submodule List

Submodule List
Submodule Description
ImmExtracter Immediate generation module
UIntExtracter UInt Decoding Module

Function

The BypassNetWork is located between the DataPath and Exu pipeline stages, primarily used to provide source operands for functional units. Currently, there are 27 functional units with a total of 71 source operands.

First, for source operands that can be forwarded/bypassed/two-stage bypassed:

Based on the ExuSource information input from the Datapath, the UintExtract extracts one-hot codes to select possible bypass data from functional units. The current wake-up configurations are detailed in the table below.

Existing Wake-up Configuration 1
Source Sink
ALU0 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
ALU1 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
ALU2 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
ALU3 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
LDU0 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
LDU1 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
LDU2 ALU0, BJU0, ALU1, BJU1, ALU2, BJU2, ALU3, BJU3, LDU0, LDU1, LDU2, STA0, STA1, STD0, STD1
Existing Wake-up Configuration 2
Source Sink
FEX0 FEX0, FEX1, FEX2, FEX3, FEX4
FEX2 FEX0, FEX1, FEX2, FEX3, FEX4
FEX4 FEX0, FEX1, FEX2, FEX3, FEX4
其中作用于向量浮点以及访存单元之间的二级旁路,目前暂时取消。

For the source operand that is an immediate value, the 64-bit immediate is assembled and generated by the ImmExtractor based on the immediate information from the datapath.

Finally, based on the data source information in the datapath, select source operands from all possible data sources (forwarding, bypass, secondary bypass, v0, register file, immediate, regcache, register 0) and pass them to the functional unit.

Additionally, for the jump functional unit, part of the pcoffset logic is also placed in the bypass network, with the immediate information similarly assembled and generated by the ImmExtractor.

For detailed design, refer to 此图:

BypassNetwork

Module Design

Secondary Module ImmExtracter

This module is responsible for generating a 64-bit immediate value. First, the immediate is mapped to a 32-bit form according to the following mapping, and then the result is sign-extended into a 64-bit immediate.

Immediate Mapping
SelImm ImmUnion Immlen extractor
IMM_I I 12 SignExt(imm(len - 1, 0), 32)
IMM_S S 12 SignExt(imm, 32)
IMM_SB B 12 SignExt(Cat(imm, 0.U(1.W)), 32)
IMM_U U 20 Cat(imm(len - 1, 0), 0.U(12.W))
IMM_UJ J 20 SignExt(Cat(imm, 0.U(1.W)), 32)
Z Z 22 imm
IMM_B6 B6 6 ZeroExt(imm, 32)
IMM_VSETVLI VSETVLI 11 SignExt(imm, 32)
IMM_VSETIVLI VSETIVLI 15 SignExt(imm, 32)
IMM_OPIVIS OPIVIS 5 SignExt(imm, 32)
IMM_OPIVIU OPIVIU 5 ZeroExt(imm, 32)
IMM_LUI32 LUI32 32 imm(31, 0)
IMM_VRORVI VRORVI 6 ZeroExt(imm, 32)

Secondary Module UIntExtracter

This module serves the toExuOH function: responsible for decoding the compressed exuidx of source operand bypass sources into one-hot form.

The functional unit labels in the exusource that record the bypass sources of source operands undergo two stages of compression during the issue phase:

  • First, the one-hot codes marking 27 functional units are compressed into one-hot codes for 7/3 functional units based on possible bypass wake-up sources.
  • Next, the one-hot encoding of the 7/3 functional units is compressed into UInt format, totaling 3/2 bits UInt.

Therefore, in the bypass network, the compressed exusource from DataPath needs to be decompressed twice:

  • First, the 3/2-bit exusource is decompressed into a one-hot code.
  • Next, the compressed one-hot code is decompressed into a one-hot code that flags 27 functional units based on the possible wake-up sources of the current functional unit.

For the first decompression operation, in toExuOH, it only needs to be completed simply by shifting (the wake-up source and source operands are one-to-one corresponding)

The UIntExtracter is responsible for the second stage of decompression, performing the following mapping:

Wake-up Source One-Hot Mapping (1)
EncodedExuOH ExtractExuOH
ALU0(0) 0
ALU1(1) 2
ALU2(2) 4
ALU3(3) 6
LDU0(4) 20
LDU1(5) 21
LDU2(6) 22
Wake-up Source One-Hot Mapping (1)
EncodedExuOH ExtractExuOH
FEX0(0) 8
FEX1(1) 10
FEX2(2) 12