StorageQueue<LogicType extends Logic> constructor
- 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',
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,
);
}