ParallelPrefixDecr constructor

ParallelPrefixDecr(
  1. Logic inp, {
  2. ParallelPrefix ppGen(
    1. List<Logic>,
    2. Logic (
      1. Logic,
      2. Logic
      )
    ) = KoggeStone.new,
  3. String name = 'parallel_prefix_decr',
})

Decrement constructor

Implementation

ParallelPrefixDecr(Logic inp,
    {ParallelPrefix Function(List<Logic>, Logic Function(Logic, Logic))
        ppGen = KoggeStone.new,
    super.name = 'parallel_prefix_decr'}) {
  inp = addInput('inp', inp, width: inp.width);
  final u = ppGen((~inp).elements, (lhs, rhs) => rhs & lhs);
  addOutput('out', width: inp.width) <=
      (List<Logic>.generate(
              inp.width, (i) => ((i == 0) ? ~inp[i] : inp[i] ^ u.val[i - 1]))
          .rswizzle());
}