[libre-riscv-dev] need help on working out a partitioned "eq"

Jacob Lifshay programmerjake at gmail.com
Fri Jan 24 16:22:22 GMT 2020


On Fri, Jan 24, 2020, 07:20 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:

> help, i'm stuck.
>
> https://git.libre-riscv.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/part_cmp/equal.py
>
> https://git.libre-riscv.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/part/test/test_partsig.py;h=32382117cb007705ce943edf4bcb84ed87ed89d7;hb=50b043f4867c422bee10f4acee2e2f99b1c4636d#l94
>
> the eq comparisons, like in PartitionedMul, need to start off as
> isolated comparisons (PartitionedMul starts off with isolated muls).
> from there, if the "mask gates" are open, then the output needs to
> only be set true if *all* of those (isolated) comparisons are true,
> right up to the point where one of the mask gates are closed
> (indicating a partition point).
>
> i'm not sure how to do this dynamically, except by cheating and saying
> "case Mask==0b1111", case Mask==0b0001 etc. etc. and limiting it to a
> series of fixed masks:
> 0b1111
> 0b1100 0b0011
> 0b1000 0b0100 0b0010 0b0001
>
> thoughts?
>

Build the bit/byte equal bitvector, then use a recursive evaluation (like
carry look-ahead, but msb to lsb) of:
temp[n] = (~partition_start[n] & temp[n - 1]) | !eq[n]

where partition_start = [1, 1, 1, 0, 1, 0, 0, 0] means the partitions are:
[0,1)
[1,2)
[2,4)
[4,8)

then temp[n] is set when the partition starting at bit-index n is not equal.

Jacob


More information about the libre-riscv-dev mailing list