restore method

void restore(
  1. InferredSramImage image
)

Atomically restores an array and read result with matching port schemas.

Implementation

void restore(InferredSramImage image) {
  if (image._entryCount != entryCount ||
      image._addressWidth != addrWidth ||
      image._dataWidth != dataWidth ||
      !samePayloadSchemas(
          image._schemas, [wrPorts.single.data, rdPorts.single.data]) ||
      image._output.width != dataWidth ||
      image._storage.uncertainWrites.isNotEmpty ||
      image._storage.entries.keys
          .any((address) => address >= BigInt.from(entryCount))) {
    throw ArgumentError.value(image, 'image', 'Incompatible SRAM state.');
  }
  _raw.load(image._storage, replace: true);
  _resetSeen = image._resetSeen;
  putPackedLogicValue(_readValue, image._output);
}