toLogicValue method

LogicValue toLogicValue({
  1. int? width,
})

Returns the packed coefficients as a two-state LogicValue.

If provided, width may zero-extend the natural packedWidth, but may not truncate a non-zero coefficient.

Implementation

LogicValue toLogicValue({int? width}) {
  final resultWidth = width ?? packedWidth;
  if (resultWidth < packedWidth) {
    throw RohdHclException(
        'Width $resultWidth cannot contain a binary polynomial requiring '
        '$packedWidth bits.');
  }
  return LogicValue.ofBigInt(coefficients, resultWidth);
}