AddressedMemoryImage<DataType extends Object> constructor

AddressedMemoryImage<DataType extends Object>({
  1. required int depth,
  2. required int dataWidth,
  3. required Map<int, DataType> entries,
})

Creates an addressed-memory image.

Implementation

AddressedMemoryImage({
  required this.depth,
  required this.dataWidth,
  required Map<int, DataType> entries,
}) : entries = Map.unmodifiable(entries) {
  if (depth <= 0 || dataWidth <= 0) {
    throw ArgumentError('Memory depth and data width must be positive.');
  }
  if (this.entries.keys.any((address) => address < 0 || address >= depth)) {
    throw ArgumentError(
        'Memory entries must address words within the depth.');
  }
}