From 9a59c8e07f79b70dd7ec59a2f8ef1ff9572563e6 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Thu, 20 Jun 2024 23:46:45 -0700 Subject: [PATCH] reduced bit widths for integer on fpu --- config/shared/config-shared.vh | 8 +++++++- config/shared/parameter-defs.vh | 6 +++++- src/cvw.sv | 6 ++++++ src/fpu/fdivsqrt/fdivsqrtpostproc.sv | 20 +++++++++++++------- src/fpu/fdivsqrt/fdivsqrtpreproc.sv | 6 +++--- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/config/shared/config-shared.vh b/config/shared/config-shared.vh index 44bf77eac..08b8ab739 100644 --- a/config/shared/config-shared.vh +++ b/config/shared/config-shared.vh @@ -97,13 +97,19 @@ localparam RK = LOGR*DIVCOPIES; // r*k bits localparam FPDIVMINb = NF + 2; // minimum length of fractional part: Nf result bits + guard and round bits + 1 extra bit to allow sqrt being shifted right localparam DIVMINb = ((FPDIVMINb>> IntNormShiftM); // special case logic diff --git a/src/fpu/fdivsqrt/fdivsqrtpreproc.sv b/src/fpu/fdivsqrt/fdivsqrtpreproc.sv index 9156005fd..737d9089a 100644 --- a/src/fpu/fdivsqrt/fdivsqrtpreproc.sv +++ b/src/fpu/fdivsqrt/fdivsqrtpreproc.sv @@ -119,7 +119,7 @@ module fdivsqrtpreproc import cvw::*; #(parameter cvw_t P) ( ////////////////////////////////////////////////////// if (P.IDIV_ON_FPU) begin:intrightshift // Int Supported - logic [P.DIVBLEN-1:0] ZeroDiff, p; + logic [P.DIVBLEN-1:0] ZeroDiff,p; // calculate number of fractional bits p assign ZeroDiff = mE - ell; // Difference in number of leading zeros @@ -218,8 +218,8 @@ module fdivsqrtpreproc import cvw::*; #(parameter cvw_t P) ( logic RemOpE; /* verilator lint_off WIDTH */ - assign IntDivNormShiftE = P.DIVb - (CyclesE * P.RK - P.LOGR); // b - rn, used for integer normalization right shift. n = (Cycles * k - 1) - assign IntRemNormShiftE = mE + (P.DIVb-(P.XLEN-1)); // m + b - (N-1) for remainder normalization shift + assign IntDivNormShiftE = P.INTDIVb - (CyclesE * P.RK - P.LOGR); // b - rn, used for integer normalization right shift. n = (Cycles * k - 1) + assign IntRemNormShiftE = mE + (P.INTDIVb-(P.XLEN-1)); // m + b - (N-1) for remainder normalization shift /* verilator lint_on WIDTH */ assign RemOpE = Funct3E[1]; mux2 #(P.DIVBLEN) normshiftmux(IntDivNormShiftE, IntRemNormShiftE, RemOpE, IntNormShiftE);