FixedPointValue.withSignedness constructor

FixedPointValue.withSignedness({
  1. required LogicValue integer,
  2. required LogicValue fraction,
  3. bool signed = true,
})

Constructs FixedPointValue from integer and fraction values with a signed option to interpret the MSB of integer as a two's-complement sign bit.

Implementation

factory FixedPointValue.withSignedness(
        {required LogicValue integer,
        required LogicValue fraction,
        bool signed = true}) =>
    populatorWithSignedness(
            integerWidth: integer.width - (signed ? 1 : 0),
            fractionWidth: fraction.width,
            signed: signed)
        .populate(integer: integer, fraction: fraction);