ldpcAbsoluteMagnitude function

Logic ldpcAbsoluteMagnitude(
  1. Logic value,
  2. String name
)

Returns the unsigned magnitude of a two's-complement LDPC message.

Implementation

Logic ldpcAbsoluteMagnitude(Logic value, String name) {
  final negated =
      ((~value) + Const(1, width: value.width)).getRange(0, value.width);
  return mux(value[-1], negated, value).named(name);
}