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

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat Jan 25 11:34:27 GMT 2020


On 1/24/20, Jacob Lifshay <programmerjake at gmail.com> wrote:
> 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.

tried it, no luck.

i have a sneaking suspicion that a potential solution is an
augmentation of the above, to use the "expanded width" trick that you
used in PartitionedAdder.

by interspersing the partition points with the results of the
broken-segmented == compares, a recursive cascade of ANDs would end at
those partition-points.

the trick would be to ensure that they continue again *after* a break
in the partition, and i have a sneaking suspicion that this is pretty
much the very definition of a carry-save addition.

any thoughts?

l.



More information about the libre-riscv-dev mailing list