LtiSubordinateLrChannelAgent constructor
- required Axi5SystemInterface sys,
- required LtiLrChannelInterface lr,
- required Component parent,
- String name = 'ltiSubordinateLrChannelAgent',
- int? timeoutCycles,
- int? dropDelayCycles,
Constructs a new LtiSubordinateLrChannelAgent.
Implementation
LtiSubordinateLrChannelAgent({
required this.sys,
required this.lr,
required Component parent,
String name = 'ltiSubordinateLrChannelAgent',
this.timeoutCycles,
this.dropDelayCycles,
}) : super(name, parent) {
// credit tracking per virtual channel
for (var i = 0; i < lr.vcCount; i++) {
_creditCounts.add(0);
}
sequencer = Sequencer<LtiLrChannelPacket>(
'ltiSubordinateLrChannelAgentSequencer', this);
driver = LtiLrChannelDriver(
parent: this,
sys: sys,
lr: lr,
sequencer: sequencer,
timeoutCycles: timeoutCycles,
dropDelayCycles: dropDelayCycles,
hasCredits: (vc) => _creditCounts[vc] > 0,
updateCredits: (vc) => _creditCounts[vc]--,
);
monitor = LtiCreditMonitor(sys: sys, trans: lr, parent: this);
// credit returns
monitor.stream.listen((c) {
final lv = LogicValue.ofInt(c.credit, lr.vcCount);
for (var i = 0; i < lv.width; i++) {
if (lv[i].toBool()) {
_creditCounts[i]++;
}
}
});
}