ReadyValidQueueBank<LogicType extends Logic> constructor
- required Logic clk,
- required Logic reset,
- required ReadyValidInterface<
PoolRequest< enqueue,LogicType> > - required List<
ReadyValidInterface< downstreams,LogicType> > - required int storageDepth,
- List<
int> ? storageDepths, - int requestedStorageLatency = 1,
- int outputBufferDepth = 1,
- ReadyValidStorageQueueFunctor<
LogicType> ? storageImplementation, - Logic? flush,
- String name = 'ready_valid_queue_bank',
Creates a bank of independently readable queues.
Implementation
factory ReadyValidQueueBank({
required Logic clk,
required Logic reset,
required ReadyValidInterface<PoolRequest<LogicType>> enqueue,
required List<ReadyValidInterface<LogicType>> downstreams,
required int storageDepth,
List<int>? storageDepths,
int requestedStorageLatency = 1,
int outputBufferDepth = 1,
ReadyValidStorageQueueFunctor<LogicType>? storageImplementation,
Logic? flush,
String name = 'ready_valid_queue_bank',
}) {
if (downstreams.isEmpty) {
throw ArgumentError.value(
downstreams, 'downstreams', 'Must not be empty.');
}
final resolvedDepths =
storageDepths ?? List.filled(downstreams.length, storageDepth);
if (resolvedDepths.length != downstreams.length ||
resolvedDepths.any((depth) => depth < 1)) {
throw ArgumentError.value(storageDepths, 'storageDepths',
'Must provide one positive depth for each queue.');
}
if (requestedStorageLatency < 1 || outputBufferDepth < 0) {
throw ArgumentError('requestedStorageLatency must be positive and '
'outputBufferDepth must not be negative.');
}
final selectedImplementation = storageImplementation ??
readyValidPortableStorageQueueImplementation<LogicType>();
final bindings = [
for (final depth in resolvedDepths)
selectedImplementation.resolve(
ReadyValidStorageQueueRequest(
dataWidth: enqueue.data.data.width,
depth: depth,
requestedOutputLatency: requestedStorageLatency,
),
),
];
return ReadyValidQueueBank<LogicType>._(
clk: clk,
reset: reset,
enqueue: enqueue,
downstreams: downstreams,
storageDepths: resolvedDepths,
requestedStorageLatency: requestedStorageLatency,
outputBufferDepth: outputBufferDepth,
storageImplementation: selectedImplementation,
storageBindings: bindings,
flush: flush,
name: name,
);
}