From 571c7d3be4687d7cfdda585ce58508f1175c07ef Mon Sep 17 00:00:00 2001 From: David Harris Date: Sun, 12 Nov 2023 19:41:12 -0800 Subject: [PATCH] Divider cleanup --- config/shared/config-shared.vh | 4 ++-- src/fpu/fdivsqrt/fdivsqrtcycles.sv | 6 +++--- src/fpu/fdivsqrt/fdivsqrtpreproc.sv | 13 ++++++++++--- src/fpu/fdivsqrt/fdivsqrtuslc4.sv | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/config/shared/config-shared.vh b/config/shared/config-shared.vh index 9635d706b..55bca569f 100644 --- a/config/shared/config-shared.vh +++ b/config/shared/config-shared.vh @@ -98,8 +98,8 @@ localparam LOGR = $clog2(RADIX); // r = log(R localparam RK = LOGR*DIVCOPIES; // r*k bits per cycle generated // intermediate division parameters not directly used in fdivsqrt hardware -localparam FPDIVMINb = NF + 3; // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit because square root could be shifted right *** explain better -//localparam FPDIVMINb = NF + 2 + (RADIX == 2); // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit for preshifting radix2 square root right +localparam FPDIVMINb = NF + 3; // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit to allow sqrt being shifted right +//localparam FPDIVMINb = NF + 2 + (RADIX == 2); // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit for preshifting radix2 square root right, if radix4 doesn't use a right shift. This version saves one cycle on double-precision with R=4,k=4. However, it doesn't work yet because C is too short, so k is incorrectly calculated as a 1 in the lsb after the last step. localparam DIVMINb = ((FPDIVMINb