Renamed ICacheCntrl to icachefsm.

This commit is contained in:
Ross Thompson 2021-08-26 15:57:17 -05:00
parent cbb47956cb
commit 62d91e9ea1
2 changed files with 14 additions and 23 deletions

View File

@ -103,19 +103,18 @@ module icache
logic SavePC; logic SavePC;
// on spill we want to get the first 2 bytes of the next cache block.
/* -----\/----- EXCLUDED -----\/----- // the spill only occurs if the PCPF mod BlockByteLength == -2. Therefore we can
ICacheMem #(.BLOCKLEN(BLOCKLEN), .NUMLINES(NUMLINES)) // simply add 2 to land on the next cache block.
cachemem(.clk, assign PCPSpillF = PCPF + {{{PA_WIDTH}{1'b0}}, 2'b10}; // *** modelsim does not allow the use of PA_BITS for literal width.
.reset,
.flush(FlushMem), // now we have to select between these three PCs
.PCTagF, assign PCPreFinalF = PCMux[0] | StallF ? PCPF : PCNextF; // *** don't like the stallf, but it is necessary
.PCNextIndexF, // for the data cache i used a cpu busy state which is triggered by StallW. In the case of the icache I
.WriteEnable(ICacheMemWriteEnable), // modified the select on this address mux. Both are not ideal; however the cpu_busy state is required for the
.WriteLine(ICacheMemWriteData), // dcache as a write would repeatedly update the sram or worse for an uncached write multiple times.
.ReadLineF, // I like reducing some complexity of the fsm; however I weight commonality between the i/d cache more.
.HitF(ICacheMemReadValid)); assign PCNextIndexF = PCMux[1] ? PCPSpillF : PCPreFinalF;
-----/\----- EXCLUDED -----/\----- */
cacheway #(.NUMLINES(NUMLINES), .BLOCKLEN(BLOCKLEN), .TAGLEN(TAGLEN), .OFFSETLEN(OFFSETLEN), .INDEXLEN(INDEXLEN), cacheway #(.NUMLINES(NUMLINES), .BLOCKLEN(BLOCKLEN), .TAGLEN(TAGLEN), .OFFSETLEN(OFFSETLEN), .INDEXLEN(INDEXLEN),
.DIRTY_BITS(0)) .DIRTY_BITS(0))
@ -226,14 +225,6 @@ module icache
end end
endgenerate endgenerate
// on spill we want to get the first 2 bytes of the next cache block.
// the spill only occurs if the PCPF mod BlockByteLength == -2. Therefore we can
// simply add 2 to land on the next cache block.
assign PCPSpillF = PCPF + {{{PA_WIDTH}{1'b0}}, 2'b10}; // *** modelsim does not allow the use of PA_BITS for literal width.
// now we have to select between these three PCs
assign PCPreFinalF = PCMux[0] | StallF ? PCPF : PCNextF; // *** don't like the stallf, but it is necessary
assign PCNextIndexF = PCMux[1] ? PCPSpillF : PCPreFinalF;
// this mux needs to be delayed 1 cycle as it occurs 1 pipeline stage later. // this mux needs to be delayed 1 cycle as it occurs 1 pipeline stage later.
// *** read enable may not be necessary. // *** read enable may not be necessary.
@ -249,7 +240,7 @@ module icache
assign PCPTrunkF = PCTagF[`PA_BITS-1:OFFSETWIDTH]; assign PCPTrunkF = PCTagF[`PA_BITS-1:OFFSETWIDTH];
ICacheCntrl #(.BLOCKLEN(BLOCKLEN)) icachefsm #(.BLOCKLEN(BLOCKLEN))
controller(.clk, controller(.clk,
.reset, .reset,
.ICacheReadEn, .ICacheReadEn,

View File

@ -25,7 +25,7 @@
`include "wally-config.vh" `include "wally-config.vh"
module ICacheCntrl #(parameter BLOCKLEN = 256) module icachefsm #(parameter BLOCKLEN = 256)
( (
// Inputs from pipeline // Inputs from pipeline
input logic clk, reset, input logic clk, reset,