ParallelPrefixAdder constructor
Adder constructor
Implementation
ParallelPrefixAdder(super.a, super.b,
{ParallelPrefix Function(List<Logic>, Logic Function(Logic, Logic))
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_adder'}) {
final u = ppGen(
List<Logic>.generate(
a.width, (i) => [a[i] & b[i], a[i] | b[i]].swizzle()),
(lhs, rhs) => [rhs[1] | rhs[0] & lhs[1], rhs[0] & lhs[0]].swizzle());
sum <=
[
u.val[a.width - 1][1],
List<Logic>.generate(a.width,
(i) => (i == 0) ? a[i] ^ b[i] : a[i] ^ b[i] ^ u.val[i - 1][1])
.rswizzle()
].swizzle();
}