StorageQueue<LogicType extends Logic> constructor

StorageQueue<LogicType extends Logic>({
  1. required Logic clk,
  2. required Logic reset,
  3. required Logic enqueue,
  4. required LogicType enqueueData,
  5. required Logic dequeue,
  6. required int storageDepth,
  7. int requestedStorageLatency = 1,
  8. int outputBufferDepth = 1,
  9. ReadyValidStorageQueueFunctor<LogicType>? storageImplementation,
  10. int? almostFullThreshold,
  11. int? almostEmptyThreshold,
  12. Logic? flush,
  13. String name = 'storage_queue',
})

Creates a queue driven by enqueue and dequeue actions, resolving storageImplementation for storageDepth entries of enqueueData.

Implementation

factory StorageQueue({
  required Logic clk,
  required Logic reset,
  required Logic enqueue,
  required LogicType enqueueData,
  required Logic dequeue,
  required int storageDepth,
  int requestedStorageLatency = 1,
  int outputBufferDepth = 1,
  ReadyValidStorageQueueFunctor<LogicType>? storageImplementation,
  int? almostFullThreshold,
  int? almostEmptyThreshold,
  Logic? flush,
  String name = 'storage_queue',
}) {
  if (storageDepth < 1 ||
      requestedStorageLatency < 1 ||
      outputBufferDepth < 0) {
    throw ArgumentError('storageDepth and requestedStorageLatency must be '
        'positive; outputBufferDepth must not be negative.');
  }
  final selectedStorage = storageImplementation ??
      readyValidPortableStorageQueueImplementation<LogicType>();
  return StorageQueue<LogicType>.fromBinding(
    clk: clk,
    reset: reset,
    enqueue: enqueue,
    enqueueData: enqueueData,
    dequeue: dequeue,
    storageBinding: selectedStorage.resolve(ReadyValidStorageQueueRequest(
        dataWidth: enqueueData.width,
        depth: storageDepth,
        requestedOutputLatency: requestedStorageLatency)),
    outputBufferDepth: outputBufferDepth,
    almostFullThreshold: almostFullThreshold,
    almostEmptyThreshold: almostEmptyThreshold,
    flush: flush,
    name: name,
  );
}