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));

  var wasInReset = false;
  while (!Simulator.simulationHasEnded) {
    await sys.clk.nextPosedge;
    if (Simulator.simulationHasEnded) {
      return;
    }
    final inReset = sys.resetN.previousValue != LogicValue.one;
    if (inReset && !wasInReset) {
      for (final channel in _channels) {
        channel.clear();
      }
    } else if (!inReset && !wasInReset) {
      for (final channel in _channels) {
        for (final failure in channel.sample(sys, _cycle)) {
          _failures.add(failure);
          if (reportViolations) {
            logger.severe('$failure '
                'Expected: ${failure.expected}; actual: ${failure.actual}.');
          }
        }
      }
    }
    wasInReset = inReset;
    _cycle++;
  }
}