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.
- 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_flush: REQUIRED: 2>]
Flush pending branch prediction requests (called on any redirect).
- bpu_request: REQUIRED: 2>]
Request a branch prediction for the given PC and FTQ pointer.
- bpu_response: PROVIDED: 1>]
Accept a branch prediction result and supply the predicted next PC to the FAU.
- 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 optionally redirect fetch to a new PC.
- 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).
- 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 is responsible for managing all stall/unstall signals that may be triggered in the core and based on them deciding if and where the frontend should be resumed.
- frontend_flush: REQUIRED: 2>]
- get_exception_information: REQUIRED: 2>]
Gets information from ExceptionInformationRegister.
- redirect_frontend: REQUIRED: 2>]
A method that will be called when the frontend needs to be redirected. Should be always ready.
- resume_from_exception: PROVIDED: 1>]
Signals that the backend handled the exception and the frontend can be resumed.
- stall_guard: PROVIDED: 1>]
A non-exclusive method whose readiness denotes if the frontend is currently stalled.
- stall_unsafe: PROVIDED: 1>]
Signals that the frontend should be stalled because an unsafe (i.e. causing difficult to handle side effects) instruction was just fetched.