FixedPointValue constructor

FixedPointValue({
  1. required LogicValue value,
  2. required bool signed,
  3. required int m,
  4. required int n,
})

Constructs FixedPointValue from sign, integer and fraction values.

Implementation

FixedPointValue(
    {required this.value,
    required this.signed,
    required this.m,
    required this.n}) {
  if (value == LogicValue.empty) {
    throw RohdHclException('Zero width is not allowed.');
  }
  final w = signed ? m + n + 1 : m + n;
  if (w != value.width) {
    throw RohdHclException('Width must be (sign) + m + n.');
  }
}