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 random = Test.random ?? Random();
  valid.inject(0);
  await reset.nextNegedge;

  var cycle = 0;
  while (!Simulator.simulationHasEnded) {
    final mayOffer =
        activity?.isActive(cycle) ?? random.nextDouble() >= blockRate;
    if (pendingSeqItems.isEmpty || !mayOffer) {
      valid.inject(0);
      await clk.nextPosedge;
      cycle++;
      continue;
    }

    final transfer = pendingSeqItems.first;
    valid.inject(1);
    codec.drive(data, transfer.payload);
    do {
      await clk.nextPosedge;
      cycle++;
    } while (!Simulator.simulationHasEnded && !_wasAccepted());
    if (!Simulator.simulationHasEnded) {
      pendingSeqItems.removeFirst();
    }
  }
}