[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 05:58:50 BST 2022
https://bugs.libre-soc.org/show_bug.cgi?id=817
--- Comment #25 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Jacob Lifshay from comment #23)
> (In reply to Luke Kenneth Casson Leighton from comment #20)
> > divisor = (RC) || (RB)
> > dividend = EXTZ128(RA)
> > RT = UDIV(dividend, divisor)
> > RS = UREM(dividend, divisor)
> looks good!
detecting the overflow conditions need adapting,
in fixedarith divdeu it is:
dividend[0:(XLEN*2)-1] <- (RA) || [0]*XLEN
divisor[0:(XLEN*2)-1] <- [0]*XLEN || (RB)
result <- dividend / divisor
if (RA) <u (RB) then
RT <- result[XLEN:(XLEN*2)-1]
overflow <- 0
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
RT = UDIV(dividend, divisor)
RS = UREM(dividend, divisor)
overflow = 0
or is it necessary to do this (a 192-bit compare)
if ([0]*XLEN || dividend) <u (divisor<<XLEN)
it's looking for the scenario where the result
cannot fit into 64 bit, right?
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Libre-SOC-ISA
mailing list