OutOfOrderMemoryRecoveryEpochGuard constructor

OutOfOrderMemoryRecoveryEpochGuard({
  1. required Logic currentEpoch,
  2. required ReadyValidInterface<OutOfOrderMemoryRefillResponse> input,
  3. required ReadyValidInterface<OutOfOrderMemoryRefillResponse> output,
  4. String name = 'ooo_memory_recovery_epoch_guard',
})

Creates a recovery-epoch response guard.

Implementation

OutOfOrderMemoryRecoveryEpochGuard({
  required Logic currentEpoch,
  required ReadyValidInterface<OutOfOrderMemoryRefillResponse> input,
  required ReadyValidInterface<OutOfOrderMemoryRefillResponse> output,
  super.name = 'ooo_memory_recovery_epoch_guard',
}) : super(
        definitionName:
            'OutOfOrderMemoryRecoveryEpochGuard_E${currentEpoch.width}',
      ) {
  if (input.data.recoveryEpoch.width != currentEpoch.width ||
      output.data.recoveryEpoch.width != currentEpoch.width ||
      output.data.transactionTag.width != input.data.transactionTag.width ||
      output.data.lineAddress.width != input.data.lineAddress.width ||
      output.data.data.width != input.data.data.width) {
    throw ArgumentError('Recovery epoch guard payloads must match.');
  }
  output.validatePayloadCompatibility(input.data);

  final localEpoch =
      addInput('currentEpoch', currentEpoch, width: currentEpoch.width);
  ingress = addPairInterface(input, PairRole.consumer,
      uniquify: (original) => 'input_$original');
  downstream = addPairInterface(output, PairRole.provider,
      uniquify: (original) => 'output_$original');
  addOutput('staleResponse');

  final current = ingress.data.recoveryEpoch.eq(localEpoch);
  downstream.valid <= ingress.valid & current;
  downstream.data <= ingress.data;
  ingress.ready <= mux(current, downstream.ready, Const(1));
  staleResponse <= ingress.accepted & ~current;
}