[Libre-soc-isa] [Bug 817] Big Integer Math (sv.adde, sv.subfe, sv.madded, 128 by 64-bit -> 64-bit div/rem, maybe more...)

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Apr 25 10:30:17 BST 2022


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

--- Comment #27 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #25)
> is it as simple as this:
> 
>     dividend = (RC) || (RB)
>     divisor = EXTZ128(RA)
>     if (((RB) = 0)  & ((RC)   <u (RA)) |
>         ((RB) != 0) & ((RC)+1 <u (RA))) then

the reason you only need to compare RC with RA and don't need to compare RB is
because when RC == RA - 1, then all values of RB will still cause the division
to round down to fitting in 64-bits. when RC == RA, if RB == 0 that's still big
enough to overflow, if RB > 0 then that's even bigger and will definitely
overflow.

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


More information about the Libre-SOC-ISA mailing list