跳转至

BypassNetwork

- Version: V2R2

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

Terminology

Terminology Description
Full Name Description
BypassNetWork Bypass Network

Submodule List

Submodule List
Submodule Description
ImmExtracter Immediate Generator Module
UIntExtracter UInt Decoder Module

Function

The BypassNetwork is located between the DataPath and Exu pipeline stages. Its primary function is to provide source operands for the functional units. There are currently 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 UIntExtracter extracts the one-hot code to select possible bypass data from functional units. The current wake-up configuration is shown in the tables below.

Current 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
Current Wake-up Configuration 2
Source Sink
FEX0 FEX0, FEX1, FEX2, FEX3, FEX4
FEX2 FEX0, FEX1, FEX2, FEX3, FEX4
FEX4 FEX0, FEX1, FEX2, FEX3, FEX4
Among these, the two-stage bypass between vector floating-point and memory access units is currently temporarily canceled.

Next, for the source operand that is an immediate, the ImmExtractor assembles and generates the 64-bit immediate based on the immediate information from the datapath.

Finally, based on the data source information in the datapath, the source operand is selected from all possible data sources (forwarding, bypass, two-stage bypass, v0, register file, immediate, regcache, register 0) and passed to the functional unit.

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

See 此图 for the specific design:

BypassNetwork

Module Design

Submodule ImmExtracter

This module is responsible for generating the 64-bit immediate. First, based on the mapping below, the immediate is mapped to a 32-bit form, and then the result is sign-extended to a 64-bit immediate.

Immediate Mapping
SelImm ImmUnion Immlen extracter
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)

Submodule UIntExtracter

This module serves the toExuOH function: it is responsible for decoding the exuidx of the source operand bypass source, which is compressed into UInt, into a one-hot form.

The functional unit index in the exusource, which records the source operand bypass source, undergoes two levels of compression during the dispatch stage:

  • First, the one-hot code representing 27 functional units is compressed into a one-hot code for 7/3 functional units, based on the possible sources for bypass wake-up.
  • Secondly, the one-hot code for 7/3 functional units is compressed into UInt form, resulting in a 3/2-bit UInt.

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

  • First, the 3/2-bit exusource is decompressed into one-hot code.
  • Secondly, the compressed one-hot code is decompressed into the one-hot code representing 27 functional units, based on the current functional unit's possible wake-up sources.

For the first step of decompression, it is simply completed in toExuOH through shifting (wake-up sources and source operands have a one-to-one correspondence).

The UIntExtracter is responsible for the second step of decompression, completing 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