[Libre-soc-bugs] [Bug 782] add galois field bitmanip instructions
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sun Mar 6 18:01:57 GMT 2022
https://bugs.libre-soc.org/show_bug.cgi?id=782
--- Comment #29 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
here is gcd:
59 def xgcd(a, b):
60 """return (g, x, y) such that a*x + b*y = g = gcd(a, b)"""
61 x0, x1, y0, y1 = 0, 1, 1, 0
62 while a != 0:
63 (q, a), b = divmodGF2(b, a), a
64 y0, y1 = y1, y0 ^ multGF2(q , y1)
65 x0, x1 = x1, x0 ^ multGF2(q , x1)
66 return b, x0, y0
it works, but the complexity is high (3 higher functions
in a loop, and 3 return results) so is perfect for doing
in assembler, with divmodgf and multgf as opcodes.
not recommending putting this one in as instruction, nor
gf_invert which uses gcd
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list