mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-24 13:34:28 +00:00
partial dcache reorg.
This commit is contained in:
parent
699053bab0
commit
a99b5f648b
38
wally-pipelined/src/cache/DCacheMem.sv
vendored
38
wally-pipelined/src/cache/DCacheMem.sv
vendored
@ -25,25 +25,28 @@
|
||||
|
||||
`include "wally-config.vh"
|
||||
|
||||
module DCacheMem #(parameter NUMLINES=512, parameter BLOCKLEN = 256, TAGLEN = 26)
|
||||
module DCacheMem #(parameter NUMLINES=512, parameter BLOCKLEN = 256, TAGLEN = 26,
|
||||
parameter OFFSETLEN, parameter INDEXLEN)
|
||||
(input logic clk,
|
||||
input logic reset,
|
||||
input logic reset,
|
||||
|
||||
input logic [$clog2(NUMLINES)-1:0] Adr,
|
||||
input logic WriteEnable,
|
||||
input logic [BLOCKLEN/`XLEN-1:0] WriteWordEnable,
|
||||
input logic TagWriteEnable,
|
||||
input logic [BLOCKLEN-1:0] WriteData,
|
||||
input logic [TAGLEN-1:0] WriteTag,
|
||||
input logic SetValid,
|
||||
input logic ClearValid,
|
||||
input logic SetDirty,
|
||||
input logic ClearDirty,
|
||||
input logic [$clog2(NUMLINES)-1:0] Adr,
|
||||
input logic [`PA_BITS-1:OFFSETLEN+INDEXLEN] MemPAdrM,
|
||||
input logic WriteEnable,
|
||||
input logic [BLOCKLEN/`XLEN-1:0] WriteWordEnable,
|
||||
input logic TagWriteEnable,
|
||||
input logic [BLOCKLEN-1:0] WriteData,
|
||||
input logic [TAGLEN-1:0] WriteTag,
|
||||
input logic SetValid,
|
||||
input logic ClearValid,
|
||||
input logic SetDirty,
|
||||
input logic ClearDirty,
|
||||
|
||||
output logic [BLOCKLEN-1:0] ReadData,
|
||||
output logic [TAGLEN-1:0] ReadTag,
|
||||
output logic Valid,
|
||||
output logic Dirty
|
||||
output logic [BLOCKLEN-1:0] ReadData,
|
||||
output logic [TAGLEN-1:0] ReadTag,
|
||||
output logic Valid,
|
||||
output logic Dirty,
|
||||
output logic WayHit
|
||||
);
|
||||
|
||||
logic [NUMLINES-1:0] ValidBits, DirtyBits;
|
||||
@ -71,6 +74,9 @@ module DCacheMem #(parameter NUMLINES=512, parameter BLOCKLEN = 256, TAGLEN = 26
|
||||
.WriteData(WriteTag),
|
||||
.WriteEnable(TagWriteEnable));
|
||||
|
||||
assign WayHit = Valid & (ReadTag == MemPAdrM[`PA_BITS-1:OFFSETLEN+INDEXLEN]);
|
||||
|
||||
|
||||
|
||||
always_ff @(posedge clk, posedge reset) begin
|
||||
if (reset)
|
||||
|
8
wally-pipelined/src/cache/dcache.sv
vendored
8
wally-pipelined/src/cache/dcache.sv
vendored
@ -208,10 +208,12 @@ module dcache
|
||||
genvar way;
|
||||
generate
|
||||
for(way = 0; way < NUMWAYS; way = way + 1) begin :CacheWays
|
||||
DCacheMem #(.NUMLINES(NUMLINES), .BLOCKLEN(BLOCKLEN), .TAGLEN(TAGLEN))
|
||||
DCacheMem #(.NUMLINES(NUMLINES), .BLOCKLEN(BLOCKLEN), .TAGLEN(TAGLEN),
|
||||
.OFFSETLEN(OFFSETLEN), .INDEXLEN(INDEXLEN))
|
||||
MemWay(.clk(clk),
|
||||
.reset(reset),
|
||||
.Adr(SRAMAdr),
|
||||
.MemPAdrM(MemPAdrM[`PA_BITS-1:OFFSETLEN+INDEXLEN]),
|
||||
.WriteEnable(SRAMWayWriteEnable[way]),
|
||||
.WriteWordEnable(SRAMWordEnable),
|
||||
.TagWriteEnable(SRAMBlockWayWriteEnableM[way]),
|
||||
@ -224,8 +226,8 @@ module dcache
|
||||
.ReadData(ReadDataBlockWayM[way]),
|
||||
.ReadTag(ReadTag[way]),
|
||||
.Valid(Valid[way]),
|
||||
.Dirty(Dirty[way]));
|
||||
assign WayHit[way] = Valid[way] & (ReadTag[way] == MemPAdrM[`PA_BITS-1:OFFSETLEN+INDEXLEN]);
|
||||
.Dirty(Dirty[way]),
|
||||
.WayHit(WayHit[way]));
|
||||
assign SelectedWay[way] = SelEvict ? VictimWay[way] : WayHit[way];
|
||||
assign ReadDataBlockWayMaskedM[way] = SelectedWay[way] ? ReadDataBlockWayM[way] : '0; // first part of AO mux.
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
`include "wally-config.vh"
|
||||
|
||||
module mmu #(parameter TLB_ENTRIES = 8, // nuber of TLB Entries
|
||||
module mmu #(parameter TLB_ENTRIES = 8, // number of TLB Entries
|
||||
parameter IMMU = 0) (
|
||||
|
||||
input logic clk, reset,
|
||||
|
Loading…
Reference in New Issue
Block a user