coreblocks.frontend.fetch package
Submodules
coreblocks.frontend.fetch.fetch module
- class coreblocks.frontend.fetch.fetch.FetchUnit
Bases:
Elaboratable
Superscalar 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, cont: Method) None
- Parameters
- gen_paramsGenParams
Instance of GenParams with parameters which should be used to generate fetch unit.
- icacheCacheInterface
Instruction Cache
- contMethod
Method which should be invoked to send fetched instruction to the next step. It has layout as described by FetchLayout.
- class coreblocks.frontend.fetch.fetch.Predecoder
Bases:
Elaboratable
Instruction 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:
Elaboratable
Branch 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.
- class coreblocks.frontend.fetch.fetch.Serializer
Bases:
Elaboratable
Many-to-one serializer
Serializes many elements one-by-one in order and dispatches it to the consumer. The module accepts a new batch of elements only if the previous batch was fully consumed.
It is a temporary workaround for a fetch buffer until the rest of the core becomes superscalar.
- __init__(width: int, elem_layout: amaranth.lib.data.StructLayout | collections.abc.Iterable[tuple[str, 'ShapeLike | LayoutList']]) None