ParallelPrefixDecr constructor
Decrement constructor.
Implementation
ParallelPrefixDecr(Logic inp,
{ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_decr',
super.reserveName,
super.reserveDefinitionName,
String? definitionName})
: super(
definitionName:
definitionName ?? 'ParallelPrefixDecr_W${inp.width}') {
inp = addInput('inp', inp, width: inp.width);
final complement = (~inp).named('complement');
final u = ppGen(complement.elements, (lhs, rhs) => rhs & lhs);
addOutput('out', width: inp.width) <=
(List<Logic>.generate(
inp.width,
(i) => ((i == 0) ? complement[i] : inp[i] ^ u.val[i - 1])
.named('o_$i')).rswizzle());
}