coreblocks.frontend.bpu package
Submodules
coreblocks.frontend.bpu.bpu module
coreblocks.frontend.bpu.component module
- class coreblocks.frontend.bpu.component.BPUComponent
Bases:
ElaboratableShared layouts and training interface for BPU components.
- update: PROVIDED: 1>]
Train on a resolved CFI using this component’s prediction metadata.
- class coreblocks.frontend.bpu.component.BPUComponentLayouts
Bases:
objectShared predictor layouts.
- class coreblocks.frontend.bpu.component.CfiPredictor
Bases:
BPUComponentIdentify CFIs in S1 and provide their targets in S2 from an S0 request.
- flush: PROVIDED: 1>]
- request_s0: PROVIDED: 1>]
- response_s1: PROVIDED: 1>]
- response_s2: PROVIDED: 1>]
coreblocks.frontend.bpu.micro_btb module
- class coreblocks.frontend.bpu.micro_btb.MicroBTB
Bases:
FastPredictorA small, fully-associative, single-cycle branch target buffer (micro-BTB).
The micro-BTB maps a fetch block address to a predicted next-fetch PC and follows an “always-taken on hit” policy: a hit means the block is predicted to redirect fetch to the stored target. The lookup is fully associative and combinational over a registered request, so a prediction requested in one cycle is available in the next cycle.
Each entry carries a saturating usefulness counter: an entry is valid while its counter is non-zero. A correct, taken hit increases the counter; a not-taken hit or a hit with a different target decreases it. When the counter reaches zero the entry stops matching and becomes a replacement candidate. Replacement prefers any such not-useful entry, otherwise it falls back to tree-pseudo-LRU over the touched entries.
- __init__(gen_params: GenParams, config: MicroBTBConfig)
coreblocks.frontend.bpu.ras module
- class coreblocks.frontend.bpu.ras.RAS
Bases:
ElaboratableA simple return address stack.
It is only a best-effort prediction, so overflow and underflow are allowed. Wrong-path speculation can also corrupt the stack, as a checkpoint only recovers the top entry.
- peek: PROVIDED: 1>]
Return the address on top of the stack, if there is one.
- recover: PROVIDED: 1>]
Restore a state previously returned by update.
- update: PROVIDED: 1>]
Push and/or pop a return address. Returns the new state, to be saved in a checkpoint.