muxAbsoluteAll method

void muxAbsoluteAll(
  1. int row,
  2. int col,
  3. Logic condition,
  4. List<Logic> list,
)

Mux the range of values into the row starting at absolute position (row, col) using condition to select the new value

Implementation

void muxAbsoluteAll(int row, int col, Logic condition, List<Logic> list) {
  var i = col - rowShift[row];
  final product = partialProducts[row];
  for (final val in list) {
    if (product.length > i) {
      if (val is SignBit || product[i] is SignBit) {
        var inv = false;
        if (val is SignBit) {
          inv = val.inverted;
        }
        if (product[i] is SignBit) {
          inv = (product[i] as SignBit).inverted;
        }
        product[i] = SignBit(mux(condition, val, product[i]), inverted: inv);
      } else {
        product[i] = mux(condition, val, product[i]);
      }
      i++;
    } else {
      while (product.length < i) {
        product.add(Const(0));
      }
      if (val is SignBit) {
        product.add(
            SignBit(mux(condition, val, Const(0)), inverted: val.inverted));
      } else {
        product.add(mux(condition, val, Const(0)));
      }
      i++;
    }
  }
}