schoeberl / chisel-book

Digital Design with Chisel
752 stars 141 forks source link

Tree reduction proposal #31

Closed tjarker closed 2 years ago

tjarker commented 2 years ago

This tree reduction implementation uses grouped(2) to extract pairs from the main sequence. If the number of elements is uneven, grouped will include one sequence with a single item. This removes the need to handle that case explicitly.

Using the implicit class SeqToTreeReducible, we can now call the treeReduce function on all sequences.

The names should probably be different to avoid confusion with chisels reduceTree function :)

schoeberl commented 2 years ago

OK, nice! Also nice that you did the implicit thing, which I had planned as well. However, I assume your solution suffers the same issue as mine, a node might be promoted more than once. Try it with 5 and you will see.