signExtend method

LogicValue signExtend(
  1. int newWidth
)

Returns a new LogicValue with width newWidth where new bits added are sign bits as the most significant bits. The sign is determined using two's complement, so it takes the most significant bit of the original value and extends with that.

The newWidth must be greater than or equal to the current width or an exception will be thrown.

Implementation

LogicValue signExtend(int newWidth) => extend(newWidth, this[width - 1]);