SynchronousParallelAssociativeMemory<KeyType extends Logic> constructor

SynchronousParallelAssociativeMemory<KeyType extends Logic>({
  1. required Logic clk,
  2. required Logic reset,
  3. required List<AssociativeUpdatePortInterface> updatePorts,
  4. required List<SynchronousAssociativeLookupPortInterface> lookupPorts,
  5. required int entryCount,
  6. required AssociativeMemoryContract contract,
  7. String name = 'synchronous_parallel_associative_memory',
})

Creates a fixed-latency parallel-flop associative memory.

Implementation

SynchronousParallelAssociativeMemory({
  required super.clk,
  required super.reset,
  required List<AssociativeUpdatePortInterface> updatePorts,
  required List<SynchronousAssociativeLookupPortInterface> lookupPorts,
  required super.entryCount,
  required super.contract,
  super.name = 'synchronous_parallel_associative_memory',
}) : super(
        updatePorts: updatePorts,
        lookupPorts: lookupPorts,
        definitionName: 'SynchronousParallelAssociativeMemory_'
            'U${updatePorts.length}_Q${lookupPorts.length}_E${entryCount}_'
            'K${lookupPorts.first.keyWidth}_L${contract.lookupLatency}_'
            '${contract.lookupUpdatePolicy.name}_'
            '${contract.matchSelection.name}_'
            '${contract.updateCollisionPolicy.name}_'
            '${contract.resultShape.name}',
      ) {
  if (contract.implementationKind !=
      AssociativeMemoryImplementationKind.synthesizable) {
    throw ArgumentError('SynchronousParallelAssociativeMemory requires a '
        'synthesizable contract.');
  }
  if (updateLatency != 0) {
    throw ArgumentError('SynchronousParallelAssociativeMemory commits '
        'updates on the sampling edge.');
  }
  if (contract.duplicateKeyPolicy != AssociativeDuplicateKeyPolicy.allow) {
    throw ArgumentError('SynchronousParallelAssociativeMemory does not '
        'enforce unique keys.');
  }
  if (contract.lookupUpdatePolicy ==
      AssociativeLookupUpdatePolicy.undefined) {
    throw ArgumentError('SynchronousParallelAssociativeMemory requires an '
        'explicit lookup/update policy.');
  }
  if (contract.updateCollisionPolicy ==
      AssociativeUpdateCollisionPolicy.disallow) {
    throw ArgumentError('SynchronousParallelAssociativeMemory requires '
        'deterministic update-port precedence.');
  }
  if (contract.resetBehavior !=
      AssociativeMemoryResetBehavior.clearValidity) {
    throw ArgumentError('SynchronousParallelAssociativeMemory clears entry '
        'validity on reset.');
  }

  _buildLogic();
}