ParallelPrefixPriorityEncoder constructor
Build a PriorityEncoder using a ParallelPrefix tree.
ppGen
is the type of ParallelPrefix tree to use
Implementation
ParallelPrefixPriorityEncoder(super.inp,
{ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.valid,
super.name = 'parallel_prefix_encoder'})
: super(definitionName: 'ParallelPrefixPriorityEncoder_W${inp.width}') {
final sz = log2Ceil(inp.width + 1);
final u = ParallelPrefixPriorityFinder(inp, ppGen: ppGen);
final pos = OneHotToBinary(u.out)
.binary
.zeroExtend(sz)
.named('pos', naming: Naming.mergeable);
if (valid != null) {
valid! <= pos.or() | inp[0];
}
out <=
mux(pos.or() | inp[0], pos, Const(inp.width + 1, width: sz))
.named('encoded_pos', naming: Naming.mergeable);
}