ReadyValidStorageQueue<LogicType extends Logic> constructor
- required Logic clk,
- required Logic reset,
- required ReadyValidInterface<
LogicType> upstream, - required ReadyValidInterface<
LogicType> downstream, - required int storageDepth,
- int requestedStorageLatency = 1,
- int outputBufferDepth = 1,
- ReadyValidStorageQueueFunctor<
LogicType> ? storageImplementation, - int? almostFullThreshold,
- int? almostEmptyThreshold,
- Logic? flush,
- String name = 'ready_valid_storage_queue',
Creates a queue from a resolved storage implementation.
Implementation
factory ReadyValidStorageQueue(
{required Logic clk,
required Logic reset,
required ReadyValidInterface<LogicType> upstream,
required ReadyValidInterface<LogicType> downstream,
required int storageDepth,
int requestedStorageLatency = 1,
int outputBufferDepth = 1,
ReadyValidStorageQueueFunctor<LogicType>? storageImplementation,
int? almostFullThreshold,
int? almostEmptyThreshold,
Logic? flush,
String name = 'ready_valid_storage_queue'}) {
final selectedStorage = storageImplementation ??
readyValidPortableStorageQueueImplementation<LogicType>();
final storageBinding = selectedStorage.resolve(
ReadyValidStorageQueueRequest(
dataWidth: upstream.data.width,
depth: storageDepth,
requestedOutputLatency: requestedStorageLatency));
final resolvedFullThreshold = almostFullThreshold ??
storageBinding.contract.capacity + outputBufferDepth;
return ReadyValidStorageQueue<LogicType>._(
clk: clk,
reset: reset,
upstream: upstream,
downstream: downstream,
storageDepth: storageDepth,
requestedStorageLatency: requestedStorageLatency,
outputBufferDepth: outputBufferDepth,
storageImplementation: selectedStorage,
storageBinding: storageBinding,
almostFullThreshold: almostFullThreshold,
almostEmptyThreshold: almostEmptyThreshold,
flush: flush,
name: name,
definitionName: 'ReadyValidStorageQueue_D${storageDepth}_'
'L${requestedStorageLatency}_B${outputBufferDepth}_'
'S${selectedStorage.identity}_'
'AF${resolvedFullThreshold}_'
'AE${almostEmptyThreshold ?? 0}_'
'${flush == null ? 'NoFlush' : 'Flush'}_${upstream.data.name}_'
'${payloadShapesIdentity([upstream.data, downstream.data])}');
}