createModule method

  1. @override
Module createModule()
override

Creates a Module instance as configured.

Implementation

@override
Module createModule() {
  final loadCount = max(1, loadCountKnob.value);
  final addressWidth = max(1, addressWidthKnob.value);
  final byteCount = max(1, byteCountKnob.value);
  final sequenceWidth = max(2, sequenceWidthKnob.value);
  final maximumAllowedLive = (1 << (sequenceWidth - 1)) - 1;
  final maximumLiveEntries =
      min(max(1, maximumLiveEntriesKnob.value), maximumAllowedLive);
  return MemoryViolationDetector(
    storeValid: Logic(name: 'storeValid'),
    storeAddress: Logic(name: 'storeAddress', width: addressWidth),
    storeByteEnable: Logic(name: 'storeByteEnable', width: byteCount),
    storeSequence: Logic(name: 'storeSequence', width: sequenceWidth),
    loadValid: Logic(name: 'loadValid', width: loadCount),
    loadExecuted: Logic(name: 'loadExecuted', width: loadCount),
    loadAddressValid: Logic(name: 'loadAddressValid', width: loadCount),
    loadAddresses: [
      for (var index = 0; index < loadCount; index++)
        Logic(name: 'loadAddress$index', width: addressWidth)
    ],
    loadByteEnables: [
      for (var index = 0; index < loadCount; index++)
        Logic(name: 'loadByteEnable$index', width: byteCount)
    ],
    loadSequences: [
      for (var index = 0; index < loadCount; index++)
        Logic(name: 'loadSequence$index', width: sequenceWidth)
    ],
    maximumLiveEntries: maximumLiveEntries,
  );
}