From 0df15ec21ff37b03483f9feb94c3c86a5e2c8b0a Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 14 May 2024 23:21:16 -0700 Subject: [PATCH] reference/gfbm[ul/add].py: fix truncation bugs --- gf_reference/gfbmadd.py | 2 +- gf_reference/gfbmul.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 -- 2.30.2