coreblocks.frontend.fetch package
Submodules
coreblocks.frontend.fetch.fetch module
- class coreblocks.frontend.fetch.fetch.FetchUnit
Bases:
ElaboratableSuperscalar Fetch Unit
This module is responsible for retrieving instructions from memory and forwarding them to the decode stage.
It works with ‘fetch blocks’, chunks of data it handles at a time. The size of these blocks depends on GenParams.fetch_block_bytes and is related to how many instructions the unit can handle at once, which can vary if extension C is on.
The unit also deals with expanding compressed instructions and managing instructions that aren’t aligned to 4-byte boundaries.
- __init__(gen_params: GenParams, icache: CacheInterface) None
- Parameters:
- gen_paramsGenParams
Instance of GenParams with parameters which should be used to generate fetch unit.
- icacheCacheInterface
Instruction Cache
- cont: REQUIRED: 2>]
Should be invoked to send fetched instruction to the next step.
- fetch_request: PROVIDED: 1>]
Requests a fetch of the instruction block at the given PC.
- fetch_writeback: REQUIRED: 2>]
Invoked to write back the status of the requested fetch block.
- flush: PROVIDED: 1>]
Flushes the fetch unit from the currently processed fetch blocks, so it can be redirected or/and stalled.
- stall_unsafe: REQUIRED: 2>]
Called when an unsafe instruction is fetched.
- class coreblocks.frontend.fetch.fetch.Predecoder
Bases:
ElaboratableInstruction predecoder
The module performs basic analysis on instructions. It identifies if an instruction is a jump instruction, determines the type of jump, and finds the jump’s target.
Its role is to give quick feedback to the fetch unit and potentially the branch predictor about the fetched instruction. This helps in redirecting the fetch unit promptly if needed.
- class coreblocks.frontend.fetch.fetch.PredictionChecker
Bases:
ElaboratableBranch prediction checker
This module checks if branch predictions are correct by looking at predecoded data. It checks for the following errors:
a JAL/JALR instruction was not predicted taken,
mistaking non-control flow instructions (CFI) for control flow ones,
getting the target of JAL/BRANCH instructions wrong.