load method

  1. @override
void load(
  1. Map<BigInt, LogicValue> values, {
  2. bool replace = false,
})
override

Loads validated raw state atomically.

With replace, unspecified registers take their architectural reset values. Otherwise they retain their state. Loading does not pulse command fields or perform W1C operations.

Implementation

@override
void load(Map<BigInt, LogicValue> values, {bool replace = false}) {
  for (final entry in values.entries) {
    if (_at(entry.key).config.width != entry.value.width) {
      throw ArgumentError('CSR value width does not match its register.');
    }
  }
  if (replace) {
    _resetState();
  }
  for (final entry in values.entries) {
    _registers[entry.key]!.value = normalizeStoredValue(entry.value);
  }
  _driveRead();
  _driveHardware(replace ? null : values.keys);
}