symbolErrorMasks function

List<LogicValue> symbolErrorMasks(
  1. int width,
  2. int symbolWidth
)

Generates one mask for each symbol selected by symbolWidth.

Each returned mask corrupts every bit in one symbol lane.

Implementation

List<LogicValue> symbolErrorMasks(int width, int symbolWidth) {
  _validateWidth(width);
  if (symbolWidth < 1 || width % symbolWidth != 0) {
    throw RohdHclException(
        'symbolWidth must be a positive divisor of the data width.');
  }
  final symbolMask = (BigInt.one << symbolWidth) - BigInt.one;
  return [
    for (var start = 0; start < width; start += symbolWidth)
      LogicValue.ofBigInt(symbolMask << start, width),
  ];
}