SharedStorageQueue<LogicType extends Logic> constructor

SharedStorageQueue<LogicType extends Logic>({
  1. required Logic clk,
  2. required Logic reset,
  3. required Logic push,
  4. required Logic pushChannel,
  5. required LogicType pushData,
  6. required Logic pop,
  7. required Logic channelEnable,
  8. int entryCount = 32,
  9. MemoryConfiguration? memoryConfiguration,
  10. bool? behavioralControl,
  11. SharedStorageOccupancyObserver? occupancyObserver,
  12. 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();
}