mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge branch 'main' of github.com:openhwgroup/cvw
This commit is contained in:
commit
bc2c4d5295
@ -88,10 +88,10 @@ if {$2 eq "buildroot" || $2 eq "buildroot-checkpoint"} {
|
|||||||
#run 100 ns
|
#run 100 ns
|
||||||
#force -deposit testbench/dut/core/priv/priv/csr/csri/IE_REGW 16'h2aa
|
#force -deposit testbench/dut/core/priv/priv/csr/csri/IE_REGW 16'h2aa
|
||||||
#force -deposit testbench/dut/uncore/uncore/clint/clint/MTIMECMP 64'h1000
|
#force -deposit testbench/dut/uncore/uncore/clint/clint/MTIMECMP 64'h1000
|
||||||
run 7000 ms
|
run 9800 ms
|
||||||
add log -recursive /testbench/dut/*
|
add log -recursive /testbench/dut/*
|
||||||
do wave.do
|
do wave.do
|
||||||
run 14000 ms
|
run 200 ms
|
||||||
#run -all
|
#run -all
|
||||||
|
|
||||||
exec ./slack-notifier/slack-notifier.py
|
exec ./slack-notifier/slack-notifier.py
|
||||||
|
10
src/cache/cache.sv
vendored
10
src/cache/cache.sv
vendored
@ -79,8 +79,8 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
logic [LINELEN-1:0] ReadDataLineWay [NUMWAYS-1:0];
|
logic [LINELEN-1:0] ReadDataLineWay [NUMWAYS-1:0];
|
||||||
logic [NUMWAYS-1:0] HitWay, ValidWay;
|
logic [NUMWAYS-1:0] HitWay, ValidWay;
|
||||||
logic CacheHit;
|
logic CacheHit;
|
||||||
logic [NUMWAYS-1:0] VictimWay, DirtyWay, HitWayDirtyWay;
|
logic [NUMWAYS-1:0] VictimWay, DirtyWay, HitDirtyWay;
|
||||||
logic LineDirty, HitWayLineDirty;
|
logic LineDirty, HitLineDirty;
|
||||||
logic [TAGLEN-1:0] TagWay [NUMWAYS-1:0];
|
logic [TAGLEN-1:0] TagWay [NUMWAYS-1:0];
|
||||||
logic [TAGLEN-1:0] Tag;
|
logic [TAGLEN-1:0] Tag;
|
||||||
logic [SETLEN-1:0] FlushAdr, NextFlushAdr, FlushAdrP1;
|
logic [SETLEN-1:0] FlushAdr, NextFlushAdr, FlushAdrP1;
|
||||||
@ -116,7 +116,7 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
cacheway #(P, PA_BITS, XLEN, NUMLINES, LINELEN, TAGLEN, OFFSETLEN, SETLEN, READ_ONLY_CACHE) CacheWays[NUMWAYS-1:0](
|
cacheway #(P, PA_BITS, XLEN, NUMLINES, LINELEN, TAGLEN, OFFSETLEN, SETLEN, READ_ONLY_CACHE) CacheWays[NUMWAYS-1:0](
|
||||||
.clk, .reset, .CacheEn, .CacheSet, .PAdr, .LineWriteData, .LineByteMask, .SelWay,
|
.clk, .reset, .CacheEn, .CacheSet, .PAdr, .LineWriteData, .LineByteMask, .SelWay,
|
||||||
.SetValid, .ClearValid, .SetDirty, .ClearDirty, .VictimWay,
|
.SetValid, .ClearValid, .SetDirty, .ClearDirty, .VictimWay,
|
||||||
.FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .ValidWay, .DirtyWay, .HitWayDirtyWay, .TagWay, .FlushStage, .InvalidateCache);
|
.FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .ValidWay, .DirtyWay, .HitDirtyWay, .TagWay, .FlushStage, .InvalidateCache);
|
||||||
|
|
||||||
// Select victim way for associative caches
|
// Select victim way for associative caches
|
||||||
if(NUMWAYS > 1) begin:vict
|
if(NUMWAYS > 1) begin:vict
|
||||||
@ -128,7 +128,7 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
|
|
||||||
assign CacheHit = |HitWay;
|
assign CacheHit = |HitWay;
|
||||||
assign LineDirty = |DirtyWay;
|
assign LineDirty = |DirtyWay;
|
||||||
assign HitWayLineDirty = |HitWayDirtyWay;
|
assign HitLineDirty = |HitDirtyWay;
|
||||||
|
|
||||||
// ReadDataLineWay is a 2d array of cache line len by number of ways.
|
// ReadDataLineWay is a 2d array of cache line len by number of ways.
|
||||||
// Need to OR together each way in a bitwise manner.
|
// Need to OR together each way in a bitwise manner.
|
||||||
@ -219,7 +219,7 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
|
|
||||||
cachefsm #(P, READ_ONLY_CACHE) cachefsm(.clk, .reset, .CacheBusRW, .CacheBusAck,
|
cachefsm #(P, READ_ONLY_CACHE) cachefsm(.clk, .reset, .CacheBusRW, .CacheBusAck,
|
||||||
.FlushStage, .CacheRW, .Stall,
|
.FlushStage, .CacheRW, .Stall,
|
||||||
.CacheHit, .LineDirty, .HitWayLineDirty, .CacheStall, .CacheCommitted,
|
.CacheHit, .LineDirty, .HitLineDirty, .CacheStall, .CacheCommitted,
|
||||||
.CacheMiss, .CacheAccess, .SelAdr, .SelWay,
|
.CacheMiss, .CacheAccess, .SelAdr, .SelWay,
|
||||||
.ClearDirty, .SetDirty, .SetValid, .ClearValid, .SelWriteback, .SelFlush,
|
.ClearDirty, .SetDirty, .SetValid, .ClearValid, .SelWriteback, .SelFlush,
|
||||||
.FlushAdrCntEn, .FlushWayCntEn, .FlushCntRst,
|
.FlushAdrCntEn, .FlushWayCntEn, .FlushCntRst,
|
||||||
|
8
src/cache/cachefsm.sv
vendored
8
src/cache/cachefsm.sv
vendored
@ -51,7 +51,7 @@ module cachefsm import cvw::*; #(parameter cvw_t P,
|
|||||||
// cache internals
|
// cache internals
|
||||||
input logic CacheHit, // Exactly 1 way hits
|
input logic CacheHit, // Exactly 1 way hits
|
||||||
input logic LineDirty, // The selected line and way is dirty
|
input logic LineDirty, // The selected line and way is dirty
|
||||||
input logic HitWayLineDirty, // The cache hit way is dirty
|
input logic HitLineDirty, // The cache hit way is dirty
|
||||||
input logic FlushAdrFlag, // On last set of a cache flush
|
input logic FlushAdrFlag, // On last set of a cache flush
|
||||||
input logic FlushWayFlag, // On the last way for any set of a cache flush
|
input logic FlushWayFlag, // On the last way for any set of a cache flush
|
||||||
output logic SelAdr, // [0] SRAM reads from NextAdr, [1] SRAM reads from PAdr
|
output logic SelAdr, // [0] SRAM reads from NextAdr, [1] SRAM reads from PAdr
|
||||||
@ -74,10 +74,8 @@ module cachefsm import cvw::*; #(parameter cvw_t P,
|
|||||||
logic AnyUpdateHit, AnyHit;
|
logic AnyUpdateHit, AnyHit;
|
||||||
logic AnyMiss;
|
logic AnyMiss;
|
||||||
logic FlushFlag;
|
logic FlushFlag;
|
||||||
logic CMOWritebackHit;
|
|
||||||
logic CMOWriteback;
|
logic CMOWriteback;
|
||||||
logic CMOZeroNoEviction;
|
logic CMOZeroNoEviction;
|
||||||
logic CMOZeroEviction;
|
|
||||||
|
|
||||||
typedef enum logic [3:0]{STATE_READY, // hit states
|
typedef enum logic [3:0]{STATE_READY, // hit states
|
||||||
// miss states
|
// miss states
|
||||||
@ -95,10 +93,8 @@ module cachefsm import cvw::*; #(parameter cvw_t P,
|
|||||||
assign AnyMiss = (CacheRW[0] | CacheRW[1]) & ~CacheHit & ~InvalidateCache; // exclusion-tag: cache AnyMiss
|
assign AnyMiss = (CacheRW[0] | CacheRW[1]) & ~CacheHit & ~InvalidateCache; // exclusion-tag: cache AnyMiss
|
||||||
assign AnyUpdateHit = (CacheRW[0]) & CacheHit; // exclusion-tag: icache storeAMO1
|
assign AnyUpdateHit = (CacheRW[0]) & CacheHit; // exclusion-tag: icache storeAMO1
|
||||||
assign AnyHit = AnyUpdateHit | (CacheRW[1] & CacheHit); // exclusion-tag: icache AnyUpdateHit
|
assign AnyHit = AnyUpdateHit | (CacheRW[1] & CacheHit); // exclusion-tag: icache AnyUpdateHit
|
||||||
assign CMOWritebackHit = (CMOp[1] | CMOp[2]) & CacheHit & HitWayLineDirty;
|
|
||||||
assign CMOZeroNoEviction = CMOp[3] & ~LineDirty; // (hit or miss) with no writeback store zeros now
|
assign CMOZeroNoEviction = CMOp[3] & ~LineDirty; // (hit or miss) with no writeback store zeros now
|
||||||
assign CMOZeroEviction = CMOp[3] & LineDirty; // (hit or miss) with writeback dirty line
|
assign CMOWriteback = ((CMOp[1] | CMOp[2]) & CacheHit & HitLineDirty) | CMOp[3] & LineDirty;
|
||||||
assign CMOWriteback = CMOWritebackHit | CMOZeroEviction;
|
|
||||||
|
|
||||||
assign FlushFlag = FlushAdrFlag & FlushWayFlag;
|
assign FlushFlag = FlushAdrFlag & FlushWayFlag;
|
||||||
|
|
||||||
|
6
src/cache/cacheway.sv
vendored
6
src/cache/cacheway.sv
vendored
@ -51,7 +51,7 @@ module cacheway import cvw::*; #(parameter cvw_t P,
|
|||||||
output logic [LINELEN-1:0] ReadDataLineWay,// This way's read data if valid
|
output logic [LINELEN-1:0] ReadDataLineWay,// This way's read data if valid
|
||||||
output logic HitWay, // This way hits
|
output logic HitWay, // This way hits
|
||||||
output logic ValidWay, // This way is valid
|
output logic ValidWay, // This way is valid
|
||||||
output logic HitWayDirtyWay, // The hit way is dirty
|
output logic HitDirtyWay, // The hit way is dirty
|
||||||
output logic DirtyWay , // The selected way is dirty
|
output logic DirtyWay , // The selected way is dirty
|
||||||
output logic [TAGLEN-1:0] TagWay); // This way's tag if valid
|
output logic [TAGLEN-1:0] TagWay); // This way's tag if valid
|
||||||
|
|
||||||
@ -118,8 +118,8 @@ module cacheway import cvw::*; #(parameter cvw_t P,
|
|||||||
|
|
||||||
// AND portion of distributed tag multiplexer
|
// AND portion of distributed tag multiplexer
|
||||||
assign TagWay = SelData ? ReadTag : '0; // AND part of AOMux
|
assign TagWay = SelData ? ReadTag : '0; // AND part of AOMux
|
||||||
assign HitWayDirtyWay = Dirty & ValidWay;
|
assign HitDirtyWay = Dirty & ValidWay;
|
||||||
assign DirtyWay = SelDirty & HitWayDirtyWay;
|
assign DirtyWay = SelDirty & HitDirtyWay;
|
||||||
assign HitWay = ValidWay & (ReadTag == PAdr[PA_BITS-1:OFFSETLEN+INDEXLEN]);
|
assign HitWay = ValidWay & (ReadTag == PAdr[PA_BITS-1:OFFSETLEN+INDEXLEN]);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -146,7 +146,7 @@ module align import cvw::*; #(parameter cvw_t P) (
|
|||||||
|
|
||||||
// shifter (4:1 mux for 32 bit, 8:1 mux for 64 bit)
|
// shifter (4:1 mux for 32 bit, 8:1 mux for 64 bit)
|
||||||
// 8 * is for shifting by bytes not bits
|
// 8 * is for shifting by bytes not bits
|
||||||
assign ShiftAmount = MisalignedM & ~SelHPTW ? {AccessByteOffsetM, 3'b0} : '0; // AND gate
|
assign ShiftAmount = SelHPTW ? '0 : {AccessByteOffsetM, 3'b0}; // AND gate
|
||||||
assign ReadDataWordSpillShiftedM = ReadDataWordSpillAllM >> ShiftAmount;
|
assign ReadDataWordSpillShiftedM = ReadDataWordSpillAllM >> ShiftAmount;
|
||||||
assign DCacheReadDataWordSpillM = ReadDataWordSpillShiftedM[P.LLEN-1:0];
|
assign DCacheReadDataWordSpillM = ReadDataWordSpillShiftedM[P.LLEN-1:0];
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 63 KiB |
Loading…
Reference in New Issue
Block a user