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

  Simulator.injectAction(() {
    trans.credit!.put(0);
  });

  // wait for reset to complete before driving anything
  await sys.resetN.nextPosedge;

  // push the credit value onto the interface for exactly 1 cycle
  while (!Simulator.simulationHasEnded) {
    if (pendingSeqItems.isNotEmpty) {
      final crd = pendingSeqItems.removeFirst();
      Simulator.injectAction(() {
        trans.credit!.put(crd.credit);
      });
      await sys.clk.nextPosedge;
      Simulator.injectAction(() {
        trans.credit!.put(0);
      });
    } else {
      await sys.clk.nextPosedge;
    }
  }
}