Axi5ChannelChecker constructor

Axi5ChannelChecker({
  1. required Axi5SystemInterface sys,
  2. required Axi5TransportInterface channel,
  3. required Component? parent,
  4. bool reportViolations = true,
  5. String? name,
})

Checks channel without changing its drivers or receivers.

Implementation

Axi5ChannelChecker({
  required this.sys,
  required this.channel,
  required Component? parent,
  this.reportViolations = true,
  String? name,
}) : super(name ?? 'axi5${channel.prefix}ChannelChecker', parent) {
  if (channel is! Axi5ArChannelInterface &&
      channel is! Axi5AwChannelInterface &&
      channel is! Axi5WChannelInterface &&
      channel is! Axi5RChannelInterface &&
      channel is! Axi5BChannelInterface) {
    throw ArgumentError('Expected an AXI5 AR, AW, W, R, or B channel.');
  }

  final reset = ~sys.resetN;
  final flow = channel.creditFlow;
  if (flow != null) {
    final checker = _creditChecker = CreditChannelChecker(
      'credit',
      this,
      clk: sys.clk,
      reset: reset,
      debit: flow.debit,
      creditReturn: flow.creditReturn,
      configuration: CreditChannelCheckConfiguration.uniform(
          poolCount: flow.poolCount,
          initialCredits: 0,
          maximumCredits: Axi5TransportInterface.maxCreditsPerPool),
      endpoint: channel.prefix,
      reportViolations: false,
    );
    checker.violationStream.listen((violation) => _record('$violation'));
  } else {
    _creditChecker = null;
    final payload = channel
        .getPorts([
          if (channel.main)
            PairDirection.fromProvider
          else
            PairDirection.fromConsumer,
        ])
        .values
        .where((port) => !identical(port, channel.valid))
        .toList();
    ReadyValidChannelChecker<Logic, LogicValue>(
      'readyValid',
      this,
      clk: sys.clk,
      reset: reset,
      ready: channel.ready!,
      valid: channel.valid,
      data: payload.isEmpty ? Const(0) : payload.rconcat(),
      codec: LogicValueReadyValidChannelCodec<Logic>(),
      configuration: ReadyValidChannelCheckConfiguration(
        transfersForbiddenDuringReset: false,
        validMustRemainAssertedWhileStalled: true,
        payloadMustRemainStableWhileStalled: true,
      ),
      endpoint: channel.prefix,
      reportViolations: false,
    ).violationStream.listen((violation) => _record('$violation'));
  }
}