This commit is contained in:
Kip Macsai-Goren 2022-01-04 18:16:46 +00:00
commit d1709e98d2
7 changed files with 28 additions and 22 deletions

View File

@ -51,7 +51,7 @@ tc = TestCase(
grepstr="400100000 instructions") grepstr="400100000 instructions")
configs.append(tc) configs.append(tc)
tests64gc = ["arch64i", "arch64priv", "arch64c", "arch64m", "arch64d", "imperas64i", "imperas64f", "imperas64d", "imperas64p", "imperas64m", "imperas64a", "imperas64c", "wally64priv"] # "wally64i", #, "testsBP64"] tests64gc = ["arch64i", "arch64priv", "arch64c", "arch64m", "arch64d", "imperas64i", "imperas64f", "imperas64d", "imperas64p", "imperas64m", "imperas64a", "imperas64c", "wally64priv", "imperas64mmu"] # "wally64i", #, "testsBP64"]
for test in tests64gc: for test in tests64gc:
tc = TestCase( tc = TestCase(
name=test, name=test,
@ -59,7 +59,7 @@ for test in tests64gc:
cmd="vsim > {} -c <<!\ndo wally-pipelined-batch.do rv64gc "+test+"\n!", cmd="vsim > {} -c <<!\ndo wally-pipelined-batch.do rv64gc "+test+"\n!",
grepstr="All tests ran without failures") grepstr="All tests ran without failures")
configs.append(tc) configs.append(tc)
tests32gc = ["arch32i", "arch32priv", "arch32c", "arch32m", "arch32f", "imperas32i", "imperas32f", "imperas32p", "imperas32m", "imperas32a", "imperas32c", "wally32priv"] #"wally32i", tests32gc = ["arch32i", "arch32priv", "arch32c", "arch32m", "arch32f", "imperas32i", "imperas32f", "imperas32p", "imperas32m", "imperas32a", "imperas32c", "wally32priv", "imperas32mmu"] #"wally32i",
for test in tests32gc: for test in tests32gc:
tc = TestCase( tc = TestCase(
name=test, name=test,

View File

@ -38,9 +38,10 @@ module dcache
input logic FlushDCacheM, input logic FlushDCacheM,
input logic [11:0] LsuAdrE, // virtual address, but we only use the lower 12 bits. input logic [11:0] LsuAdrE, // virtual address, but we only use the lower 12 bits.
input logic [`PA_BITS-1:0] LsuPAdrM, // physical address input logic [`PA_BITS-1:0] LsuPAdrM, // physical address
input logic [11:0] PreLsuPAdrM, // physical or virtual address
input logic [`XLEN-1:0] FinalWriteDataM, input logic [`XLEN-1:0] FinalWriteDataM,
output logic [`XLEN-1:0] ReadDataWordM, output logic [`XLEN-1:0] ReadDataWordM,
output logic DCacheCommittedM, output logic DCacheCommittedM,
// Bus fsm interface // Bus fsm interface
input logic IgnoreRequest, input logic IgnoreRequest,
@ -122,7 +123,7 @@ module dcache
mux3 #(INDEXLEN) mux3 #(INDEXLEN)
AdrSelMux(.d0(LsuAdrE[INDEXLEN+OFFSETLEN-1:OFFSETLEN]), AdrSelMux(.d0(LsuAdrE[INDEXLEN+OFFSETLEN-1:OFFSETLEN]),
.d1(LsuPAdrM[INDEXLEN+OFFSETLEN-1:OFFSETLEN]), // *** optimize change to virtual address. .d1(PreLsuPAdrM[INDEXLEN+OFFSETLEN-1:OFFSETLEN]),
.d2(FlushAdr), .d2(FlushAdr),
.s(SelAdrM), .s(SelAdrM),
.y(RAdr)); .y(RAdr));

View File

@ -35,7 +35,7 @@ module dcachefsm
// hazard inputs // hazard inputs
input logic CPUBusy, input logic CPUBusy,
input logic CacheableM, input logic CacheableM,
// hptw inputs // interlock fsm
input logic IgnoreRequest, input logic IgnoreRequest,
// Bus inputs // Bus inputs
input logic DCacheBusAck, input logic DCacheBusAck,
@ -143,6 +143,7 @@ module dcachefsm
// PTW ready the CPU will stall. // PTW ready the CPU will stall.
// The page table walker asserts it's control 1 cycle // The page table walker asserts it's control 1 cycle
// after the TLBs miss. // after the TLBs miss.
SelAdrM = 2'b01;
NextState = STATE_READY; NextState = STATE_READY;
end end

View File

@ -32,7 +32,8 @@ module icache
input logic CPUBusy, input logic CPUBusy,
// mmu // mmu
input logic CacheableF, //input logic CacheableF,
input logic [1:0] IfuRWF,
// cpu side // cpu side
input logic InvalidateICacheM, input logic InvalidateICacheM,
@ -161,7 +162,7 @@ module icache
.IgnoreRequest, .IgnoreRequest,
.ICacheBusAck, .ICacheBusAck,
.ICacheFetchLine, .ICacheFetchLine,
.CacheableF, .IfuRWF,
.hit, .hit,
.SelAdr, .SelAdr,
.LRUWriteEn); .LRUWriteEn);

View File

@ -27,31 +27,31 @@
module icachefsm module icachefsm
(// Inputs from pipeline (// Inputs from pipeline
input logic clk, reset, input logic clk, reset,
input logic CPUBusy, input logic CPUBusy,
input logic IgnoreRequest, input logic IgnoreRequest,
input logic CacheableF, input logic [1:0] IfuRWF,
// BUS interface // BUS interface
input logic ICacheBusAck, input logic ICacheBusAck,
// icache internal inputs // icache internal inputs
input logic hit, input logic hit,
// Load data into the cache // Load data into the cache
output logic ICacheMemWriteEnable, output logic ICacheMemWriteEnable,
// Outputs to pipeline control stuff // Outputs to pipeline control stuff
output logic ICacheStallF, output logic ICacheStallF,
// Bus interface outputs // Bus interface outputs
output logic ICacheFetchLine, output logic ICacheFetchLine,
// icache internal outputs // icache internal outputs
output logic SelAdr, output logic SelAdr,
output logic LRUWriteEn output logic LRUWriteEn
); );
// FSM states // FSM states
@ -88,7 +88,7 @@ module icachefsm
NextState = STATE_READY; NextState = STATE_READY;
ICacheStallF = 1'b0; ICacheStallF = 1'b0;
end end
else if (CacheableF & hit) begin else if (IfuRWF[1] & hit) begin
ICacheStallF = 1'b0; ICacheStallF = 1'b0;
LRUWriteEn = 1'b1; LRUWriteEn = 1'b1;
if(CPUBusy) begin if(CPUBusy) begin
@ -97,7 +97,7 @@ module icachefsm
end else begin end else begin
NextState = STATE_READY; NextState = STATE_READY;
end end
end else if (CacheableF & ~hit) begin end else if (IfuRWF[1] & ~hit) begin
SelAdr = 1'b1; /// *********( SelAdr = 1'b1; /// *********(
NextState = STATE_MISS_FETCH_WDV; NextState = STATE_MISS_FETCH_WDV;
end else begin end else begin

View File

@ -240,10 +240,13 @@ module ifu (
generate generate
if(`MEM_ICACHE) begin : icache if(`MEM_ICACHE) begin : icache
logic [1:0] IfuRWF;
assign IfuRWF = CacheableF ? 2'b10 : 2'b00;
icache icache(.clk, .reset, .CPUBusy, .IgnoreRequest, .ICacheMemWriteData , .ICacheBusAck, icache icache(.clk, .reset, .CPUBusy, .IgnoreRequest, .ICacheMemWriteData , .ICacheBusAck,
.ICacheBusAdr, .ICacheStallF, .FinalInstrRawF, .ICacheBusAdr, .ICacheStallF, .FinalInstrRawF,
.ICacheFetchLine, .ICacheFetchLine,
.CacheableF, .IfuRWF(IfuRWF), //aways read
.PCNextF(PCNextFMux), .PCNextF(PCNextFMux),
.PCPF(PCPF), .PCPF(PCPF),
.PCF(PCFMux), .PCF(PCFMux),

View File

@ -307,7 +307,7 @@ module lsu
generate generate
if(`MEM_DCACHE) begin : dcache if(`MEM_DCACHE) begin : dcache
dcache dcache(.clk, .reset, .CPUBusy, dcache dcache(.clk, .reset, .CPUBusy,
.LsuRWM, .FlushDCacheM, .LsuAtomicM, .LsuAdrE, .LsuPAdrM, .LsuRWM, .FlushDCacheM, .LsuAtomicM, .LsuAdrE, .LsuPAdrM, .PreLsuPAdrM(PreLsuPAdrM[11:0]), // still don't like this name PreLsuPAdrM, not always physical
.FinalWriteDataM, .ReadDataWordM, .DCacheStall, .FinalWriteDataM, .ReadDataWordM, .DCacheStall,
.DCacheMiss, .DCacheAccess, .DCacheMiss, .DCacheAccess,
.IgnoreRequest, .CacheableM, .DCacheCommittedM, .IgnoreRequest, .CacheableM, .DCacheCommittedM,