FloatingPointConditionalSwap<FpType extends FloatingPoint> constructor
Constructs a FloatingPointConditionalSwap module that swaps two floating
point values based on the doSwap
condition.
Implementation
FloatingPointConditionalSwap(
super.a,
super.b,
Logic doSwap, {
super.metaA,
super.metaB,
super.name = 'floating_point_conditional_swap',
super.reserveName,
super.reserveDefinitionName,
String? definitionName,
}) : super(
definitionName: definitionName ?? 'FloatingPointSwap_W${a.width}') {
this.doSwap = addInput('swap', doSwap);
final (swapA, swapB) = swap(this.doSwap, (super.a, super.b));
output('outA') <= swapA;
output('outB') <= swapB;
if ((metaA != null) & (metaB != null)) {
final (swapMetaA, swapMetaB) =
swap(this.doSwap, (super.metaA!, super.metaB!));
output('outMetaA') <= swapMetaA;
output('outMetaB') <= swapMetaB;
}
}