mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Preparing to make a major change to the cache's write enables.
This commit is contained in:
parent
5c9e23527d
commit
e2191e3637
7
pipelined/src/cache/cache.sv
vendored
7
pipelined/src/cache/cache.sv
vendored
@ -121,8 +121,8 @@ 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,
|
.clk, .reset, .RAdr, .PAdr,
|
||||||
.WriteEnable(SRAMWayWriteEnable),
|
.SRAMWayWriteEnable,
|
||||||
.WriteWordEnable(SRAMWordEnable),
|
.SRAMWordEnable,
|
||||||
.TagWriteEnable(SRAMLineWayWriteEnable),
|
.TagWriteEnable(SRAMLineWayWriteEnable),
|
||||||
.WriteData(SRAMWriteData),
|
.WriteData(SRAMWriteData),
|
||||||
.SetValid(SetValidWay), .ClearValid(ClearValidWay), .SetDirty(SetDirtyWay), .ClearDirty(ClearDirtyWay),
|
.SetValid(SetValidWay), .ClearValid(ClearValidWay), .SetDirty(SetDirtyWay), .ClearDirty(ClearDirtyWay),
|
||||||
@ -157,9 +157,12 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, DCACHE = 1) (
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// *** Ross considering restructuring
|
// *** Ross considering restructuring
|
||||||
|
// move decoder and wordwritenable into cacheway.
|
||||||
onehotdecoder #(LOGWPL) adrdec(
|
onehotdecoder #(LOGWPL) adrdec(
|
||||||
.bin(PAdr[LOGWPL+LOGXLENBYTES-1:LOGXLENBYTES]), .decoded(MemPAdrDecoded));
|
.bin(PAdr[LOGWPL+LOGXLENBYTES-1:LOGXLENBYTES]), .decoded(MemPAdrDecoded));
|
||||||
assign SRAMWordEnable = SRAMLineWriteEnable ? '1 : MemPAdrDecoded; // OR
|
assign SRAMWordEnable = SRAMLineWriteEnable ? '1 : MemPAdrDecoded; // OR
|
||||||
|
|
||||||
|
|
||||||
assign SRAMLineWayWriteEnable = SRAMLineWriteEnable ? VictimWay : '0; // AND
|
assign SRAMLineWayWriteEnable = SRAMLineWriteEnable ? VictimWay : '0; // AND
|
||||||
assign SRAMWordWayWriteEnable = SRAMWordWriteEnable ? WayHit : '0; // AND
|
assign SRAMWordWayWriteEnable = SRAMWordWriteEnable ? WayHit : '0; // AND
|
||||||
mux2 #(NUMWAYS) WriteEnableMux(.d0(SRAMWordWayWriteEnable), .d1(VictimWay),
|
mux2 #(NUMWAYS) WriteEnableMux(.d0(SRAMWordWayWriteEnable), .d1(VictimWay),
|
||||||
|
12
pipelined/src/cache/cacheway.sv
vendored
12
pipelined/src/cache/cacheway.sv
vendored
@ -37,8 +37,8 @@ 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 WriteEnable,
|
input logic SRAMWayWriteEnable,
|
||||||
input logic [LINELEN/`XLEN-1:0] WriteWordEnable,
|
input logic [LINELEN/`XLEN-1:0] SRAMWordEnable,
|
||||||
input logic TagWriteEnable,
|
input logic TagWriteEnable,
|
||||||
input logic [LINELEN-1:0] WriteData,
|
input logic [LINELEN-1:0] WriteData,
|
||||||
input logic SetValid,
|
input logic SetValid,
|
||||||
@ -68,7 +68,7 @@ module cacheway #(parameter NUMLINES=512, parameter LINELEN = 256, TAGLEN = 26,
|
|||||||
logic [$clog2(NUMLINES)-1:0] RAdrD;
|
logic [$clog2(NUMLINES)-1:0] RAdrD;
|
||||||
logic SetValidD, ClearValidD;
|
logic SetValidD, ClearValidD;
|
||||||
logic SetDirtyD, ClearDirtyD;
|
logic SetDirtyD, ClearDirtyD;
|
||||||
logic WriteEnableD;
|
logic SRAMWayWriteEnableD;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Tag Array
|
// Tag Array
|
||||||
@ -93,7 +93,7 @@ module cacheway #(parameter NUMLINES=512, parameter LINELEN = 256, TAGLEN = 26,
|
|||||||
sram1rw #(.DEPTH(NUMLINES), .WIDTH(`XLEN)) CacheDataMem(.clk(clk), .Adr(RAdr),
|
sram1rw #(.DEPTH(NUMLINES), .WIDTH(`XLEN)) CacheDataMem(.clk(clk), .Adr(RAdr),
|
||||||
.ReadData(ReadDataLine[(words+1)*`XLEN-1:words*`XLEN] ),
|
.ReadData(ReadDataLine[(words+1)*`XLEN-1:words*`XLEN] ),
|
||||||
.WriteData(WriteData[(words+1)*`XLEN-1:words*`XLEN]),
|
.WriteData(WriteData[(words+1)*`XLEN-1:words*`XLEN]),
|
||||||
.WriteEnable(WriteEnable & WriteWordEnable[words]));
|
.WriteEnable(SRAMWayWriteEnable & SRAMWordEnable[words]));
|
||||||
end
|
end
|
||||||
|
|
||||||
// AND portion of distributed read multiplexers
|
// AND portion of distributed read multiplexers
|
||||||
@ -112,8 +112,8 @@ module cacheway #(parameter NUMLINES=512, parameter LINELEN = 256, TAGLEN = 26,
|
|||||||
end
|
end
|
||||||
// *** consider revisiting whether these delays are the best option?
|
// *** consider revisiting whether these delays are the best option?
|
||||||
flop #($clog2(NUMLINES)) RAdrDelayReg(clk, RAdr, RAdrD);
|
flop #($clog2(NUMLINES)) RAdrDelayReg(clk, RAdr, RAdrD);
|
||||||
flop #(3) ValidCtrlDelayReg(clk, {SetValid, ClearValid, WriteEnable},
|
flop #(3) ValidCtrlDelayReg(clk, {SetValid, ClearValid, SRAMWayWriteEnable},
|
||||||
{SetValidD, ClearValidD, WriteEnableD});
|
{SetValidD, ClearValidD, SRAMWayWriteEnableD});
|
||||||
assign Valid = ValidBits[RAdrD];
|
assign Valid = ValidBits[RAdrD];
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user