From b2ec52c94d3907f53ff9836ace1d990d49e67848 Mon Sep 17 00:00:00 2001 From: David Harris Date: Mon, 9 Jan 2023 13:04:34 -0800 Subject: [PATCH] Changed DIVN from NF+3 to NF+2, cleanup --- pipelined/config/rv32gc/wally-config.vh | 2 +- pipelined/config/rv64gc/wally-config.vh | 2 +- pipelined/config/shared/wally-constants.vh | 14 +++++++++++--- pipelined/config/shared/wally-shared.vh | 9 ++------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pipelined/config/rv32gc/wally-config.vh b/pipelined/config/rv32gc/wally-config.vh index 4d346e5a..ff64c7ae 100644 --- a/pipelined/config/rv32gc/wally-config.vh +++ b/pipelined/config/rv32gc/wally-config.vh @@ -68,7 +68,7 @@ // Integer Divider Configuration // IDIV_BITSPERCYCLE must be 1, 2, or 4 `define IDIV_BITSPERCYCLE 4 -`define IDIV_ON_FPU 1 +`define IDIV_ON_FPU 0 // Legal number of PMP entries are 0, 16, or 64 `define PMP_ENTRIES 16 diff --git a/pipelined/config/rv64gc/wally-config.vh b/pipelined/config/rv64gc/wally-config.vh index 70ce1938..58521673 100644 --- a/pipelined/config/rv64gc/wally-config.vh +++ b/pipelined/config/rv64gc/wally-config.vh @@ -69,7 +69,7 @@ // Integer Divider Configuration // IDIV_BITSPERCYCLE must be 1, 2, or 4 `define IDIV_BITSPERCYCLE 4 -`define IDIV_ON_FPU 1 +`define IDIV_ON_FPU 0 // Legal number of PMP entries are 0, 16, or 64 `define PMP_ENTRIES 16 diff --git a/pipelined/config/shared/wally-constants.vh b/pipelined/config/shared/wally-constants.vh index f246d83d..6b66b3ed 100644 --- a/pipelined/config/shared/wally-constants.vh +++ b/pipelined/config/shared/wally-constants.vh @@ -123,18 +123,26 @@ `define CVTLEN ((`NF<`XLEN) ? (`XLEN) : (`NF)) `define LLEN ((`FLEN<`XLEN) ? (`XLEN) : (`FLEN)) `define LOGCVTLEN $unsigned($clog2(`CVTLEN+1)) -`define NORMSHIFTSZ ((`QLEN+`NF+1) > (3*`NF+6) ? (`QLEN+`NF+1) : (3*`NF+6)) +`define NORMSHIFTSZ ((`DIVb + 1 +`NF+1) > (3*`NF+6) ? (`DIVb + 1 +`NF+1) : (3*`NF+6)) `define LOGNORMSHIFTSZ ($clog2(`NORMSHIFTSZ)) `define CORRSHIFTSZ ((`DIVN+1+`NF) > (3*`NF+4) ? (`DIVN+1+`NF) : (3*`NF+4)) +// *** CORRSHIFTSZ & NORMSHIFTSZ needs to be longest from divider, convert, fma + // division constants -`define DIVN (`NF<`XLEN ? `XLEN : `NF+3) // standard length of input + +`define DIVN (((`NF<`XLEN) & `IDIV_ON_FPU) ? `XLEN : `NF+2) // standard length of input `define LOGR (`RADIX==2 ? 32'h1 : 32'h2) // r = log(R) `define RK (`LOGR*`DIVCOPIES) // r*k used for intdiv preproc `define LOGRK ($clog2(`RK)) // log2(r*k) `define FPDUR ((`DIVN+1+(`LOGR*`DIVCOPIES))/(`LOGR*`DIVCOPIES)+(`RADIX/4)) `define DURLEN ($clog2(`FPDUR+1)) -`define QLEN (`FPDUR*`LOGR*`DIVCOPIES) `define DIVb (`FPDUR*`LOGR*`DIVCOPIES-1) // canonical fdiv size (b) `define DIVBLEN ($clog2(`DIVb+1)-1) `define DIVa (`DIVb+1-`XLEN) // used for idiv on fpu + +// Disable spurious Verilator warnings + +/* verilator lint_off STMTDLY */ +/* verilator lint_off ASSIGNDLY */ +/* verilator lint_off PINCONNECTEMPTY */ diff --git a/pipelined/config/shared/wally-shared.vh b/pipelined/config/shared/wally-shared.vh index f9c46b69..18f02317 100644 --- a/pipelined/config/shared/wally-shared.vh +++ b/pipelined/config/shared/wally-shared.vh @@ -23,8 +23,8 @@ /////////////////////////////////////////// // division constants -`define RADIX 32'h4 -`define DIVCOPIES 32'h2 +`define RADIX 32'h2 +`define DIVCOPIES 32'h1 // Memory synthesis configuration `define USE_SRAM 0 @@ -32,8 +32,3 @@ // shared constants `include "wally-constants.vh" -// Disable spurious Verilator warnings - -/* verilator lint_off STMTDLY */ -/* verilator lint_off ASSIGNDLY */ -/* verilator lint_off PINCONNECTEMPTY */