ofInt static method

LogicValue ofInt(
  1. int value,
  2. int width
)

Converts int value to a valid LogicValue with width number of bits.

width must be greater than or equal to 0.

Implementation

static LogicValue ofInt(int value, int width) => width > INT_BITS
    ? _bigLogicValueOrFilled(
        BigInt.from(value).toUnsigned(INT_BITS), BigInt.zero, width)
    : _smallLogicValueOrFilled(value, 0, width);