[Libre-soc-bugs] [Bug 432] mulld pseudocode overflow calculation incorrect

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Jul 15 16:03:59 BST 2020


https://bugs.libre-soc.org/show_bug.cgi?id=432

--- Comment #8 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #6)
> likewise this one?

yes, but...
> 
> @@ -51,10 +56,10 @@ class MulMainStage3(PipeModBase):
>                  # compute overflow
>                  mul_ov = Signal(reset_less=True)
>                  with m.If(is_32bit):
> -                    m32 = mul_o[32:64]
> +                    m31 = mul_o[31:64] # yes really bits 31 to 63 (incl)

add comment explaining that we're checking that the top 32 bits is the
sign-extended version of the bottom 32 bits.
>                      comb += mul_ov.eq(m32.bool() & ~m32.all())

change to m31
>                  with m.Else():
> -                    m64 = mul_o[64:128]
> +                    m64 = mul_o[63:128] # yes really bits 63 to 127 (incl)
add similar sign-extended comment
>                      comb += mul_ov.eq(m64.bool() & ~m64.all())

change to m65

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list