[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
Wed Nov 9 23:11:58 GMT 2022


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

--- Comment #56 from Jacob Lifshay <programmerjake at gmail.com> ---
one thing i encountered while implementing toom-cook multiplication: it would
be very handy to have a half-signed version of maddedu, for multiplication of
an unsigned bigint by a signed multiplier. this arises because toom-cook
multiplication sometimes uses signed multiplication internally, and multiplying
one bigint by the msb word of a signed bigint requires
unsigned-bigint-signed-word multiplication.

proposed:
maddedsu RT, RA, RB, RC
lhs[0:127] <- ZEXT((RA))
rhs[0:127] <- SEXT((RB))
addend[0:127] <- SEXT((RC))
product[0:127] <- lhs * rhs
sum[0:127] <- product + addend
RT <- sum[64:127]
RS <- sum[0:63]

unsigned bigint * signed word:
# unsigned bigint input in r32..47 
# signed word input in r3
# VL=16
sv.addi 48, 0, 0
sv.maddedsu *32, *32, 3, 48
# product signed bigint in r32..48 (note additional word)

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


More information about the Libre-SOC-ISA mailing list