[Libre-soc-bugs] [Bug 1155] New: O(n^2) multiplication REMAP mode(s)
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sat Sep 9 00:12:35 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1155
Bug ID: 1155
Summary: O(n^2) multiplication REMAP mode(s)
Product: Libre-SOC's second ASIC
Version: unspecified
Hardware: PC
OS: Linux
Status: CONFIRMED
Severity: enhancement
Priority: ---
Component: source code
Assignee: programmerjake at gmail.com
Reporter: programmerjake at gmail.com
CC: libre-soc-bugs at lists.libre-soc.org, lkcl at lkcl.net,
programmerjake at gmail.com
NLnet milestone: NLnet.2021.02A.052.CryptoRouter
parent task for 1044
budget allocation:
Create a REMAP mode
Basic algorithm:
void mul(
uint64_t *product,
const uint64_t *a,
const uint64_t *b,
size_t a_sz,
size_t b_sz
) {
for(size_t bi = 0; bi < a_sz; bi++) {
product[bi] = 0;
}
for(size_t ai = 0; ai < a_sz; ai++) {
uint64_t carry = 0;
for(size_t bi = 0; bi < a_sz; bi++) {
uint128_t v = (uint128_t)a[ai] * (uint128_t)b[bi];
v += (uint128_t)carry;
v += (uint128_t)product[ai + bi];
carry = v >> 64;
product[ai + bi] = (uint64_t)v;
}
product[ai + b_sz] = carry;
}
}
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list