run method
- 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));
await sIntf.resetN.nextPosedge;
// handle reset
sIntf.resetN.negedge.listen((event) {
_pendingReadRequests.clear();
_pendingReadResponseData.clear();
});
sIntf.clk.posedge.listen((event) {
// read request monitoring
if (rIntf.arValid.previousValue!.isValid &&
rIntf.arReady.previousValue!.isValid &&
rIntf.arValid.previousValue!.toBool() &&
rIntf.arReady.previousValue!.toBool()) {
_pendingReadRequests.add(
Axi4ReadRequestPacket(
addr: rIntf.arAddr.previousValue!,
prot: rIntf.arProt.previousValue!,
id: rIntf.arId?.previousValue,
len: rIntf.arLen?.previousValue,
size: rIntf.arSize?.previousValue,
burst: rIntf.arBurst?.previousValue,
lock: rIntf.arLock?.previousValue,
cache: rIntf.arCache?.previousValue,
qos: rIntf.arQos?.previousValue,
region: rIntf.arRegion?.previousValue,
user: rIntf.arUser?.previousValue,
),
);
_pendingReadResponseData.add([]);
}
// read response data monitoring
if (rIntf.rValid.previousValue!.isValid &&
rIntf.rReady.previousValue!.isValid &&
rIntf.rValid.previousValue!.toBool() &&
rIntf.rReady.previousValue!.toBool()) {
var targIdx = 0;
if (rIntf.rId != null) {
targIdx = _pendingReadRequests.indexWhere((element) =>
element.id!.toInt() == rIntf.rId!.previousValue!.toInt());
}
if (targIdx >= 0 && _pendingReadRequests.length > targIdx) {
_pendingReadResponseData[targIdx].add(rIntf.rData.previousValue!);
if (rIntf.rLast?.value.toBool() ?? true) {
add(_pendingReadRequests[targIdx]
..complete(
data: _pendingReadResponseData[targIdx],
resp: rIntf.rResp?.previousValue,
user: rIntf.rUser?.previousValue,
));
_pendingReadRequests.removeAt(targIdx);
_pendingReadResponseData.removeAt(targIdx);
}
}
}
});
}