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) {
_pendingWriteRequests.clear();
});
sIntf.clk.posedge.listen((event) {
// write request monitoring
if (wIntf.awValid.previousValue!.isValid &&
wIntf.awReady.previousValue!.isValid &&
wIntf.awValid.previousValue!.toBool() &&
wIntf.awReady.previousValue!.toBool()) {
_pendingWriteRequests.add(
Axi4WriteRequestPacket(
addr: wIntf.awAddr.previousValue!,
prot: wIntf.awProt.previousValue!,
id: wIntf.awId?.previousValue,
len: wIntf.awLen?.previousValue,
size: wIntf.awSize?.previousValue,
burst: wIntf.awBurst?.previousValue,
lock: wIntf.awLock?.previousValue,
cache: wIntf.awCache?.previousValue,
qos: wIntf.awQos?.previousValue,
region: wIntf.awRegion?.previousValue,
user: wIntf.awUser?.previousValue,
data: [],
strobe: []),
);
}
// write data monitoring
// NOTE: not dealing with WLAST here b/c it is implicit in how the interface behaves
if (wIntf.wValid.previousValue!.isValid &&
wIntf.wReady.previousValue!.isValid &&
wIntf.wValid.previousValue!.toBool() &&
wIntf.wReady.previousValue!.toBool()) {
final targIdx = _pendingWriteRequests.length - 1;
_pendingWriteRequests[targIdx].data.add(wIntf.wData.previousValue!);
_pendingWriteRequests[targIdx].strobe.add(wIntf.wStrb.previousValue!);
_pendingWriteRequests[targIdx].wUser = wIntf.wUser?.previousValue;
}
// write response monitoring
if (wIntf.bValid.previousValue!.isValid &&
wIntf.bReady.previousValue!.isValid &&
wIntf.bValid.previousValue!.toBool() &&
wIntf.bReady.previousValue!.toBool()) {
var targIdx = 0;
if (wIntf.bId != null) {
targIdx = _pendingWriteRequests.indexWhere((element) =>
element.id!.toInt() == wIntf.bId!.previousValue!.toInt());
}
if (targIdx >= 0 && _pendingWriteRequests.length > targIdx) {
add(_pendingWriteRequests[targIdx]
..complete(
resp: wIntf.bResp?.previousValue,
user: wIntf.bUser?.previousValue,
));
_pendingWriteRequests.removeAt(targIdx);
}
}
});
}