FloatingPointValue constructor
- required LogicValue sign,
- required LogicValue exponent,
- required LogicValue mantissa,
Constructor for a FloatingPointValue with a sign, exponent, and mantissa.
Implementation
@protected
FloatingPointValue(
{required this.sign, required this.exponent, required this.mantissa})
: value = [sign, exponent, mantissa].swizzle(),
_bias = computeBias(exponent.width),
_minExp = computeMinExponent(exponent.width),
_maxExp = computeMaxExponent(exponent.width) {
if (sign.width != 1) {
throw RohdHclException('FloatingPointValue: sign width must be 1');
}
if (constrainedMantissaWidth != null &&
mantissa.width != constrainedMantissaWidth) {
throw RohdHclException('FloatingPointValue: mantissa width must be '
'$constrainedMantissaWidth');
}
if (constrainedExponentWidth != null &&
exponent.width != constrainedExponentWidth) {
throw RohdHclException('FloatingPointValue: exponent width must be '
'$constrainedExponentWidth');
}
}