[libre-riscv-dev] div/mod algorithm written in python

Luke Kenneth Casson Leighton lkcl at lkcl.net
Tue Jul 23 22:30:33 BST 2019


ok so i managed to indentify that pass_flags is unary-encoded and is a
priority unary-encoding.  that means that PriorityEncoder can be used
to turn pass_flags (unary) into next_bits (binary), and that a nmigen
Array can then be used to select the compare_rhs.  yosys knows to use
a "PMUX" for this.

looks much cleaner code, and the graphviz is a *lot* cleaner.  all the
XORs are gone.   by also moving stuff to a new class, Trial, a whooole
stack of magic constants that were a dog's dinner mess are also gone
from the top-level, and each "Trial" instance is now way, waaay
cleaner as well.

l.



More information about the libre-riscv-dev mailing list