IndexedRecoveryEventDecorator<LogicType extends Logic> constructor
Creates a combinational indexed recovery-event decorator.
Implementation
IndexedRecoveryEventDecorator({
required LogicType data,
required Logic index,
required this.entryCount,
super.name = 'indexed_recovery_event_decorator',
}) : super(
definitionName:
'IndexedRecoveryEventDecorator_E${entryCount}_W${data.width}_'
'${payloadShapeIdentity(data)}',
) {
if (entryCount < 1 || index.width != widthFor(entryCount)) {
throw ArgumentError(
'Entry count must be positive and index width must match it.',
);
}
this.data = addTypedInput('data', data);
this.index = addInput('index', index, width: index.width);
event = addTypedPayloadOutput(
this,
'recoveryEvent',
RecoveryEvent<LogicType>(
this.data.cloneTyped(),
indexWidth: index.width,
),
);
event.data <= this.data;
event.index <= this.index;
event.finalEntry <= this.index.eq(entryCount - 1);
event.writeEnable <= Const(1);
}