fromLogicValue method

GfValue fromLogicValue(
  1. LogicValue value
)

Creates a field element from a two-state value.

Implementation

GfValue fromLogicValue(LogicValue value) {
  if (value.width != degree) {
    throw RohdHclException(
        'GF(2^$degree) values must have width $degree, not ${value.width}.');
  }
  if (!value.isValid) {
    throw RohdHclException('Finite-field values cannot contain x or z.');
  }
  return element(value.toBigInt());
}