mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge pull request #833 from davidharrishmc/dev
Code cleanup in anticipation of code review
This commit is contained in:
commit
54c07265ba
@ -423,6 +423,7 @@ def main():
|
||||
"""Run the tests and count the failures"""
|
||||
global configs, coverage
|
||||
os.chdir(regressionDir)
|
||||
os.system('rm -rf questa/wkdir')
|
||||
for d in ["questa/logs", "questa/wkdir", "verilator/logs", "verilator/wkdir", "vcs/logs", "vcs/wkdir"]:
|
||||
try:
|
||||
os.mkdir(d)
|
||||
|
@ -112,7 +112,6 @@ make install
|
||||
# Verilator needs to be built from scratch to get the latest version
|
||||
# apt-get install verilator installs version 4.028 as of 6/8/23
|
||||
sudo apt-get install -y perl g++ ccache help2man libgoogle-perftools-dev numactl perl-doc zlib1g
|
||||
sudo apt-get install -y perl g++ ccache help2man libgoogle-perftools-dev numactl perl-doc zlib1g
|
||||
cd $RISCV
|
||||
git clone https://github.com/verilator/verilator # Only first time
|
||||
# unsetenv VERILATOR_ROOT # For csh; ignore error if on bash
|
||||
|
@ -110,20 +110,10 @@ localparam CVTLEN = (ZFA_SUPPORTED & D_SUPPORTED) ? `max(BASECVTLEN, 32'd84) : B
|
||||
localparam LLEN = `max($unsigned(FLEN), $unsigned(XLEN));
|
||||
localparam LOGCVTLEN = $unsigned($clog2(CVTLEN+1));
|
||||
|
||||
// size of FMA output
|
||||
// size of FMA output in U(NF+4).(3NF+2) format
|
||||
localparam FMALEN = 3*NF + 6;
|
||||
|
||||
// NORMSHIFTSIZE is the bits out of the normalization shifter
|
||||
// RV32F: max(32+23+1, 2(23)+4, 3(23)+6) = 3*23+6 = 75
|
||||
// RV64F: max(64+23+1, 64 + 23 + 2, 3*23+6) = 89
|
||||
// RV64D: max(84+52+1, 64+52+2, 3*52+6) = 162
|
||||
// *** DH 5/10/24 testbench_fp f_ieee_div_2_1_rv64gc cvtint was failing for fcvt.lu.s
|
||||
// with CVTLEN+NF+1. Changing to CVTLEN+NF+1+2 fixes failures
|
||||
// This same failure occurred for any test with IDIV_ON_FPU = 0, FLEN=32, XLEN=64
|
||||
// because NORMSHIFTSZ becomes limited by convert rather than divider
|
||||
// The two extra bits are necessary because shiftcorrection dropped them for fcvt.
|
||||
// May be possible to remove these two bits by modifying shiftcorrection
|
||||
//localparam NORMSHIFTSZ = `max(`max((CVTLEN+NF+1+2), (DIVb + 1 + NF + 1)), (FMALEN + 2));
|
||||
localparam NORMSHIFTSZ = `max(`max((CVTLEN+NF+1), (DIVb + 1 + NF + 1)), (FMALEN + 2));
|
||||
|
||||
localparam LOGNORMSHIFTSZ = ($clog2(NORMSHIFTSZ)); // log_2(NORMSHIFTSZ)
|
||||
|
@ -3,5 +3,9 @@
|
||||
#include "Vtestbench__Dpi.h"
|
||||
|
||||
const char *getenvval(const char *pszName) {
|
||||
const char *pszValue = getenv(pszName);
|
||||
if (pszValue == NULL) {
|
||||
return "";
|
||||
}
|
||||
return ((const char *) getenv(pszName));
|
||||
}
|
2
src/cache/cache.sv
vendored
2
src/cache/cache.sv
vendored
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Implements the I$ and D$. Interfaces with requests from IEU and HPTW and ahbcacheinterface
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 7 (Figures 7.9, 7.10, and 7.19)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
2
src/cache/cacheLRU.sv
vendored
2
src/cache/cacheLRU.sv
vendored
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Implements Pseudo LRU. Tested for Powers of 2.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 7 (Figures 7.8 and 7.15 to 7.18)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
2
src/cache/cachefsm.sv
vendored
2
src/cache/cachefsm.sv
vendored
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Controller for the cache fsm
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 7 (Figure 7.14 and Table 7.1)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
2
src/cache/cacheway.sv
vendored
2
src/cache/cacheway.sv
vendored
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Storage and read/write access to data cache data, tag valid, dirty, and replacement.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 7 (Figure 7.11)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
2
src/cache/subcachelineread.sv
vendored
2
src/cache/subcachelineread.sv
vendored
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Muxes the cache line down to the word size. Also include possible save/restore registers/muxes.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 7
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Translates cache bus requests and uncached ieu memory requests into AHB transactions.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 9 (Figure 9.8)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -114,11 +114,12 @@ module ahbcacheinterface import cvw::*; #(
|
||||
.s(~(CacheableOrFlushCacheM)), .y(PreHWDATA));
|
||||
flopen #(P.AHBW) wdreg(HCLK, HREADY, PreHWDATA, HWDATA); // delay HWDATA by 1 cycle per spec
|
||||
|
||||
// *** bummer need a second byte mask for bus as it is AHBW rather than LLEN.
|
||||
// probably can merge by muxing PAdrM's LLEN/8-1 index bit based on HTRANS being != 0.
|
||||
swbytemask #(P.AHBW) busswbytemask(.Size(HSIZE), .Adr(HADDR[$clog2(P.AHBW/8)-1:0]), .ByteMask(BusByteMaskM), .ByteMaskExtended());
|
||||
|
||||
flopen #(P.AHBW/8) HWSTRBReg(HCLK, HREADY, BusByteMaskM[P.AHBW/8-1:0], HWSTRB);
|
||||
if (READ_ONLY_CACHE) begin
|
||||
assign HWSTRB = '0;
|
||||
end else begin // compute byte mask for AHB transaction based on size and address. AHBW may be different than LLEN
|
||||
swbytemask #(P.AHBW) busswbytemask(.Size(HSIZE), .Adr(HADDR[$clog2(P.AHBW/8)-1:0]), .ByteMask(BusByteMaskM), .ByteMaskExtended());
|
||||
flopen #(P.AHBW/8) HWSTRBReg(HCLK, HREADY, BusByteMaskM[P.AHBW/8-1:0], HWSTRB);
|
||||
end
|
||||
|
||||
buscachefsm #(BeatCountThreshold, AHBWLOGBWPL, READ_ONLY_CACHE, P.BURST_EN) AHBBuscachefsm(
|
||||
.HCLK, .HRESETn, .Flush, .BusRW, .BusAtomic, .Stall, .BusCommitted, .BusStall, .CaptureEn, .SelBusBeat,
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Translates LSU simple memory requests into AHB transactions (NON_SEQ).
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 6 (Figure 6.21)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Controller for cache to AHB bus interface
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 9 (Figure 9.9)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Simple NON_SEQ (no burst) AHB controller.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 6 (Figure 6.23)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -11,7 +11,7 @@
|
||||
// Connects core to peripherals and I/O pins on SOC
|
||||
// Bus width presently matches XLEN
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 6 (Figure 6.25)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -11,7 +11,7 @@
|
||||
// Connects core to peripherals and I/O pins on SOC
|
||||
// Bus width presently matches XLEN
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 6 (Figures 6.25 and 6.26)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -110,7 +110,7 @@ module ebu import cvw::*; #(parameter cvw_t P) (
|
||||
.HWRITEOut(LSUHWRITEOut), .HSIZEOut(LSUHSIZEOut), .HBURSTOut(LSUHBURSTOut),
|
||||
.HTRANSOut(LSUHTRANSOut), .HADDROut(LSUHADDROut), .HREADYIn(HREADY));
|
||||
|
||||
// output mux //*** switch to structural implementation
|
||||
// output mux
|
||||
assign HADDR = LSUSelect ? LSUHADDROut : IFUSelect ? IFUHADDROut : '0;
|
||||
assign HSIZE = LSUSelect ? LSUHSIZEOut : IFUSelect ? IFUHSIZEOut: '0;
|
||||
assign HBURST = LSUSelect ? LSUHBURSTOut : IFUSelect ? IFUHBURSTOut : '0; // If doing memory accesses, use LSUburst, else use Instruction burst.
|
||||
|
@ -8,7 +8,7 @@
|
||||
// Purpose: Arbitrates requests from instruction and data streams
|
||||
// LSU has priority.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 6 (Figures 6.25 and 6.26)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating-point classify unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating-point comparison unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: floating-point control unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating point conversions of configurable size
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// Int component of the Wally configurable RISC-V project.
|
||||
//
|
||||
@ -190,7 +190,7 @@ module fcvt import cvw::*; #(parameter cvw_t P) (
|
||||
// shifter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// kill the shift if it's negative
|
||||
// kill the shift if it is negative
|
||||
// select the amount to shift by
|
||||
// fp -> int:
|
||||
// - shift left by CalcExp - essentially shifting until the unbiased exponent = 0
|
||||
@ -201,10 +201,10 @@ module fcvt import cvw::*; #(parameter cvw_t P) (
|
||||
// - shift left by LeadingZeros - to shift till the result is normalized
|
||||
// - only shift fp -> fp if the intital value is subnormal
|
||||
// - this is a problem because the input to the lzc was the fraction rather than the mantissa
|
||||
// - rather have a few and-gates than an extra bit in the priority encoder??? *** is this true?
|
||||
// - rather have a few and-gates than an extra bit in the priority encoder???
|
||||
always_comb
|
||||
if(ToInt) ShiftAmt = Ce[P.LOGCVTLEN-1:0]&{P.LOGCVTLEN{~Ce[P.NE]}};
|
||||
else if (ResSubnormUf) ShiftAmt = (P.LOGCVTLEN)'(P.NF-1)+Ce[P.LOGCVTLEN-1:0];
|
||||
else if (ResSubnormUf) ShiftAmt = (P.LOGCVTLEN)'(P.NF-1)+Ce[P.LOGCVTLEN-1:0];
|
||||
else ShiftAmt = LeadingZeros;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Combined Divide and Square Root Floating Point and Integer Unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Determine number of cycles for divsqrt
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Exponent caclulation for divide and square root
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Radix 2 F Addend Generator
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Radix 4 F Addend Generator
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: divsqrt state machine for multi-cycle operations
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: k stages of divsqrt logic, plus registers
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -44,7 +44,7 @@ module fdivsqrtiter import cvw::*; #(parameter cvw_t P) (
|
||||
logic [P.DIVb+3:0] WCNext[P.DIVCOPIES-1:0]; // Q4.DIVb
|
||||
logic [P.DIVb+3:0] WS[P.DIVCOPIES:0]; // Q4.DIVb
|
||||
logic [P.DIVb+3:0] WC[P.DIVCOPIES:0]; // Q4.DIVb
|
||||
logic [P.DIVb:0] U[P.DIVCOPIES:0]; // U1.DIVb // *** probably Q not U. See Table 16.26 notes
|
||||
logic [P.DIVb:0] U[P.DIVCOPIES:0]; // U1.DIVb
|
||||
logic [P.DIVb:0] UM[P.DIVCOPIES:0]; // U1.DIVb
|
||||
logic [P.DIVb:0] UNext[P.DIVCOPIES-1:0]; // U1.DIVb
|
||||
logic [P.DIVb:0] UMNext[P.DIVCOPIES-1:0]; // U1.DIVb
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Divide/Square root postprocessing
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Divide/Square root preprocessing: integer absolute value and W64, normalization shift
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -222,7 +222,7 @@ 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. rn = Cycles * r * k - r ***explain
|
||||
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
|
||||
/* verilator lint_on WIDTH */
|
||||
assign RemOpE = Funct3E[1];
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: radix-2 divsqrt recurrence stage
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: radix-4 divsqrt recurrence stage
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -52,7 +52,7 @@ module fdivsqrtstage4 import cvw::*; #(parameter cvw_t P) (
|
||||
|
||||
// Digit Selection logic
|
||||
assign j0 = ~C[P.DIVb+1]; // first step of R digit selection: C = 00...0
|
||||
assign j1 = C[P.DIVb] & ~C[P.DIVb-1]; // second step of R digit selection: C = 1100...0; *** could simplify to ~C[P.DIVb-1] because j=0 case takes priority
|
||||
assign j1 = ~C[P.DIVb-1]; // second step of R digit selection: C = 1100...0; simplified from C[P.DIVb] & ~C[P.DIVb-1] because j=0 case takes priority
|
||||
assign Smsbs = U[P.DIVb:P.DIVb-4]; // U1.4 most significant bits of square root
|
||||
assign Dmsbs = D[P.DIVb-1:P.DIVb-3]; // U0.3 most significant fractional bits of divisor after leading 1
|
||||
assign WCmsbs = WC[P.DIVb+3:P.DIVb-4]; // Q4.4 most significant bits of residual
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Radix 2 unified on-the-fly converter
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Radix 4 unified on-the-fly converter
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Radix 2 Unified Quotient/Square Root Digit Selection
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Table-based Radix 4 Unified Quotient/Square Root Digit Selection
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Comparator-based Radix 4 Unified Quotient/Square Root Digit Selection
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -95,7 +95,7 @@ module fdivsqrtuslc4cmp (
|
||||
// Choose A for current operation
|
||||
always_comb
|
||||
if (SqrtE) begin
|
||||
if (Smsbs[4]) A = 3'b111; // for S = 1.0000 *** can we optimize away this case?
|
||||
if (Smsbs[4]) A = 3'b111; // for S = 1.0000
|
||||
else A = Smsbs[2:0];
|
||||
end else A = Dmsbs;
|
||||
|
||||
@ -108,7 +108,7 @@ module fdivsqrtuslc4cmp (
|
||||
|
||||
/* Nannarelli12 design to exploit symmetry is slower because of negation and mux for special case of A = 000
|
||||
assign mk0 = -mk1;
|
||||
assign mkm1 = (A == 3'b000) ? -13 : -mk2; // asymmetry in table *** can we hide from critical path
|
||||
assign mkm1 = (A == 3'b000) ? -13 : -mk2; // asymmetry in table
|
||||
*/
|
||||
|
||||
// Compare residual W to selection constants to choose digit
|
||||
@ -117,5 +117,5 @@ module fdivsqrtuslc4cmp (
|
||||
else if ($signed(Wmsbs) >= $signed(mk1)) udigit = 4'b0100; // choose 1
|
||||
else if ($signed(Wmsbs) >= $signed(mk0)) udigit = 4'b0000; // choose 0
|
||||
else if ($signed(Wmsbs) >= $signed(mkm1)) udigit = 4'b0010; // choose -1
|
||||
else udigit = 4'b0001; // choose -2
|
||||
else udigit = 4'b0001; // choose -2
|
||||
endmodule
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Determine forwarding, stalls and flushes for the FPU
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating-point float immediate
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 16
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating point multiply-accumulate of configurable size
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Figure 13.7, 9)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FMA significand adder
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Figure 13.11)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FMA alginment shift
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Table 13.10)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FMA exponent addition
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Table 13.9)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Leading Zero Anticipator
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Figure 13.14)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
// See also [Schmookler & Nowka, Leading zero anticipation and detection, IEEE Sym. Computer Arithmetic, 2001]
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FMA Significand Multiplier
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Table 13.7)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FMA Sign Logic
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13 (Table 13.8)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Look up bias of exponent and number of fractional bits for the selected format
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating Point Unit Top-Level Interface
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -218,7 +218,6 @@ module fpu import cvw::*; #(parameter cvw_t P) (
|
||||
{{P.FLEN-P.H_LEN{1'b1}}, 2'b0, {P.H_NE-1{1'b1}}, (P.H_NF)'(0)},
|
||||
{2'b0, {P.NE-1{1'b1}}, (P.NF)'(0)}, FmtE, BoxedOneE); // NaN boxing zeroes
|
||||
assign FmaAddSubE = OpCtrlE[2]&OpCtrlE[1]&(PostProcSelE==2'b10);
|
||||
// ***simplified from appearently redundant assign FmaAddSubE = OpCtrlE[2]&OpCtrlE[1]&(FResSelE==2'b01)&(PostProcSelE==2'b10);
|
||||
mux2 #(P.FLEN) fyaddmux (PreYE, BoxedOneE, FmaAddSubE, YE); // Force Y to be 1 for add/subtract
|
||||
|
||||
// Select NAN-boxed value of Z = 0.0 in proper format for FMA for multiply X*Y+Z
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: 3R1W 4-port register file for FPU
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Floating-point round to integer for Zfa
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 16
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FPU Sign Injection instructions
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Pack the output of the FPU
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Conversion shift calculation
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Division shift calculation
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Post-Processing flag calculation
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: FMA shift calculation
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Negate integer result
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: normalization shifter
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Post-Processing: normalization, rounding, sign, flags, special cases
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -157,11 +157,11 @@ module postprocess import cvw::*; #(parameter cvw_t P) (
|
||||
end
|
||||
2'b00: begin // cvt
|
||||
ShiftAmt = {{P.LOGNORMSHIFTSZ-$clog2(P.CVTLEN+1){1'b0}}, CvtShiftAmt};
|
||||
ShiftIn = {CvtShiftIn, {P.NORMSHIFTSZ-P.CVTLEN-P.NF-1{1'b0}}};
|
||||
ShiftIn = {CvtShiftIn, {P.NORMSHIFTSZ-(P.CVTLEN+P.NF+1){1'b0}}};
|
||||
end
|
||||
2'b01: begin //divsqrt
|
||||
ShiftAmt = DivShiftAmt;
|
||||
ShiftIn = {{P.NF{1'b0}}, DivUm, {P.NORMSHIFTSZ-P.DIVb-1-P.NF{1'b0}}};
|
||||
ShiftIn = {{P.NF{1'b0}}, DivUm, {P.NORMSHIFTSZ-(P.DIVb+1+P.NF){1'b0}}};
|
||||
end
|
||||
default: begin
|
||||
ShiftAmt = {P.LOGNORMSHIFTSZ{1'bx}};
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: calculating the result's sign
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Rounder
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Sign calculation for rounding
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: shift correction
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -51,7 +51,7 @@ module shiftcorrection import cvw::*; #(parameter cvw_t P) (
|
||||
logic LeftShiftQm; // should the divsqrt result be shifted one to the left
|
||||
logic RightShift; // shift right by 1
|
||||
|
||||
// *** 4/16/24 this code is a mess and needs cleaning and explaining
|
||||
// dh 4/16/24 this code is a mess and needs cleaning and explaining
|
||||
// define bit widths
|
||||
// seems to shift by 0, 1, or 2. right and left shift is confusing
|
||||
|
||||
@ -61,20 +61,20 @@ module shiftcorrection import cvw::*; #(parameter cvw_t P) (
|
||||
// - a one has to propagate all the way through a sum. so we can leave the bottom statement alone
|
||||
assign LZAPlus1 = Shifted[P.NORMSHIFTSZ-1];
|
||||
|
||||
|
||||
// correct the shifting of the divsqrt caused by producing a result in (0.5, 2) range
|
||||
// condition: if the msb is 1 or the exponent was one, but the shifted quotent was < 1 (Subnorm)
|
||||
assign LeftShiftQm = (LZAPlus1|(DivUe==1&~LZAPlus1));
|
||||
|
||||
assign RightShift = FmaOp ? LZAPlus1 : LeftShiftQm;
|
||||
assign LeftShiftQm = (LZAPlus1|(DivUe==1&~LZAPlus1));
|
||||
|
||||
// one bit right shift for FMA or division
|
||||
mux2 #(P.NORMSHIFTSZ) corrmux({Shifted[P.NORMSHIFTSZ-3:0], 2'b00}, {Shifted[P.NORMSHIFTSZ-2:1], 2'b00}, RightShift, CorrShifted);
|
||||
|
||||
// Determine the shif for either FMA or divsqrt
|
||||
assign RightShift = FmaOp ? LZAPlus1 : LeftShiftQm;
|
||||
|
||||
// possible one bit right shift for FMA or division
|
||||
// if the result of the divider was calculated to be subnormal, then the result was correctly normalized, so select the top shifted bits
|
||||
always_comb
|
||||
if (FmaOp | (DivOp & ~DivResSubnorm)) Mf = CorrShifted;
|
||||
else Mf = Shifted[P.NORMSHIFTSZ-1:0];
|
||||
if (FmaOp | (DivOp & ~DivResSubnorm)) // one bit shift for FMA or divsqrt
|
||||
if (RightShift) Mf = {Shifted[P.NORMSHIFTSZ-2:1], 2'b00};
|
||||
else Mf = {Shifted[P.NORMSHIFTSZ-3:0], 2'b00};
|
||||
else Mf = Shifted[P.NORMSHIFTSZ-1:0]; // convert and subnormal division result
|
||||
|
||||
// Determine sum's exponent
|
||||
// main exponent issues:
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: special case selection
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: unpack X, Y, Z floating-point inputs
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: unpack input: extract sign, exponent, significand, characteristics
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 13
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -34,7 +34,7 @@ module aplusbeq0 #(parameter WIDTH = 8) (
|
||||
logic [WIDTH-1:0] orshift;
|
||||
|
||||
// The sum is zero if the bitwise XOR is equal to the bitwise OR shifted left by 1, for all columns
|
||||
// *** explain, cite book
|
||||
// See J. A. Prabhu and G. Zyner, "167 MHz radix-8 divide and square root using overlapped radix-2 stages," IEEE Symp. Computer Arithmetic, 1995, pp. 155-162.
|
||||
|
||||
assign x = a ^ b;
|
||||
assign orshift = {a[WIDTH-2:0] | b[WIDTH-2:0], 1'b0};
|
||||
|
@ -29,8 +29,5 @@ module decoder #(parameter BINARY_BITS = 3) (
|
||||
output logic [(2**BINARY_BITS)-1:0] onehot
|
||||
);
|
||||
|
||||
// *** Double check whether this synthesizes as expected
|
||||
// -- Ben @ May 4: only warning is that "signed to unsigned assignment occurs"; that said, I haven't checked the netlists
|
||||
assign onehot = 1 << binary;
|
||||
|
||||
endmodule
|
||||
|
@ -44,11 +44,9 @@ module ram1p1rwbe import cvw::*; #(parameter USE_SRAM=0, DEPTH=64, WIDTH=44, PRE
|
||||
output logic [WIDTH-1:0] dout
|
||||
);
|
||||
|
||||
bit [WIDTH-1:0] RAM[DEPTH-1:0];
|
||||
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TRUE SRAM macro
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
if ((USE_SRAM == 1) & (WIDTH == 128) & (DEPTH == 64)) begin // Cache data subarray
|
||||
genvar index;
|
||||
// 64 x 128-bit SRAM
|
||||
@ -79,10 +77,11 @@ module ram1p1rwbe import cvw::*; #(parameter USE_SRAM=0, DEPTH=64, WIDTH=44, PRE
|
||||
.A(addr), .D(din),
|
||||
.BWEB(~BitWriteMask), .Q(dout));
|
||||
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// READ first SRAM model
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
end else begin: ram
|
||||
bit [WIDTH-1:0] RAM[DEPTH-1:0];
|
||||
integer i;
|
||||
|
||||
if (PRELOAD_ENABLED) begin
|
||||
|
@ -41,11 +41,9 @@ module ram1p1rwe import cvw::* ; #(parameter USE_SRAM=0, DEPTH=64, WIDTH=44) (
|
||||
output logic [WIDTH-1:0] dout
|
||||
);
|
||||
|
||||
bit [WIDTH-1:0] RAM[DEPTH-1:0];
|
||||
|
||||
// ***************************************************************************
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// TRUE SRAM macro
|
||||
// ***************************************************************************
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
if ((USE_SRAM == 1) & (WIDTH == 128) & (DEPTH == 64)) begin // Cache data subarray
|
||||
// 64 x 128-bit SRAM
|
||||
ram1p1rwbe_64x128 sram1A (.CLK(clk), .CEB(~ce), .WEB(~we),
|
||||
@ -64,12 +62,15 @@ module ram1p1rwe import cvw::* ; #(parameter USE_SRAM=0, DEPTH=64, WIDTH=44) (
|
||||
.A(addr), .D(din),
|
||||
.BWEB('0), .Q(dout));
|
||||
|
||||
// ***************************************************************************
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// READ first SRAM model
|
||||
// ***************************************************************************
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
end else begin: ram
|
||||
// *** Vivado is not implementing this as block ram for some reason.
|
||||
// Vivado is not implementing this as block ram for some reason.
|
||||
// The version with byte write enables it correctly infers block ram.
|
||||
|
||||
bit [WIDTH-1:0] RAM[DEPTH-1:0];
|
||||
|
||||
integer i;
|
||||
|
||||
// Combinational read: register address and read after clock edge
|
||||
|
@ -44,13 +44,12 @@ module ram2p1r1wbe import cvw::*; #(parameter USE_SRAM=0, DEPTH=1024, WIDTH=68)
|
||||
output logic [WIDTH-1:0] rd1
|
||||
);
|
||||
|
||||
bit [WIDTH-1:0] mem[DEPTH-1:0];
|
||||
localparam SRAMWIDTH = 32;
|
||||
localparam SRAMNUMSETS = SRAMWIDTH/WIDTH;
|
||||
|
||||
// ***************************************************************************
|
||||
// TRUE Smem macro
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TRUE SRAM macro
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if ((USE_SRAM == 1) & (WIDTH == 68) & (DEPTH == 1024)) begin
|
||||
|
||||
@ -105,24 +104,26 @@ module ram2p1r1wbe import cvw::*; #(parameter USE_SRAM=0, DEPTH=1024, WIDTH=68)
|
||||
.QA(SRAMReadData),
|
||||
.QB());
|
||||
|
||||
end else begin
|
||||
end else begin:ram
|
||||
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// READ first SRAM model
|
||||
// ***************************************************************************
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bit [WIDTH-1:0] RAM[DEPTH-1:0];
|
||||
integer i;
|
||||
/*
|
||||
initial begin // initialize memory for simulation only; not needed because done in the testbench now
|
||||
integer j;
|
||||
for (j=0; j < DEPTH; j++)
|
||||
mem[j] = '0;
|
||||
RAM[j] = '0;
|
||||
end
|
||||
*/
|
||||
|
||||
// Read
|
||||
logic [$clog2(DEPTH)-1:0] ra1d;
|
||||
flopen #($clog2(DEPTH)) adrreg(clk, ce1, ra1, ra1d);
|
||||
assign rd1 = mem[ra1d];
|
||||
assign rd1 = RAM[ra1d];
|
||||
|
||||
// Write divided into part for bytes and part for extra msbs
|
||||
// coverage off
|
||||
@ -131,13 +132,13 @@ module ram2p1r1wbe import cvw::*; #(parameter USE_SRAM=0, DEPTH=1024, WIDTH=68)
|
||||
always @(posedge clk)
|
||||
if (ce2 & we2)
|
||||
for(i = 0; i < WIDTH/8; i++)
|
||||
if(bwe2[i]) mem[wa2][i*8 +: 8] <= wd2[i*8 +: 8];
|
||||
if(bwe2[i]) RAM[wa2][i*8 +: 8] <= wd2[i*8 +: 8];
|
||||
// coverage on
|
||||
|
||||
if (WIDTH%8 != 0) // handle msbs if width not a multiple of 8
|
||||
always @(posedge clk)
|
||||
if (ce2 & we2 & bwe2[WIDTH/8])
|
||||
mem[wa2][WIDTH-1:WIDTH-WIDTH%8] <= wd2[WIDTH-1:WIDTH-WIDTH%8];
|
||||
RAM[wa2][WIDTH-1:WIDTH-WIDTH%8] <= wd2[WIDTH-1:WIDTH-WIDTH%8];
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Determine stalls and flushes
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4, Figure 13.54
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: RISC-V Arithmetic/Logic Unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.4)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: RISC-V Arithmetic/Logic Unit Bit-Manipulation Extension and K extension
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Bit reverse submodule
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Top level bit manipulation instruction decoder
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: RISCV bitmanip byte-wise operation unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Carry-Less multiplication unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Count Instruction Submodule
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Sign/Zero Extension Submodule
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -5,7 +5,7 @@
|
||||
//
|
||||
// Purpose: Population Count
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: RISC-V ZBB top level unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: RISC-V ZBC top-level unit
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 15
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Branch comparison
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.7)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Top level controller module
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Section 4.1.4, Figure 4.8, Table 4.5)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Wally Integer Datapath
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.12)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Produce sign-extended immediates from various formats
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.3)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// Purpose: Integer Execution Unit: datapath and controller
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.12)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: 3-port register file
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: RISC-V 32/64 bit shifter
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.5, Table 4.3)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: 2 bit saturating counter predictor with parameterized table depth.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 10 (Figure ***)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -8,7 +8,7 @@
|
||||
// Purpose: Branch Target Buffer (BTB). The BTB predicts the target address of all control flow instructions.
|
||||
// It also guesses the type of instrution; jalr(r), return, jump (jr), or branch.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 10 (Figure ***)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -6,10 +6,6 @@
|
||||
// Modified: 18 January 2023
|
||||
//
|
||||
// Purpose: Expand 16-bit compressed instructions to 32 bits
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 11 (Section 11.3.1)
|
||||
// RISC-V Specification 13 Dec 2019 Chapter 16 pg. 97
|
||||
// *** probably need more documentation in this file since the book is very light on decompression.
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -9,7 +9,7 @@
|
||||
// cache line boundaries or if instruction address without a cache crosses
|
||||
// XLEN/8 boundary.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 11 (Figure 11.5)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -9,7 +9,7 @@
|
||||
// It is simlar to the IFU's spill module and probably could be merged together with
|
||||
// some effort.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 11 (Figure 11.5)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Performs AMO operations
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 14 (Figure ***)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
@ -73,7 +73,7 @@ module amoalu import cvw::*; #(parameter cvw_t P) (
|
||||
5'b10100: y = cmp ? a : b; // amomax
|
||||
5'b11000: y = cmp ? a : b; // amominu
|
||||
5'b11100: y = cmp ? a : b; // amomaxu
|
||||
default: y = 'x; // undefined; *** could change to b for efficiency
|
||||
default: y = 'x; // undefined
|
||||
endcase
|
||||
|
||||
// sign extend output if necessary for w64
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Wrapper for amoalu and lrsc
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 14 (Figure ***)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: tightly integrated memory into the LSU.
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 4 (Figure 4.12)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
// Purpose: Swap byte order for Big-Endian accesses
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 5 (Figure 5.9)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -8,7 +8,7 @@
|
||||
// Purpose: Load Reserved / Store Conditional unit
|
||||
// Track the reservation and squash the store if it fails
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 14 (Figure ***)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
@ -9,7 +9,7 @@
|
||||
// HPTW, DMMU, data cache, interface to external bus
|
||||
// Atomic, Endian swap, and subword read/write logic
|
||||
//
|
||||
// Documentation: RISC-V System on Chip Design Chapter 9 (Figure 9.2)
|
||||
// Documentation: RISC-V System on Chip Design
|
||||
//
|
||||
// A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
// https://github.com/openhwgroup/cvw
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user