DependencyTracker<LogicType extends Logic> constructor
- required Logic clk,
- required Logic reset,
- required ReadyValidInterface<
DependencyOperand< load,LogicType> > - required List<
ReadyValidInterface< wakeups,WakeupEvent< >LogicType> > - required ReadyValidInterface<
WakeupInvalidation> invalidation, - String name = 'dependency_tracker',
Creates a dependency tracker.
Implementation
DependencyTracker({
required Logic clk,
required Logic reset,
required ReadyValidInterface<DependencyOperand<LogicType>> load,
required List<ReadyValidInterface<WakeupEvent<LogicType>>> wakeups,
required ReadyValidInterface<WakeupInvalidation> invalidation,
super.name = 'dependency_tracker',
}) : wakeupLaneCount = wakeups.length,
super(
definitionName: 'DependencyTracker_'
'N${wakeups.length}_W${load.data.data.width}_'
'T${load.data.tagWidth}_'
'${payloadShapesIdentity([
load.data.data,
...wakeups.map((port) => port.data.data)
])}',
) {
if (wakeups.isEmpty) {
throw ArgumentError.value(
wakeups, 'wakeups', 'Must contain at least one wakeup lane.');
}
for (final wakeup in wakeups) {
if (wakeup.data.tagWidth != load.data.tagWidth) {
throw ArgumentError(
'Wakeup tag and data widths must match the loaded operand.');
}
if (!rohdPayloadsCompatible([
load.data.data,
...wakeups.map((port) => port.data.data),
], ignoreConstantNames: true)) {
throw ArgumentError(
'Wakeup and dependency payloads must be compatible.');
}
wakeup.requireProviderComposableWith(ReadyValidContract.readyAndValid,
consumerName: name);
}
if (invalidation.data.tagWidth != load.data.tagWidth) {
throw ArgumentError('Invalidation and dependency tag widths must match.');
}
load.requireProviderComposableWith(ReadyValidContract.readyAndValid,
consumerName: name);
invalidation.requireProviderComposableWith(ReadyValidContract.readyAndValid,
consumerName: name);
final localClk = addInput('clk', clk);
final localReset = addInput('reset', reset);
this.load = addPairInterface(load, PairRole.consumer,
uniquify: (original) => 'load_$original');
this.wakeups = [
for (var index = 0; index < wakeups.length; index++)
addPairInterface(wakeups[index], PairRole.consumer,
uniquify: (original) => 'wakeup_${index}_$original')
];
this.invalidation = addPairInterface(invalidation, PairRole.consumer,
uniquify: (original) => 'invalidation_$original');
operand = addTypedPayloadOutput(this, 'operand', this.load.data);
addOutput('multipleMatchingWakeups');
addOutput('rebusied');
this.load.ready <= Const(1);
this.invalidation.ready <= Const(1);
for (final wakeup in this.wakeups) {
wakeup.ready <= Const(1);
}
final transition = dependencyTransition(
stored: operand,
incoming: this.load.data,
loadAccepted: this.load.accepted,
updateEnabled: Const(1),
wakeups: this.wakeups,
invalidation: this.invalidation,
name: name);
multipleMatchingWakeups <= transition.multipleMatchingWakeups;
rebusied <= transition.rebusied;
Sequential(localClk, reset: localReset, resetValues: {
operand.data: 0,
operand.tag: 0,
operand.ready: 0,
operand.speculative: 0,
}, [
operand < transition.next,
]);
}