SynchronousMemoryRequest constructor
- required int dataWidth,
- required int addrWidth,
- required int entryCount,
- required int writePortCount,
- required int readPortCount,
- required List<
bool> maskedWritePorts, - required int readLatency,
- required SynchronousRamReadUnderWrite readUnderWrite,
- int writeLatency = 0,
- SynchronousMemoryResetBehavior requiredResetBehavior = SynchronousMemoryResetBehavior.none,
- ProtectedPartialWritePolicy protectedPartialWritePolicy = ProtectedPartialWritePolicy.none,
- SynchronousMemoryBankConflictPolicy bankConflictPolicy = SynchronousMemoryBankConflictPolicy.disallow,
- int bankCount = 1,
- SynchronousMemoryBankMapping bankMapping = SynchronousMemoryBankMapping.lowAddressBits,
Creates a synchronous-memory request.
Implementation
SynchronousMemoryRequest(
{required this.dataWidth,
required this.addrWidth,
required this.entryCount,
required this.writePortCount,
required this.readPortCount,
required List<bool> maskedWritePorts,
required this.readLatency,
required this.readUnderWrite,
this.writeLatency = 0,
this.requiredResetBehavior = SynchronousMemoryResetBehavior.none,
this.protectedPartialWritePolicy = ProtectedPartialWritePolicy.none,
this.bankConflictPolicy = SynchronousMemoryBankConflictPolicy.disallow,
this.bankCount = 1,
this.bankMapping = SynchronousMemoryBankMapping.lowAddressBits})
: maskedWritePorts = List.unmodifiable(maskedWritePorts) {
if (dataWidth < 1 || addrWidth < 1 || entryCount < 1) {
throw ArgumentError(
'Memory width, address width, and entry count must be '
'positive.');
}
if (bankCount < 1) {
throw ArgumentError.value(bankCount, 'bankCount', 'Must be positive.');
}
if (writePortCount < 0 ||
readPortCount < 0 ||
writePortCount + readPortCount == 0) {
throw ArgumentError('A memory request requires at least one port.');
}
if (this.maskedWritePorts.length != writePortCount) {
throw ArgumentError('maskedWritePorts must describe every write port.');
}
if (readLatency < 1 || writeLatency < 0) {
throw ArgumentError('Read latency must be positive and write latency '
'must not be negative.');
}
if ((BigInt.one << addrWidth) < BigInt.from(entryCount)) {
throw ArgumentError(
'Address width $addrWidth cannot represent entry count '
'$entryCount.');
}
if (protectedPartialWritePolicy != ProtectedPartialWritePolicy.none &&
!maskedWritePorts.contains(true)) {
throw ArgumentError(
'A protected partial-write policy requires a masked write port.');
}
}