[libre-riscv-dev] div pipe

Jacob Lifshay programmerjake at gmail.com
Mon Jul 20 01:32:39 BST 2020

On Sun, Jul 19, 2020, 15:07 Luke Kenneth Casson Leighton <lkcl at lkcl.net>

> On Sunday, July 19, 2020, Jacob Lifshay <programmerjake at gmail.com> wrote:
> > What we could do is just revert
> > the bitwidth changes if we want to have working code anyway.
> well, what i did was, if the configuration (initialisation) requests sqrt
> or rsqrt the bitwidth is set to the 3x

yeah, that part's correct as far as I can tell.
the part that's broken is where the width is set to 2x for div-only, since
effectively what's happening is the code is treating the compare_?hs
signals as if the binary value N means the fraction N/2^(3*fract_width)
(essentially fixed-point numbers), so changing the bit width of N without
adjusting the fract_width means there are too few integer bits and too many
fractional bits. additionally, some of the shifts and bit sliced will have
to be adjusted to get the right bits.

> no reversion should be needed.

except that, last I checked DivPipeCore doesn't correctly do divisions when
configured to only support UDivRem, since that's when it enables the broken
code adjustments.

see the test_bit_width_8_fract_width_4_radix_4[_comb]_div_only test
functions in TestDivPipeCore -- the code only breaks when div-only is
enabled: compare to test_bit_width_8_fract_width_4_radix_4[_comb]


More information about the libre-riscv-dev mailing list