addStopSignFlip method

void addStopSignFlip(
  1. List<Logic> addend,
  2. SignBit sign
)

Helper function for sign extension routines: For signed operands, flip the MSB, otherwise add this sign bit.

Implementation

void addStopSignFlip(List<Logic> addend, SignBit sign) {
  if (!signedMultiplicand) {
    if (selectSignedMultiplicand == null) {
      addend.add(sign);
    } else {
      addend.add(SignBit(mux(selectSignedMultiplicand!, ~addend.last, sign),
          inverted: selectSignedMultiplicand != null));
    }
  } else {
    addend.last = SignBit(~addend.last, inverted: true);
  }
}