CsrModel class

Software-held state for a CSR top or block.

Addresses are the frontdoor's logical addresses (no implicit byte scaling). Inspection and loading bypass architectural write effects. Hardware frontdoor and backdoor writes retain their architectural semantics.

Implemented types

Constructors

CsrModel({required CsrModelDescription description, required Logic clk, required Logic reset, required DataPortInterface<Logic>? frontRead, required DataPortInterface<Logic>? frontWrite, required Map<BigInt, CsrBackdoorInterface> hardware})
Constructs the software state and attaches one shared clock handler.

Properties

description → CsrModelDescription
Frozen metadata shared with the portable SystemC generator.
final
hardwareRegisterCount → int
Number of hardware-connected registers.
no setter
hashCode → int
The hash code for this object.
no setterinherited
logicalRegisterIncrement → BigInt
Address increment between chunks of a register wider than a frontdoor.
no setter
registerCount → int
Number of registers held without signal-backed state.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stateTransactionCapabilities → StateTransactionCapabilities
Snapshot and restore behavior exposed by this component.
no setteroverride
stateTransactions → StateTransactionEndpoint<CsrModelExecutionImage>
Snapshot and restore endpoint.
latefinal

Methods

addressOf(String block, String register) → BigInt
Resolves a configured block/register name to its absolute logical address.
dispose() → Future<void>
Detaches simulation callbacks. Also called at simulation end.
generateModelSystemVerilog({required String moduleName}) → String
Emits a behavioral definition with the requested module name.
override
generateSystemC({required String className, SystemCModelOptions options = const SystemCModelOptions()}) → String
Emits a standalone SystemC definition using className.
override
load(Map<BigInt, LogicValue> values, {bool replace = false}) → void
Loads validated raw state atomically.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
peek(int address) → LogicValue
Inspects raw state without allocating any hardware signals.
override
peekBigInt(BigInt address) → LogicValue
Reads raw state at an arbitrary-width logical address.
override
poke(int address, LogicValue value) → void
Replaces raw state, bypassing frontdoor permissions and field effects.
override
pokeBigInt(BigInt address, LogicValue value) → void
Replaces raw state at an arbitrary-width logical address.
override
portableExecutionImage() → String
Captures a portable execution image at a settled, known clock phase.
portableSnapshot() → String
Encodes all raw register values for exchange with compatible CSR models.
restoreExecution(CsrModelExecutionImage image) → void
Restores an execution image created by this model at a tick boundary.
restorePortableExecutionImage(String image) → void
Restores a compatible portable execution image at the same clock phase.
restorePortableSnapshot(String image) → void
Restores a complete portable raw storage image after validating it.
snapshot() → Map<BigInt, LogicValue>
Captures all register state, keyed by absolute logical register address.
override
snapshotExecution() → CsrModelExecutionImage
Captures register state, sampled inputs, and pending simulator events.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited