CaseAssociativeMemoryModelDescription constructor

CaseAssociativeMemoryModelDescription({
  1. required int entryCount,
  2. required int keyWidth,
  3. required List<int> updateIndexWidths,
  4. required List<int> lookupIndexWidths,
  5. required bool trackValidity,
})

Creates immutable exact-case associative memory geometry.

Implementation

CaseAssociativeMemoryModelDescription({
  required this.entryCount,
  required this.keyWidth,
  required List<int> updateIndexWidths,
  required List<int> lookupIndexWidths,
  required this.trackValidity,
})  : updateIndexWidths = List.unmodifiable(updateIndexWidths),
      lookupIndexWidths = List.unmodifiable(lookupIndexWidths) {
  final minimumIndexWidth = (entryCount - 1).bitLength;
  if (entryCount < 1 ||
      keyWidth < 1 ||
      lookupIndexWidths.isEmpty ||
      [...updateIndexWidths, ...lookupIndexWidths]
          .any((width) => width < 1 || width < minimumIndexWidth)) {
    throw ArgumentError('Invalid exact-case associative geometry.');
  }
}