RetirementSelector<LogicType extends Logic> constructor
Creates an ordered retirement join driven by a retire action.
Implementation
RetirementSelector({
required Logic orderValid,
required Logic orderTag,
required Logic completionValid,
required TaggedCompletion<LogicType> completion,
required Logic retire,
super.name = 'retirement_selector',
}) : tagWidth = completion.tagWidth,
super(
definitionName: 'RetirementSelector_'
'W${completion.data.width}_TW${completion.tagWidth}_'
'${payloadShapeIdentity(completion)}',
) {
if (orderTag.width != tagWidth) {
throw ArgumentError('Order and completion tag widths must match.');
}
final localOrderValid = addInput('orderValid', orderValid);
final localOrderTag = addInput('orderTag', orderTag, width: tagWidth);
final localCompletionValid = addInput('completionValid', completionValid);
final localCompletion = addTypedInput('completion', completion);
final localRetire = addInput('retire', retire);
final tagsMatch =
localOrderTag.eq(localCompletion.tag).named('${name}_tags_match');
addOutput('retirementValid') <=
localOrderValid & localCompletionValid & tagsMatch;
final retired =
(retirementValid & localRetire).named('${name}_completion_retired');
retirement = addTypedPayloadOutput(this, 'retirement', localCompletion)
..gets(localCompletion);
addOutput('canTakeCompletion') <= localRetire & localOrderValid & tagsMatch;
addOutput('canReleaseOrder') <= retired & localCompletion.finalBeat;
addOutput('completionWithoutOrder') <=
localCompletionValid & ~localOrderValid;
addOutput('tagMismatch') <=
localCompletionValid & localOrderValid & ~tagsMatch;
}