From: Jacob Lifshay Date: Wed, 15 May 2024 06:21:16 +0000 (-0700) Subject: reference/gfbm[ul/add].py: fix truncation bugs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0df15ec21ff37b03483f9feb94c3c86a5e2c8b0a;p=nmigen-gf.git reference/gfbm[ul/add].py: fix truncation bugs --- diff --git a/gf_reference/gfbmadd.py b/gf_reference/gfbmadd.py index 5507d27..35d07a6 100644 --- a/gf_reference/gfbmadd.py +++ b/gf_reference/gfbmadd.py @@ -7,5 +7,5 @@ from nmigen_gf.reference.cldivrem import cldivrem def gfbmadd(a, b, c): v = clmul(a, b) ^ c red_poly = decode_reducing_polynomial() - q, r = cldivrem(v, red_poly, width=ST.XLEN + 1) + q, r = cldivrem(v, red_poly, width=ST.XLEN * 2 + 1) return r diff --git a/gf_reference/gfbmul.py b/gf_reference/gfbmul.py index bde8f05..57bea1c 100644 --- a/gf_reference/gfbmul.py +++ b/gf_reference/gfbmul.py @@ -7,5 +7,5 @@ from nmigen_gf.reference.cldivrem import cldivrem def gfbmul(a, b): product = clmul(a, b) red_poly = decode_reducing_polynomial() - q, r = cldivrem(product, red_poly, width=ST.XLEN + 1) + q, r = cldivrem(product, red_poly, width=ST.XLEN * 2 + 1) return r