restoreExecution method

void restoreExecution(
  1. CsrModelExecutionImage image
)

Restores an execution image created by this model at a tick boundary.

Implementation

void restoreExecution(CsrModelExecutionImage image) {
  if (Simulator.phase != SimulatorPhase.outOfTick) {
    throw StateError('CSR execution restore requires a tick boundary.');
  }
  if (!identical(image._owner, this)) {
    throw ArgumentError('CSR execution image belongs to another model.');
  }
  for (final entry in image._registers.entries) {
    if (_at(entry.key).config.width != entry.value.width) {
      throw ArgumentError('CSR execution image has invalid register widths.');
    }
  }
  for (final entry in image._registers.entries) {
    _registers[entry.key]!.value = entry.value;
  }
  _sampled
    ..clear()
    ..addAll(image._sampled);
  _deferred
    ..clear()
    ..addAll(image._deferred);
  _racing
    ..clear()
    ..addAll(image._racing);
  _activeHardwareWrites
    ..clear()
    ..addAll(image._activeHardwareWrites);
  _deferredHardware
    ..clear()
    ..addAll(image._deferredHardware);
  _clockChanged = image._clockChanged;
  _resetChanged = image._resetChanged;
  _oldClock = image._oldClock;
  _oldReset = image._oldReset;
  _resetSeen = image._resetSeen;
  _driveRead();
  _driveHardware();
}