FixedPointValue constructor

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

Constructs FixedPointValue from integer and fraction values with a signed option to interpret MSB of integer as sign bit with the integer represented in twos-complement.

Implementation

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