FixedPointValue class

An immutable representation of (un)signed fixed-point values following Q notation (Qm.n format) as introduced by Texas Instruments: (https://www.ti.com/lit/ug/spru565b/spru565b.pdf).

Implemented types
Annotations

Constructors

FixedPointValue({required LogicValue integer, required LogicValue fraction, bool signed = false})
Constructs an unsigned FixedPointValue from integer and fraction.
factory
FixedPointValue.uninitialized({bool signed = false})
Creates an unpopulated version of a FixedPointValue, intended to be called with the populator.
FixedPointValue.uninitializedWithSignedness({bool signed = true})
Creates an unpopulated FixedPointValue with the specified signedness.
FixedPointValue.withSignedness({required LogicValue integer, required LogicValue fraction, 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.
factory

Properties

fraction ↔ LogicValue
The fractional value portion.
latefinal
fractionWidth ↔ int
fractionWidth is the number of bits reserved for the fractional part.
latefinal
hashCode → int
The hash code for this object.
no setteroverride
integer ↔ LogicValue
The integer valuue portion.
latefinal
integerWidth ↔ int
integerWidth is the number of bits reserved for the integer part.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
signed ↔ bool
signed indicates whether the representation is signed.
latefinal
value → LogicValue
The fixed point value bit storage in two's complement.
latefinal

Methods

clonePopulator() → FixedPointValuePopulator<FixedPointValue>
Creates a FixedPointValuePopulator for the same type as this and with the same widths.
compareTo(Object other) → int
Returns a negative integer if this less than other, a positive integer if this greater than other, and zero if this and other are equal.
override
gtBool(FixedPointValue other) → bool
Greater-than operation that returns a bool.
gteBool(FixedPointValue other) → bool
Greater-than-or-equal operation that returns a bool.
isNegative() → bool
Returns true if the number is negative.
ltBool(FixedPointValue other) → bool
Less-than operation that returns a bool.
lteBool(FixedPointValue other) → bool
Less-than-or-equal operation that returns a bool.
negate() → FixedPointValue
Negate operation for FixedPointValue.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDouble() → double
Converts a fixed-point value to a Dart double.
toFloatingPointValue() → FloatingPointValue
Losslessly converts this value to a minimal generic FloatingPointValue.
toLogic({String? name}) → FixedPoint
Converts this value to a constant FixedPoint signal.
toScaledBigInt() → ({int exponent, BigInt significand})
Returns this exact value as significand * 2^exponent.
toString() → String
Return a string representation of FixedPointValue. Return sign, integer, fraction as binary strings.
override

Operators

operator *(FixedPointValue other) → FixedPointValue
Multiplication operation that returns a FixedPointValue. The result is signed if one of the operands is signed. The result fraction width is the sum of fraction widths of operands.
operator +(FixedPointValue other) → FixedPointValue
Addition operation that returns a FixedPointValue. The result is signed if one of the operands is signed. The result integer has the max integer width of the operands plus one. The result fraction has the max fractional width of the operands.
operator -(FixedPointValue other) → FixedPointValue
Subtraction operation that returns a FixedPointValue. The result is always signed. The result integer has the max integer width of the operands plus one. The result fraction has the max fractional width of the operands.
operator /(FixedPointValue other) → FixedPointValue
Division operation that returns a FixedPointValue. The result is signed if one of the operands is signed. The result integer width is the sum of dividend integer width and divisor fraction width. The result fraction width is the sum of dividend fraction width and divisor integer width.
operator <(FixedPointValue other) → bool
Less-than operation.
operator <=(FixedPointValue other) → bool
Less-than-or-equal operation.
operator ==(Object other) → bool
The equality operator.
override
operator >(FixedPointValue other) → bool
Greater-than operation.
operator >=(FixedPointValue other) → bool
Greater-than-or-equal operation.

Static Methods

populator({required int integerWidth, required int fractionWidth, bool signed = false}) → FixedPointValuePopulator<FixedPointValue>
Creates a FixedPointValuePopulator with the provided integerWidth and fractionWidth, which can then be used to complete construction of a FixedPointValue using population functions.
populatorWithSignedness({required int integerWidth, required int fractionWidth, bool signed = true}) → FixedPointValuePopulator<FixedPointValue>
Creates a FixedPointValuePopulator with the provided widths and signedness.