run method

  1. @override
Future<void> run(
  1. Phase phase
)
override

Executes this Component's activities related to running the test.

Overrides of run must call super.run in an unawaited fashion. For example:

@override
Future<void> run(Phase phase) async {
  unawaited(super.run(phase));
  // New code goes here!
}

Implementation

@override
Future<void> run(Phase phase) async {
  unawaited(super.run(phase));

  final channels = <Axi4ChannelInterface>[
    ace.read.arIntf,
    ace.read.rIntf,
    ace.write.awIntf,
    ace.write.wIntf,
    ace.write.bIntf,
    ace.snoop.acIntf,
    ace.snoop.crIntf,
    ace.snoop.cdIntf,
  ];
  final stalled = <Axi4ChannelInterface, Map<String, LogicValue?>>{};
  while (!Simulator.simulationHasEnded) {
    await sIntf.clk.nextPosedge;
    if (Simulator.simulationHasEnded) {
      return;
    }
    _cycle++;
    if (sIntf.resetN.previousValue != LogicValue.one) {
      stalled.clear();
      _snoops.clear();
      _dataResponses.clear();
      _earlyData.clear();
      _clearBurst();
      _reads.clear();
      _writes.clear();
      _readAcks.clear();
      _writeAcks.clear();
      continue;
    }

    for (final channel in channels) {
      final valid = channel.valid.previousValue == LogicValue.one;
      final previous = stalled.remove(channel);
      if (previous != null) {
        if (!valid) {
          _report('${channel.prefix}VALID dropped while stalled.');
        } else {
          for (final entry in previous.entries) {
            if (channel.port(entry.key).previousValue != entry.value) {
              _report('${entry.key} changed while stalled.');
            }
          }
        }
      }
      if (valid && channel.ready.previousValue == LogicValue.zero) {
        stalled[channel] = {
          for (final entry in channel.ports.entries)
            if (entry.key != '${channel.prefix}VALID' &&
                entry.key != '${channel.prefix}READY')
              entry.key: entry.value.previousValue,
        };
      }
    }

    final acLine = _offeredSnoopLine();
    _sampleAxiResponses(acLine);
    // Neither CR nor CD may use an address accepted on this edge.
    _sampleResponse();
    if (!ace.legacyMode) {
      _matchEarlyData();
      _sampleData();
      _matchEarlyData();
    }
    _sampleAddress(acLine);
    if (_cacheLineBytes != null) {
      _saveRequest(ace.read.arIntf, _reads);
      _saveRequest(ace.write.awIntf, _writes);
    }
  }
}