RegisterFileRequest constructor
- required int entryCount,
- required List<
DataPortInterface< writePorts,Logic> > - required List<
DataPortInterface< readPorts,Logic> > - required RegisterFileReadUnderWrite readUnderWrite,
- required RegisterFileWriteConflictResolution writeConflictResolution,
Creates and validates a register-file request.
Implementation
RegisterFileRequest({
required this.entryCount,
required List<DataPortInterface> writePorts,
required List<DataPortInterface> readPorts,
required this.readUnderWrite,
required this.writeConflictResolution,
}) : dataWidth = _firstRegisterFilePort(writePorts, readPorts).dataWidth,
addrWidth = _firstRegisterFilePort(writePorts, readPorts).addrWidth,
readPortCount = readPorts.length,
writePortCount = writePorts.length,
usesMaskedWrites = writePorts.any(
(port) => port is MaskedDataPortInterface,
) {
if (entryCount < 1) {
throw ArgumentError.value(entryCount, 'entryCount', 'Must be positive.');
}
if ([...writePorts, ...readPorts].any(
(port) => port.dataWidth != dataWidth || port.addrWidth != addrWidth,
)) {
throw ArgumentError('All register-file ports must have matching widths.');
}
if (entryCount > (1 << addrWidth)) {
throw ArgumentError('The address width cannot represent every entry.');
}
}