SparseMemoryStorage class

A sparse storage for memory models.

Inheritance

Constructors

SparseMemoryStorage({required int addrWidth, required int dataWidth, LogicValue alignAddress(LogicValue addr)?, LogicValue onInvalidRead(LogicValue addr, int dataWidth)?, void onInvalidWrite()? = _defaultOnInvalidWrite})
Constructs a new sparse memory storage with specified addrWidth for all addresses.

Properties

addrWidth int
The width of addresses.
finalinherited
alignAddress LogicValue Function(LogicValue addr)
A function to align addresses when used for transactions.
finalinherited
dataWidth int
The width of data.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Returns true if there is no data stored in this memory.
no setteroverride
onInvalidRead LogicValue Function(LogicValue addr, int dataWidth)
A function called if a read is made to an address that has no data.
finalinherited
onInvalidWrite → void Function()
A function called if an invalid write is made when not isEmpty.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getData(LogicValue addr) LogicValue?
Returns the data at addr, or null if it is not present.
override
invalidWrite() → void
Triggers behavior associated with an invalid write, including calling onInvalidWrite and resetting all of memory.
inherited
loadMemHex(String hexMemContents) → void
Reads a verilog-compliant hex file and preloads memory with it.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readData(LogicValue addr) LogicValue
Aligns the address with alignAddress, then returns either the getData result in storage or else onInvalidRead's result.
inherited
reset() → void
Resets all memory to initial state.
override
setData(LogicValue addr, LogicValue data) → void
Loads data into addr directly into storage.
override
toString() String
A string representation of this object.
inherited
writeData(LogicValue addr, LogicValue data) → void
Performs some validation on a write, aligns the address with alignAddress, and then calls setData.
inherited

Operators

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