[libre-riscv-dev] FP unit testing (was Re: [isa-dev] FP reciprocal sqrt extension proposal)

lkcl luke.leighton at gmail.com
Thu Jul 25 09:27:14 BST 2019

so, with thanks to andrew for pointing out the difference between fsqrt and 
fRsqrt in the special cases handling, that saved some time in wriiing the 

        with m.If(self.i.ctx.op == 2): # RSQRT
            # if a is +/- zero return NaN
            with m.If(a1.is_zero):
                m.d.comb += self.o.z.nan(0)
            # -ve number is NaN
            with m.Elif(a1.s):
                m.d.comb += self.o.z.nan(0)
            # if a is inf return zero (-ve already excluded, above)
            with m.Elif(a1.is_inf):
                m.d.comb += self.o.z.zero(0)
            # if a is NaN return NaN
            with m.Elif(a1.is_nan):
                m.d.comb += self.o.z.nan(0)
            # Denormalised Number checks next, so pass a/b data through
            with m.Else():

however one key difference: where fpsqrt(-ve 0) returns -ve inf, 
fpRsqrt(-ve 0) still returns canonical NaN.  i.e. i don't believe it's 
quite exactly the same (swapping 0-test and Inf-test).

does that look reasonable?

secondly: aware that things are contentious at the moment (please be 
mindful of jeffrey's request), however we still have to raise this 
question, and still need to make people aware that, in the past, there has 
been no response - at all - to similar questions (raised similarly in good 
faith).  the question is this:

there is clearly interest in a floating-point reciprocal square-root.  by 
what process may *outsiders* - those excluded for legitimate business 
reasons and other reasons - submit proposals for *official* inclusion in 


More information about the libre-riscv-dev mailing list