SharedStorageQueue<LogicType extends Logic> constructor
- required Logic clk,
- required Logic reset,
- required Logic push,
- required Logic pushChannel,
- required LogicType pushData,
- required Logic pop,
- required Logic channelEnable,
- int entryCount = 32,
- MemoryConfiguration? memoryConfiguration,
- bool? behavioralControl,
- SharedStorageOccupancyObserver? occupancyObserver,
- String name = 'shared_storage_queue',
The channelEnable should be a numChannels-wide bit-vector where
each bit indicates whether that channel is allowed to be selected from.
memoryConfiguration selects the storage backing, defaulting to
MemoryConfigurationScope.current. behavioralControl replaces the
control and storage with the cycle-equivalent model; it defaults to
true with a MemoryBacking.model backing. Pass false to keep the
structural control around model-backed register files.
Implementation
SharedStorageQueue({
required Logic clk,
required Logic reset,
required Logic push,
required Logic pushChannel,
required LogicType pushData,
required Logic pop,
required Logic channelEnable,
this.entryCount = 32,
this.memoryConfiguration,
bool? behavioralControl,
this.occupancyObserver,
super.name = 'shared_storage_queue',
}) : numChannels = channelEnable.width,
indexWidth = entryCount.log2Ceil,
behavioralControl = behavioralControl ??
resolveMemoryConfiguration(memoryConfiguration).backing ==
MemoryBacking.model {
if (entryCount < 2) {
throw ArgumentError.value(
entryCount,
'entryCount',
'Must be at least 2.',
);
}
this.clk = addInput('clk', clk);
this.reset = addInput('reset', reset);
this.push = addInput('push', push);
this.pushChannel = addInput(
'pushChannel',
pushChannel,
width: pushChannel.width,
);
this.pushData = addTypedInput('pushData', pushData);
addOutput('pushIndex', width: indexWidth);
this.pop = addInput('pop', pop);
addOutput('popChannel', width: pushChannel.width);
popData = addTypedOutput(
'popData',
pushData.clone as LogicType Function({String name}),
);
addOutput('popIndex', width: indexWidth);
addOutput('popValid');
addOutput('occupiedChannels', width: numChannels);
this.channelEnable = addInput(
'channelEnable',
channelEnable,
width: numChannels,
);
buildLogic();
}