[libre-riscv-dev] partitioned compare and mux

Luke Kenneth Casson Leighton lkcl at lkcl.net
Fri Feb 7 20:59:10 GMT 2020


On Friday, February 7, 2020, Jacob Lifshay <programmerjake at gmail.com> wrote:

> On Fri, Feb 7, 2020 at 11:12 AM Luke Kenneth Casson Leighton
> <lkcl at lkcl.net> wrote:
> >
> > On Fri, Feb 7, 2020 at 6:06 PM Jacob Lifshay <programmerjake at gmail.com>
> wrote:
> >
> > > Rather than adding subtract and negate modes, i think it would be more
> > > worthwhile to implement carry-in/carry-out.
> >
> > because carry-in would be the "+1".  and ~b is just a straight
> bit-invert.
>
> My point is that subtract and negate are kind-of special cases of
> addition, it seems better to generalize all the way to add with
> carry-in/out and then build a PartitionedAddSub built around the
> extended PartitionedAdder that does the carry-in (with it optional for
> borrow-in)


we're going to need this for Power, they have carry in and out

so would that make sense to be just two bits extra, one at the LSB, one at
the MSB?

the A being Cat(0, actual_a, carryin) err maybe the other way round
(carryin, actual_a, 0)

and the B being (0, actual_b, 0)

then the output is result[1:-2] and the carryout us result[-1]

something like that?

and per-element selectable b inversion. yosys would just
> simplify the resulting gates (a trivial transformation of ~0 xor b to
> ~b) for cases where it always subtracts.


ok so a selectable Const from the constructor, you mean?  do we need a
"dynamic" add/sub or is it enough to have something that generates optimal
static code

is this making any sense, michael? :)

l.



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


More information about the libre-riscv-dev mailing list