coreblocks.frontend package
Subpackages
- coreblocks.frontend.bpu package
- coreblocks.frontend.decoder package
- coreblocks.frontend.fetch package
Submodules
coreblocks.frontend.fetch_addr_unit module
- class coreblocks.frontend.fetch_addr_unit.FetchAddressUnit
Bases:
ElaboratableOwns the speculative fetch program counter and arbitrates all frontend redirects. It selects the next fetch PC based on reset, backend redirects, IFU redirects, and branch prediction results.
- backend_redirect: PROVIDED: 1>]
Redirect the fetch PC after a misprediction resolved by the backend.
- ifu_redirect: PROVIDED: 1>]
Redirect the fetch PC after a misprediction detected by the IFU, or - when pc_valid is low - invalidate it, because the IFU doesn’t know where to fetch next.
- read: PROVIDED: 1>]
Consume the current fetch PC. Blocks until a valid PC is available.
- write: PROVIDED: 1>]
Supply the next fetch PC (e.g. from a BPU prediction). Requires the current PC to have been consumed.
coreblocks.frontend.frontend module
- class coreblocks.frontend.frontend.CoreFrontend
Bases:
ElaboratableFrontend of the core.
- __init__(*, gen_params: GenParams, instr_bus: BusMasterInterface)
- consume_instr: PROVIDED: 1>]
Consume a single decoded instruction.
- get_exception_information: REQUIRED: 2>]
- redirect: PROVIDED: 1>]
Redirect the frontend to a new PC.
- class coreblocks.frontend.frontend.RollbackTagger
Bases:
ElaboratableProvides rollback_tag field for instructions leaving the Frontend and decides on which instructions a checkpoint should be created.
rollback_tag is used to identify new instructions fetched after each rollback. Instructions from previous rollback are flushed internally in Frontend (and this module), but this is needed to differentiate from instructions that left Frontend earlier.
Requires get_instr and push_instr methods
- get_instr: REQUIRED: 2>]
- push_instr: REQUIRED: 2>]
- rollback: PROVIDED: 1>]
coreblocks.frontend.frontend_params module
- class coreblocks.frontend.frontend_params.FrontendParams
Bases:
object- fb_addr(pc: Value | int | Enum | ValueCastable) Value
Returns the fetch block address of a given PC.
coreblocks.frontend.ftq module
- class coreblocks.frontend.ftq.FTQReadQueue
Bases:
ElaboratableA memory indexed by FTQ pointer, with random-access writes and an internal read pointer that pops entries in FTQ order.
- class coreblocks.frontend.ftq.FetchTargetQueue
Bases:
ElaboratableTracks speculative fetch targets in a circular buffer indexed by FTQ pointer. Each entry represents one fetch block: the FTQ allocates an entry per fetch, sends the PC to both the IFU and BPU, and advances the fetch pointer. Entries are freed once the training stream has consumed them; the buffer stalls allocation when full.
- backend_redirect: PROVIDED: 1>]
Handle a backend misprediction: reset alloc/fetch pointers to commit+1 and redirect the FAU.
- bpu_fetch_target: PROVIDED: 1>]
Pass an FTQ entry’s next fetch target to the FAU.
- bpu_flush: REQUIRED: 2>]
Flush pending branch prediction requests (called on any redirect).
- bpu_prediction_details: PROVIDED: 1>]
Store an FTQ entry’s prediction, predictor metadata, and lookup PC.
- bpu_request: REQUIRED: 2>]
Request a branch prediction for the given PC and FTQ pointer.
- bpu_update: REQUIRED: 2>]
Train the branch predictor with a resolved branch.
- check_stale: PROVIDED: 1>]
Tell whether a fetch request (identified by its FTQ pointer and generation) is stale, i.e. was invalidated by a redirect after it was issued.
- commit: PROVIDED: 1>]
Retire an FTQ entry, advancing the commit pointer and freeing the slot.
- ifu_request: REQUIRED: 2>]
Issue a fetch request to the instruction fetch unit for the given PC and FTQ pointer.
- ifu_writeback: PROVIDED: 1>]
Handle an IFU-detected misprediction/unsafe instruction: flush the BPU and either redirect fetch to a new PC or invalidate the fetch PC, which stalls fetching until the backend resumes it.
- jump_target_req: PROVIDED: 1>]
Request the predicted jump target for a given FTQ entry (stub).
- jump_target_resp: PROVIDED: 1>]
Return the predicted jump target for a given FTQ entry (stub).
- ras_peek: PROVIDED: 1>]
Read the address on top of the return address stack.
- ras_predict: PROVIDED: 1>]
Apply a fetch block’s speculative effect on the return address stack and checkpoint it.
- read_prediction: PROVIDED: 1>]
Return the branch prediction stored for a given FTQ entry (read by the fetch unit).
- resolve: PROVIDED: 1>]
Record branch resolution information for a committed FTQ entry (stub).
- stall_guard: REQUIRED: 2>]
Blocks only while the pipeline is stalled (e.g. during a flush).
coreblocks.frontend.stall_controller module
- class coreblocks.frontend.stall_controller.StallController
Bases:
ElaboratableThe stall controller watches for exceptions raised on the speculative path and stalls the frontend until the backend redirects it to the trap handler (or a rollback invalidates the exception and redirects the frontend itself).
- frontend_flush: REQUIRED: 2>]
- get_exception_information: REQUIRED: 2>]
Gets information from ExceptionInformationRegister.
- stall_guard: PROVIDED: 1>]
A non-exclusive method whose readiness denotes if the frontend is currently stalled.