[libre-riscv-dev] Priority Encoder

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat May 16 18:40:15 BST 2020

On Saturday, May 16, 2020, Yehowshua <yimmanuel3 at gatech.edu> wrote:

> Ah. Thanks.

nmigen Encoder (unary onehot to binary) and Decoder (binary to unary
onehot) back to back is called a PriorityPicker.

do it exactly like that and you end up with significantly suboptimal output
from yosys due to the use of an unnecessary pmux, created by the use of an
Encoder, that yosys cannot in any way optimise out, even if you flatten the
two modules.

this is why nmutil PriorityPicker exists *and is not based on Encoder or

yosys does a fantastic job of flattening nmutil PriorityPicker down to only
a 3 gate path, even for as high as 16 inputs-outputs.

this is on a par with the kind of gate level optimisation that Mitch Alsup
carries out in his designs.

yes, there was a discussion about that on comp.arch a couple months ago.


crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68

More information about the libre-riscv-dev mailing list