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 value, required bool signed, required int m, required int n})
Constructs FixedPointValue from sign, integer and fraction values.
FixedPointValue.ofDouble(double val, {required bool signed, required int m, required int n})
Constructs FixedPointValue of a Dart double rounding away from zero.
factory

Properties

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

Methods

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.
expandWidth({required bool sign, int m = 0, int n = 0}) LogicValue
Expands the bit width of integer and fractional parts.
isNegative() bool
Returns true if the number is negative.
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
A string representation of this object.
inherited

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.