coreblocks.priv.traps package

Submodules

coreblocks.priv.traps.exception module

class coreblocks.priv.traps.exception.ExceptionInformationRegister

Bases: Elaboratable

ExceptionInformationRegister

Stores parameters of earliest (in instruction order) exception, to save resources in the ReorderBuffer. All FUs that report exceptions should report the details to ExceptionCauseRegister and set exception bit in result data. Exception order is computed in this module. Only one exception can be reported for single instruction, exception priorities should be computed locally before calling report. If exception bit is set in the ROB, Retirement stage fetches exception details from this module.

__init__(gen_params: GenParams, rob_get_indices: Method, fetch_stall_exception: Method)
coreblocks.priv.traps.exception.should_update_prioriy(m: TModule, current_cause: Value, new_cause: Value) Value

coreblocks.priv.traps.instr_counter module

class coreblocks.priv.traps.instr_counter.CoreInstructionCounter

Bases: Elaboratable

Counts instructions currently processed in core. Used in exception handling, to wait for core flush to finish.

Attributes
incrementMethod

Increments the counter. Should be called when new instruction leaves fetch stage.

decrementMethod

Decrements the counter, and returns if the counter will be equal to zero after that cycle (it was the last instruction in core and no new instruction is fetched). Should be called when instruction is retired.

__init__(gen_params: GenParams)

coreblocks.priv.traps.interrupt_controller module

class coreblocks.priv.traps.interrupt_controller.InternalInterruptController

Bases: Component

Core Internal Interrupt Controller Compatible with RISC-V privileged specification. Operates on CSR registers xIE, xIP, and parts of xSTATUS. Interrups are reported via plain signals in Component interface.

Attributes
internal_report_level: In, 16

Level-triggered input for interrupts with numbers 0-15, assigned by spec for standard interrupts (internal use)

custom_report: In, interrupt_custom_count

Input for reporting custom/local interrupts starting with number 16. Each custom interrupt can be either level-triggered or edge-triggered, configured by CoreConfigration. See interrupt_custom_count and interrupt_custom_edge_trig_mask in CoreConfigration.

interrupt_insert: Out, 1

Internal interface, signals pending interrupt.

entry: Method

Internal interface, changes state to interrupt handler entry.

mret: Method

Internal interface, changes state to interrupt handler exit.

interrupt_cause: Method

Internal interface, provides number of the most prioritized interrupt that caused current interrupt insertion.

__init__(gen_params: GenParams)
custom_report: Signal
internal_report_level: Signal

Module contents