restorePortableExecutionImage method

void restorePortableExecutionImage(
  1. String text
)

Restores an execution image when the external clock phase matches.

Implementation

void restorePortableExecutionImage(String text) {
  if (Simulator.phase != SimulatorPhase.outOfTick) {
    throw StateError('SRAM execution images require a tick boundary.');
  }
  final tokens = text.trim().split(RegExp(r'\s+'));
  if (tokens.length < 4 ||
      tokens[0] != 'RHCL_SRAM_EXEC_V1' ||
      (tokens[1] != '0' && tokens[1] != '1') ||
      (tokens[2] != '0' && tokens[2] != '1')) {
    throw const FormatException('Invalid SRAM execution header.');
  }
  if (!clk.value.isValid || MemoryValueCodec.binary(clk.value) != tokens[1]) {
    throw StateError('SRAM execution image clock does not match.');
  }
  restorePortableSnapshot(tokens.skip(3).join(' '));
  _resetSeen = tokens[2] == '1';
}