encodeWord method

Logic encodeWord(
  1. Logic logicalWord
)

Encodes a packed logical word one lane at a time.

Implementation

Logic encodeWord(Logic logicalWord) {
  if (logicalWord.width != logicalWidth) {
    throw RohdHclException(
        'Logical word width must equal $logicalWidth bits.');
  }
  final bits = logicalWord.packed;
  final lanes = [
    for (var lane = 0; lane < laneCount; lane++)
      laneCodec.encode(bits.slice((lane + 1) * laneCodec.logicalWidth - 1,
          lane * laneCodec.logicalWidth)),
  ];
  return lanes.reversed.toList().concat();
}