OneHotToBinary constructor

OneHotToBinary(
  1. Logic onehot, {
  2. bool generateError = false,
  3. String name = 'one_hot_to_binary',
})

By default, creates an instance of a CaseOneHotToBinary for smaller widths and a TreeOneHotToBinary for larger widths.

Implementation

factory OneHotToBinary(Logic onehot,
    {bool generateError = false, String name = 'one_hot_to_binary'}) {
  final isSmall = onehot.width <= 8;

  if (!isSmall && generateError) {
    throw RohdHclException(
        'Tree implementation does not generate error signal.');
  }

  return isSmall
      ? CaseOneHotToBinary(onehot, generateError: generateError, name: name)
      : TreeOneHotToBinary(onehot, name: name);
}