QueueBank<LogicType extends Logic> constructor

QueueBank<LogicType extends Logic>({
  1. required Logic clk,
  2. required Logic reset,
  3. required Logic enqueue,
  4. required Logic enqueueQueue,
  5. required LogicType enqueueData,
  6. required Logic dequeue,
  7. required List<int> storageDepths,
  8. int requestedStorageLatency = 1,
  9. int outputBufferDepth = 1,
  10. ReadyValidStorageQueueFunctor<LogicType>? storageImplementation,
  11. Logic? flush,
  12. String name = 'queue_bank',
})

Creates a bank with one queue for each of storageDepths, resolving storageImplementation once for every queue.

enqueueQueue is queueIndexWidth bits wide and dequeue has one bit for each queue.

Implementation

factory QueueBank({
  required Logic clk,
  required Logic reset,
  required Logic enqueue,
  required Logic enqueueQueue,
  required LogicType enqueueData,
  required Logic dequeue,
  required List<int> storageDepths,
  int requestedStorageLatency = 1,
  int outputBufferDepth = 1,
  ReadyValidStorageQueueFunctor<LogicType>? storageImplementation,
  Logic? flush,
  String name = 'queue_bank',
}) {
  if (storageDepths.isEmpty || storageDepths.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 selectedStorage = storageImplementation ??
      readyValidPortableStorageQueueImplementation<LogicType>();
  return QueueBank<LogicType>.fromBindings(
    clk: clk,
    reset: reset,
    enqueue: enqueue,
    enqueueQueue: enqueueQueue,
    enqueueData: enqueueData,
    dequeue: dequeue,
    storageBindings: [
      for (final depth in storageDepths)
        selectedStorage.resolve(ReadyValidStorageQueueRequest(
            dataWidth: enqueueData.width,
            depth: depth,
            requestedOutputLatency: requestedStorageLatency)),
    ],
    outputBufferDepth: outputBufferDepth,
    flush: flush,
    name: name,
  );
}