mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Eliminated more ports in cacheway.
This commit is contained in:
parent
a440bc2ac5
commit
6e1a0af5d0
5
pipelined/src/cache/cache.sv
vendored
5
pipelined/src/cache/cache.sv
vendored
@ -99,7 +99,6 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, DCACHE = 1) (
|
|||||||
logic ResetOrFlushAdr, ResetOrFlushWay;
|
logic ResetOrFlushAdr, ResetOrFlushWay;
|
||||||
logic [NUMWAYS-1:0] SelectedWay;
|
logic [NUMWAYS-1:0] SelectedWay;
|
||||||
logic [NUMWAYS-1:0] SetValidWay, ClearValidWay, SetDirtyWay, ClearDirtyWay;
|
logic [NUMWAYS-1:0] SetValidWay, ClearValidWay, SetDirtyWay, ClearDirtyWay;
|
||||||
logic [NUMWAYS-1:0] WriteWordWayEn, WriteLineWayEn;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Read Path
|
// Read Path
|
||||||
@ -113,7 +112,7 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, DCACHE = 1) (
|
|||||||
|
|
||||||
// Array of cache ways, along with victim, hit, dirty, and read merging logic
|
// Array of cache ways, along with victim, hit, dirty, and read merging logic
|
||||||
cacheway #(NUMLINES, LINELEN, TAGLEN, OFFSETLEN, SETLEN) CacheWays[NUMWAYS-1:0](
|
cacheway #(NUMLINES, LINELEN, TAGLEN, OFFSETLEN, SETLEN) CacheWays[NUMWAYS-1:0](
|
||||||
.clk, .reset, .RAdr, .PAdr, .WriteWordWayEn, .WriteLineWayEn, .CacheWriteData,
|
.clk, .reset, .RAdr, .PAdr, .CacheWriteData,
|
||||||
.SetValidWay, .ClearValidWay, .SetDirtyWay, .ClearDirtyWay, .SelEvict, .VictimWay,
|
.SetValidWay, .ClearValidWay, .SetDirtyWay, .ClearDirtyWay, .SelEvict, .VictimWay,
|
||||||
.FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .VictimDirtyWay, .VictimTagWay,
|
.FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .VictimDirtyWay, .VictimTagWay,
|
||||||
.Invalidate(InvalidateCacheM));
|
.Invalidate(InvalidateCacheM));
|
||||||
@ -171,8 +170,6 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, DCACHE = 1) (
|
|||||||
assign ClearValidWay = ClearValid ? SelectedWay : '0;
|
assign ClearValidWay = ClearValid ? SelectedWay : '0;
|
||||||
assign SetDirtyWay = SetDirty ? SelectedWay : '0;
|
assign SetDirtyWay = SetDirty ? SelectedWay : '0;
|
||||||
assign ClearDirtyWay = ClearDirty ? SelectedWay : '0;
|
assign ClearDirtyWay = ClearDirty ? SelectedWay : '0;
|
||||||
assign WriteWordWayEn = SetDirty ? SelectedWay : '0;
|
|
||||||
assign WriteLineWayEn = SetValid ? SelectedWay : '0;
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
6
pipelined/src/cache/cacheway.sv
vendored
6
pipelined/src/cache/cacheway.sv
vendored
@ -37,8 +37,6 @@ module cacheway #(parameter NUMLINES=512, parameter LINELEN = 256, TAGLEN = 26,
|
|||||||
|
|
||||||
input logic [$clog2(NUMLINES)-1:0] RAdr,
|
input logic [$clog2(NUMLINES)-1:0] RAdr,
|
||||||
input logic [`PA_BITS-1:0] PAdr,
|
input logic [`PA_BITS-1:0] PAdr,
|
||||||
input logic WriteWordWayEn,
|
|
||||||
input logic WriteLineWayEn,
|
|
||||||
input logic [LINELEN-1:0] CacheWriteData,
|
input logic [LINELEN-1:0] CacheWriteData,
|
||||||
input logic SetValidWay,
|
input logic SetValidWay,
|
||||||
input logic ClearValidWay,
|
input logic ClearValidWay,
|
||||||
@ -78,7 +76,7 @@ module cacheway #(parameter NUMLINES=512, parameter LINELEN = 256, TAGLEN = 26,
|
|||||||
onehotdecoder #(LOGWPL) adrdec(
|
onehotdecoder #(LOGWPL) adrdec(
|
||||||
.bin(PAdr[LOGWPL+LOGXLENBYTES-1:LOGXLENBYTES]), .decoded(MemPAdrDecoded));
|
.bin(PAdr[LOGWPL+LOGXLENBYTES-1:LOGXLENBYTES]), .decoded(MemPAdrDecoded));
|
||||||
// If writing the whole line set all write enables to 1, else only set the correct word.
|
// If writing the whole line set all write enables to 1, else only set the correct word.
|
||||||
assign SelectedWriteWordEn = WriteLineWayEn ? '1 : WriteWordWayEn ? MemPAdrDecoded : '0; // OR-AND
|
assign SelectedWriteWordEn = SetValidWay ? '1 : SetDirtyWay ? MemPAdrDecoded : '0; // OR-AND
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Tag Array
|
// Tag Array
|
||||||
@ -86,7 +84,7 @@ module cacheway #(parameter NUMLINES=512, parameter LINELEN = 256, TAGLEN = 26,
|
|||||||
|
|
||||||
sram1p1rw #(.DEPTH(NUMLINES), .WIDTH(TAGLEN)) CacheTagMem(.clk,
|
sram1p1rw #(.DEPTH(NUMLINES), .WIDTH(TAGLEN)) CacheTagMem(.clk,
|
||||||
.Adr(RAdr), .ReadData(ReadTag),
|
.Adr(RAdr), .ReadData(ReadTag),
|
||||||
.CacheWriteData(PAdr[`PA_BITS-1:OFFSETLEN+INDEXLEN]), .WriteEnable(WriteLineWayEn));
|
.CacheWriteData(PAdr[`PA_BITS-1:OFFSETLEN+INDEXLEN]), .WriteEnable(SetValidWay));
|
||||||
|
|
||||||
// AND portion of distributed tag multiplexer
|
// AND portion of distributed tag multiplexer
|
||||||
mux2 #(1) seltagmux(VictimWay, FlushWay, SelFlush, SelTag);
|
mux2 #(1) seltagmux(VictimWay, FlushWay, SelFlush, SelTag);
|
||||||
|
Loading…
Reference in New Issue
Block a user