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.new({required LogicValue integer, required LogicValue fraction, 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.
factory
FixedPointValue.uninitialized({bool signed = false})
Creates an unpopulated version of a FixedPointValue, intended to be called with the populator.

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
eq(FixedPointValue other) LogicValue
Equal-to operation that returns a LogicValue.
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.
neq(FixedPointValue other) LogicValue
Not equal-to operation that returns a LogicValue.
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.
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) LogicValue
Less-than operation that returns a LogicValue.
operator <=(FixedPointValue other) LogicValue
Less-than operation that returns a LogicValue.
operator ==(Object other) bool
The equality operator.
override
operator >(FixedPointValue other) LogicValue
Less-than operation that returns a LogicValue.
operator >=(FixedPointValue other) LogicValue
Less-than operation that returns a LogicValue.

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.