public static BitVector construct(IntToken bitwidth, IntToken value, TermContext context) {
   try {
     return BitVector.of(value.bigIntegerValue(), bitwidth.intValue());
   } catch (ArithmeticException e) {
     throw new IllegalArgumentException(e);
   }
 }
 public static FloatToken int2float(
     IntToken term, IntToken precision, IntToken exponent, TermContext context) {
   return FloatToken.of(
       new BigFloat(
           term.bigIntegerValue(),
           new BinaryMathContext(precision.intValue(), exponent.intValue())),
       exponent.intValue());
 }
 public static BuiltinList toDigits(
     BitVector term, IntToken bitwidth, IntToken count, TermContext context) {
   if (bitwidth.intValue() > 0 && bitwidth.intValue() * count.intValue() <= term.bitwidth) {
     BuiltinList.Builder builder = BuiltinList.builder(context);
     builder.addItems(term.toDigits(bitwidth.intValue(), count.intValue()));
     return (BuiltinList) builder.build();
   } else {
     return null;
   }
 }
 /**
  * Rounds {@code term} to the specfiied precision and exponent range.
  *
  * <p>Method is undefined if either integer is less than 2 because 2 is the minimum precision and
  * exponent. Two exponents must be used to store zero/subnormal/infinity/nan, so 4 is the minimum
  * number of distinct exponents a float can have. MPFR does not support floats with 1 bit of
  * precision. bits of the float.
  */
 public static FloatToken round(
     FloatToken term, IntToken precision, IntToken exponent, TermContext context) {
   if (precision.intValue() < 2 || exponent.intValue() < 2) {
     return null;
   }
   return FloatToken.of(
       term.bigFloatValue()
           .round(new BinaryMathContext(precision.intValue(), exponent.intValue())),
       exponent.intValue());
 }
 public static IntToken bitwidth(Term term, TermContext context) {
   if (term instanceof BitVector) {
     return IntToken.of(((BitVector) term).bitwidth());
   } else {
     Integer bitwidth = BitVector.getBitwidth(term);
     if (bitwidth == null) {
       return null;
     }
     return IntToken.of(bitwidth);
   }
 }
  public void initialize() throws IllegalActionException {
    super.initialize();

    IntToken it = (IntToken) LS0Bytes.getToken();
    _LS0Bytes = it.intValue();

    BooleanToken _bt = (BooleanToken) LS0Map.getToken();
    _LS0Map = _bt.booleanValue();

    it = (IntToken) S.getToken();
    _S = it.intValue();

    _fastReg = 0;
    _interReg = 0;
    _frameCounter = 0;

    _checkParameters();
  }
 public static IntToken uvalue(BitVector term, TermContext context) {
   return IntToken.of(term.unsignedValue());
 }
 public static BitVector extract(
     BitVector term, IntToken beginIndex, IntToken endIndex, TermContext context) {
   return term.extract(beginIndex.intValue(), endIndex.intValue());
 }
 public static IntToken exponentBits(FloatToken term, TermContext context) {
   return IntToken.of(term.exponent());
 }
 public static IntToken exponent(FloatToken term, TermContext context) {
   BinaryMathContext mc = getMathContext(term);
   return IntToken.of(term.bigFloatValue().exponent(mc.minExponent, mc.maxExponent));
 }
 public static IntToken precision(FloatToken term, TermContext context) {
   return IntToken.of(term.bigFloatValue().precision());
 }
 public static FloatToken minValue(
     IntToken precision, IntToken exponentBits, TermContext context) {
   BinaryMathContext mc = new BinaryMathContext(precision.intValue(), exponentBits.intValue());
   return FloatToken.of(BigFloat.minValue(mc.precision, mc.minExponent), exponentBits.intValue());
 }
 /**
  * Rounds {@code term} to an integer by truncating it. Function is only defined on ordinary
  * numbers (i.e. not NaN or infinity).
  */
 public static IntToken float2int(FloatToken term, TermContext context) {
   return IntToken.of(
       term.bigFloatValue()
           .rint(getMathContext(term).withRoundingMode(RoundingMode.DOWN))
           .toBigIntegerExact());
 }
 public static FloatToken root(FloatToken term1, IntToken term2, TermContext context) {
   return FloatToken.of(
       term1.bigFloatValue().root(term2.intValue(), getMathContext(term1)), term1.exponent());
 }