BPU Global Interface
This section introduces the definition of the overall external interaction interface of the Xiangshan Branch Prediction Unit, including the presentation of global branch prediction results and single pipeline stage prediction results.
Categories:
BPU Module Overall External Interface (PredirectIO)
Interface definition: src/main/scala/xiangshan/frontend/BPU.scala
PredirectIO is the overall external interface of the branch predictor (BPU). It mainly handles the interaction between the branch predictor (BPU) and the fetch target queue (FTQ), which includes the following parts:
- bpu_to_ftq: Information sent from BPU to FTQ, mainly for sending branch prediction results from BPU to FTQ
- Interface type:
BpuToFtqIO
- Interface type:
- resp: Global branch prediction information sent from BPU to FTQ
- Interface type:
DecoupledIO(new BpuToFtqBundle())
BpuToFtqBundle
inherits fromBranchPredictionResp
,without additional signals
- Interface type:See (
BranchPredictionResp
)
- Interface type:
- resp: Global branch prediction information sent from BPU to FTQ
- Interface type:
- ftq_to_bpu: Information sent from FTQ to BPU, mainly for handling redirect and update requests
- Interface type:
FtqToBpuIO
- Interface type:
- redirect: Redirect request sent from FTQ to BPU
- Interface type:
Valid(new BranchPredictionRedirect)
- Interface list:See (
BranchPredictionRedirect
)
- Interface type:
- update: Update request sent from FTQ to BPU
- Interface type:
Valid(new BranchPredictionUpdate)
- Interface list:See (
BranchPredictionUpdate
)
- Interface type:
- enq_ptr: FTQ pointer sent to BPU, indicating which FTQ entry to write to next
- Interface type:
FtqPtr
- Interface type:
- redirect: Redirect request sent from FTQ to BPU
- Interface type:
- ctrl: BPU control signals, mainly for enabling various predictors
- Interface type:
BPUCtrl
- Interface list:
- ubtb_enable: UBTB predictor enable
- Interface type:
Bool()
- Interface type:
- btb_enable: BTB predictor enable
- Interface type:
Bool()
- Interface type:
- bim_enable: BIM predictor enable
- Interface type:
Bool()
- Interface type:
- tage_enable: TAGE predictor enable
- Interface type:
Bool()
- Interface type:
- sc_enable: SC predictor enable
- Interface type:
Bool()
- Interface type:
- ras_enable: RAS predictor enable
- Interface type:
Bool()
- Interface type:
- loop_enable: LOOP predictor enable
- Interface type:
Bool()
- Interface type:
- ubtb_enable: UBTB predictor enable
- Interface type:
- reset_vector: Reset vector, which the BPU’s PC will be reset to upon reset
- Interface type:
UInt(PAddrBits.W)
- Interface type:
Global Branch Prediction Information (BranchPredictionResp)
Interface definition: src/main/scala/xiangshan/frontend/FrontendBundle.scala
This interface defines all the prediction result information of the branch predictor, including the prediction results of each stage and the related information output by the last pipeline stage.
- s1 Branch prediction result of the s1 pipeline stage
- s2 Branch prediction result of the s2 pipeline stage
- s3 Branch prediction result of the s3 pipeline stage
- Interface type:
BranchPredictionBundle
- Interface type:See (
BranchPredictionBundle
)
- Interface type:
- last_stage_meta Metadata of the prediction result output by the last pipeline stage. It is a bit vector output by each predictor and combined by the Composer.
- Interface type:
UInt(MaxMetaLength.W)
- Interface type:
- last_stage_spec_info Related information of the prediction result output by the last pipeline stage
- Interface type:
Ftq_Redirect_SRAMEntry
- Interface list:
- folded_hist Global folded history
- Interface type:
AllFoldedHistories(foldedGHistInfos)
- Interface type:
- afhob Global branch history oldest bit
- Interface type:
AllAheadFoldedHistoryOldestBits(foldedGHistInfos)
- Interface type:
- lastBrNumOH Last branch position
- Interface type:
UInt((numBr+1).W)
- Interface type:
- histPtr Global branch history pointer
- Interface type:
CGHPtr
- Interface type:
- ssp RAS speculation stack pointer at commit stack position
- Interface type:
UInt(log2Up(RasSize).W)
- Interface type:
- sctr RAS speculation stack recursion counter
- Interface type:
UInt(log2Up(RasCtrSize).W)
- Interface type:
- TOSW RAS speculation stack (queue) write pointer
- Interface type:
CGHPtr
- Interface type:
- TOSR RAS speculation stack (queue) read pointer
- Interface type:
CGHPtr
- Interface type:
- NOS RAS stack top counter
- Interface type:
CGHPtr
- Interface type:
- topAddr RAS stack top return address
- Interface type:
UInt(VAddrBits.W)
- Interface type:
- folded_hist Global folded history
- Interface type:
- last_stage_ftb_entry FTB entry output by the last pipeline stage
- Interface type:
FtqEntry
- Interface list:See(
FtqEntry
)
- Interface type:
FTB entry output by the last pipeline stage
Interface definition: src/main/scala/xiangshan/frontend/FrontendBundle.scala
This interface defines the branch prediction result information output by each pipeline stage,
- pc Starting PC of the predicted block
- Interface type:
Vec(numDup, UInt(VAddrBits.W))
numDup is only for register replication, with identical signals
- Interface type:
- valid Whether the prediction result is valid
- Interface type:
Vec(numDup, Bool())
- Interface type:
- hasRedirect Whether a redirect is needed
- Interface description: Only the s2 and s3 stages will redirect, and the prediction result of this stage will override the previous pipeline stage’s result when a redirect occurs
- Interface type:
Vec(numDup, Bool())
- ftq_idx FTQ pointer, pointing to the FTQ entry corresponding to the prediction information of this stage
- Interface type:
new FtqPtr
- Interface type:
- full_pred Complete branch prediction result
- Interface type:
Vec(numDup, new FullBranchPrediction)
- Interface list: See (
FullBranchPrediction
)
- Interface type: