[Libre-soc-bugs] [Bug 432] New: mulld pseudocode overflow calculation incorrect
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Wed Jul 15 15:38:29 BST 2020
https://bugs.libre-soc.org/show_bug.cgi?id=432
Bug ID: 432
Summary: mulld pseudocode overflow calculation incorrect
Product: Libre-SOC's first SoC
Version: unspecified
Hardware: All
OS: All
Status: CONFIRMED
Severity: normal
Priority: ---
Component: Specification
Assignee: lkcl at lkcl.net
Reporter: programmerjake at gmail.com
CC: libre-soc-bugs at lists.libre-soc.org
NLnet milestone: ---
I was reading some of the pseudocode, and discovered that the overflow
calculation is incorrect.
it currently is:
prod[0:127] <- MULS((RA), (RB))
RT <- prod[64:127]
overflow <- ((prod[0:63] != 0x0000_0000_0000_0000) &
(prod[0:63] != 0xffff_ffff_ffff_ffff))
it should be:
prod[0:127] <- MULS((RA), (RB))
RT <- prod[64:127]
overflow <- ((prod[0:64] != 0x0_0000_0000_0000_0000) &
(prod[0:64] != 0x1_ffff_ffff_ffff_ffff))
since otherwise a product such as 1 << 63 is marked as not overflowing when it
is clearly out of range since it's greater than the max i64. likewise for -1 <<
64, which is smaller than the min i64.
reporting as a bug rather than just altering the pseudocode so we can check any
existing code that is built off the incorrect pseudocode
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list