[libre-riscv-dev] partitioned compare and mux

Jacob Lifshay programmerjake at gmail.com
Fri Feb 7 18:06:06 GMT 2020


On Fri, Feb 7, 2020, 07:42 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:

> ok so i think we're good there.  would you like to tackle __neg__,
> __sub__, and __invert__?  __invert__ is dead-easy, __neg__ and __sub__
> will need the PartitionedAdder except perhaps doing a "subtract" mode
> to it.  line 199:
>
> https://git.libre-riscv.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/part_mul_add/adder.py;h=0c28e6c4be4b6930c227b7614df025fa10399132;hb=HEAD#l199
>
> just a mode-flag to PartitionedAdder "if self.subtract: return a - b
> else return a + b"
>

For the signed multiply I just used the identity a - b = a + ~b + 1 where 1
is carry-in.

Rather than adding subtract and negate modes, i think it would be more
worthwhile to implement carry-in/carry-out.

Jacob


More information about the libre-riscv-dev mailing list