[libre-riscv-dev] simple-barrel-processor is up

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sun Mar 10 13:43:50 GMT 2019


https://salsa.debian.org/Kazan-team/simple-barrel-processor/blob/master/alu.py

looks really good.  real simple, straightforward and obvious what's
going on, even without comments and docstrings.

self._shamt and everything else beginning with _ can be moved into the
elaborate function, and turned into local variables (no need to make
them members of the class, at all).

btw i ran the yosys graph "show", and noticed that sltu and slt are
separate modules.  this means that rather than there being one (rather
large) variable-width left-shifter, there's two, where only one of
them will ever be active at any one time.

i appreciate that one of them is an arithmetic shift whilst the other
is not: however with variable-width shifting being so large in terms
of gates, is there a way to do the sign-extension as a separate
follow-up operation?

i've found myself doing something similar quite a lot: creating
classes to represent modules, then using them with alternative
arguments, only to realise when viewing the graphviz representation
that it's resulted in duplicated near-identical blocks of gates.

i identified and explained (in a boring droning voice) in this video
https://www.youtube.com/watch?v=DsnoDN6NfmA that this is something we
will have to watch out for.

l.



More information about the libre-riscv-dev mailing list