coreblocks.core_structs package
Submodules
coreblocks.core_structs.crat module
- class coreblocks.core_structs.crat.CheckpointRAT
Bases:
Elaboratable
Checkpoint RAT Register Alias Table that supports saving (checkpointing) and rolling back its state. It is an replacement of plain Frontend-RAT (FRAT).
It contains two pipelined stages tag and rename, placed in Scheduler. See attributes description for details. tag for instruction must be executed at least one cycle before rename.
There are two resources allocated: “virtual” speculation tags, which are monotonic, issued and freed in-order, used to track if instructions are on valid speculation path in the core; and checkpoints, which are physical saved FRAT states, used for rollbacks. Checkpoints are freed immediately while tags are only marked as non-active, but still allocated until free in Retirement. Checkpoints are tied to some tags.
- Attributes
- free_tag: Method
Free a tag that is no longer referenced in the core. Associated checkpoints are freed too. This method accepts no arguments, because all tags must be freed in-order, so call means freeing oldest issued tag.
- get_active_tags: Method
Gets bit array of tags that are currently active. If bit is set it means that a tag is on a valid speculation path.
- tag: Method
Tag stage of CheckpointRAT. Issues instruction speculation tags. It needs rollback_tag information from core Frontend, that identifies first instruction fetched after rollback and fetch redirect. Information if checkpoint should be created after given instruction is expected to be provided from previous stage. It manages allocating new tags, scheduler flushing, information for unlocking FRAT and stalling the pipeline in case FRAT is not yet restored.
- rename: Method
Rename stage of CheckpointRAT. Works like FRAT rename. Renames source registers and updates destination register mapping on valid tagged instructions. It is responsible for saving checkpoints after instruction (with commit_checkpoint flag) rename.
- flush_restore: Method
Subset of rename. Used for restoring RAT state from Retirement on hard flushes. Blocks until restores are safe to be made. rollback must not be called after first restore.
- rollback: Method
Rollback listener automatically registered to RollbackKey. Invalidates tags, frees checkpoints, initiates FRAT restore and Scheduler flushing.