adjacentErrorMasks function

List<LogicValue> adjacentErrorMasks(
  1. int width,
  2. int length
)

Generates masks containing one adjacent run of length set bits.

Implementation

List<LogicValue> adjacentErrorMasks(int width, int length) {
  _validateWidth(width);
  if (length < 1 || length > width) {
    throw RohdHclException('Adjacent run length must be within the width.');
  }
  return [
    for (var start = 0; start <= width - length; start++)
      LogicValue.ofBigInt(
          ((BigInt.one << length) - BigInt.one) << start, width),
  ];
}