SignedShifter constructor
Create a SignedShifter that treats shift as signed
bits
is the input to be shiftedshift
is the signed amount to be shifted
Implementation
SignedShifter(Logic bits, Logic shift,
{super.name = 'shifter',
super.reserveName,
super.reserveDefinitionName,
String? definitionName})
: super(
definitionName: definitionName ?? 'SignedShifter_W${bits.width}') {
bits = addInput('bits', bits, width: bits.width);
shift = addInput('shift', shift, width: shift.width);
addOutput('shifted', width: bits.width);
shifted <= mux(shift[-1], bits >>> shift.abs(), bits << shift);
}