saturatingLdpcSignedDifference function
Subtracts signed subtrahend from minuend and saturates to width.
Implementation
Logic saturatingLdpcSignedDifference(
Logic minuend,
Logic subtrahend, {
required int width,
required String name,
}) {
final calculationWidth = width + 1;
final difference = (minuend.signExtend(calculationWidth) -
subtrahend.signExtend(calculationWidth))
.getRange(0, calculationWidth);
return NumericNarrowing(
difference,
outputWidth: width,
signed: true,
overflowMode: NumericOverflowMode.saturate,
name: '${name}_saturate',
).result.named(name);
}