restorePortableExecutionImage method
- String text
Restores a compatible execution image at a settled tick boundary.
The external clock must match the captured phase. External inputs and scheduled events remain the caller's responsibility.
Implementation
void restorePortableExecutionImage(String text) {
if (Simulator.phase != SimulatorPhase.outOfTick) {
throw StateError('Associative execution images require a tick boundary.');
}
final tokens = text.trim().split(RegExp(r'\s+'));
if (tokens.length < 4 ||
tokens[0] != description.portableExecutionIdentity ||
(tokens[1] != '0' && tokens[1] != '1') ||
(tokens[2] != '0' && tokens[2] != '1')) {
throw const FormatException('Invalid associative execution header.');
}
if (!clk.value.isValid || MemoryValueCodec.binary(clk.value) != tokens[1]) {
throw StateError('Execution image clock does not match.');
}
final image = AssociativeModelState.fromPortableString(
tokens.skip(3).join(' '),
keyWidth: keyWidth,
entryCount: entryCount);
_model.load(image, replace: true);
_resetSeen = tokens[2] == '1';
_refresh();
}