LogicValue class Null safety

An immutable 4-value representation of an arbitrary number of bits.

Each bit of LogicValue can be represented as a LogicValue of 0, 1, x (contention), or z (floating).

Annotations

Properties

bit LogicValue
The current active value of this, if it has width 1, as a LogicValue.
@Deprecated('Check `width` separately to see if single-bit.'), read-only
hashCode int
The hash code for this object.
read-only, override
isFloating bool
True iff all bits are z.
read-only
isValid bool
True iff all bits are 0 or 1, not a single x or z.
read-only
length int
The number of bits in this LogicValue.
@Deprecated('Use `width` instead.'), read-only
reversed LogicValue
Returns a new LogicValue with the order of all bits in the reverse order of this LogicValue
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
width int
The number of bits in this LogicValue.
final

Methods

and() LogicValue
Unary AND operation.
eq(dynamic other) LogicValue
Equal-to operation.
extend(int newWidth, LogicValue fill) LogicValue
Returns a new LogicValue with width newWidth where the most significant bits for indices beyond the original width are set to fill.
getRange(int startIndex, int endIndex) LogicValue
Returns a subset LogicValue. It is inclusive of startIndex, exclusive of endIndex.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
or() LogicValue
Unary OR operation.
signExtend(int newWidth) LogicValue
Returns a new LogicValue with width newWidth where new bits added are sign bits as the most significant bits. The sign is determined using two's complement, so it takes the most significant bit of the original value and extends with that.
slice(int endIndex, int startIndex) LogicValue
Accesses a subset of this LogicValue from startIndex to endIndex, both inclusive.
toBigInt() BigInt
Converts valid a LogicValue to an int.
toBool() bool
Converts a valid logical value to a boolean.
toInt() int
Converts valid a LogicValue to an int.
toList() List<LogicValue>
Returns a this LogicValue as a List<LogicValue> where every element is 1 bit.
toString({bool includeWidth = true}) String
Converts this LogicValue to a binary String, including a decorator at the front in SystemVerilog style.
override
withSet(int startIndex, LogicValue update) LogicValue
Returns a copy of this LogicValue with the bits starting from startIndex up until startIndex + update.width set to update instead of their original value.
xor() LogicValue
Unary XOR operation.
zeroExtend(int newWidth) LogicValue
Returns a new LogicValue with width newWidth where new bits added are zeros as the most significant bits.

Operators

operator %(dynamic other) LogicValue
Modulo operation.
operator &(LogicValue other) LogicValue
Bitwise AND operation.
operator *(dynamic other) LogicValue
Multiplication operation.
operator +(dynamic other) LogicValue
Addition operation.
operator -(dynamic other) LogicValue
Subtraction operation.
operator /(dynamic other) LogicValue
Division operation.
operator <(dynamic other) LogicValue
Less-than operation.
operator <<(dynamic shamt) LogicValue
Logical left-shift operation.
operator <=(dynamic other) LogicValue
Less-than-or-equal operation.
operator ==(Object other) bool
Returns true iff the width and all bits of this are equal to other.
override
operator >(dynamic other) LogicValue
Greater-than operation.
operator >=(dynamic other) LogicValue
Greater-than-or-equal operation.
operator >>(dynamic shamt) LogicValue
Arithmetic right-shift operation.
operator >>>(dynamic shamt) LogicValue
Logical right-shift operation.
operator [](int index) LogicValue
Returns the ith bit of this LogicValue
operator ^(LogicValue other) LogicValue
Bitwise XOR operation.
operator |(LogicValue other) LogicValue
Bitwise OR operation.
operator ~() LogicValue
Returns a new LogicValue with every bit inverted.

Static Methods

filled(int width, LogicValue fill) LogicValue
Constructs a LogicValue with the width number of bits, where every bit has the same value of fill.
from(Iterable<LogicValue> it) LogicValue
Constructs a LogicValue from it.
@Deprecated('Use `of` instead.')
fromBigInt(BigInt value, int width) LogicValue
Converts BigInt value to a valid LogicValue with width number of bits.
@Deprecated('Use `ofBigInt` instead.')
fromBool(bool value) LogicValue
Converts bool value to a valid LogicValue with 1 bits either one or zero.
@Deprecated('Use `ofBool` instead.')
fromInt(int value, int width) LogicValue
Converts int value to a valid LogicValue with width number of bits.
@Deprecated('Use `ofInt` instead.')
fromString(String stringRepresentation) LogicValue
Converts a binary String representation of a LogicValue into a LogicValue.
@Deprecated('Use `ofString` instead.')
isNegedge(LogicValue previousValue, LogicValue newValue, {bool ignoreInvalid = false}) bool
Returns true iff the transition represents a negative edge.
isPosedge(LogicValue previousValue, LogicValue newValue, {bool ignoreInvalid = false}) bool
Returns true iff the transition represents a positive edge.
of(Iterable<LogicValue> it) LogicValue
Constructs a LogicValue from it.
ofBigInt(BigInt value, int width) LogicValue
Converts BigInt value to a valid LogicValue with width number of bits.
ofBool(bool value) LogicValue
Converts bool value to a valid LogicValue with 1 bits either one or zero.
ofInt(int value, int width) LogicValue
Converts int value to a valid LogicValue with width number of bits.
ofString(String stringRepresentation) LogicValue
Converts a binary String representation of a LogicValue into a LogicValue.

Constants

empty → const LogicValue
A zero-width value.
_FilledLogicValue(_LogicValueEnum.zero, 0)
one → const LogicValue
Logical value of 1.
_FilledLogicValue(_LogicValueEnum.one, 1)
x → const LogicValue
Logical value of x.
_FilledLogicValue(_LogicValueEnum.x, 1)
z → const LogicValue
Logical value of z.
_FilledLogicValue(_LogicValueEnum.z, 1)
zero → const LogicValue
Logical value of 0.
_FilledLogicValue(_LogicValueEnum.zero, 1)