Changed the bus name between dcache and ebu.

This commit is contained in:
Ross Thompson 2021-12-28 15:57:36 -06:00
parent 00ad3a18fb
commit 7044277165
4 changed files with 54 additions and 54 deletions

View File

@ -186,7 +186,7 @@ add wave -noupdate -group AHB -color Gold /testbench/dut/hart/ebu/BusState
add wave -noupdate -group AHB /testbench/dut/hart/ebu/NextBusState add wave -noupdate -group AHB /testbench/dut/hart/ebu/NextBusState
add wave -noupdate -group AHB -expand -group {input requests} /testbench/dut/hart/ebu/AtomicMaskedM add wave -noupdate -group AHB -expand -group {input requests} /testbench/dut/hart/ebu/AtomicMaskedM
add wave -noupdate -group AHB -expand -group {input requests} /testbench/dut/hart/ebu/InstrReadF add wave -noupdate -group AHB -expand -group {input requests} /testbench/dut/hart/ebu/InstrReadF
add wave -noupdate -group AHB -expand -group {input requests} /testbench/dut/hart/ebu/MemSizeM add wave -noupdate -group AHB -expand -group {input requests} /testbench/dut/hart/ebu/LsuBusSize
add wave -noupdate -group AHB /testbench/dut/hart/ebu/HCLK add wave -noupdate -group AHB /testbench/dut/hart/ebu/HCLK
add wave -noupdate -group AHB /testbench/dut/hart/ebu/HRESETn add wave -noupdate -group AHB /testbench/dut/hart/ebu/HRESETn
add wave -noupdate -group AHB /testbench/dut/hart/ebu/HRDATA add wave -noupdate -group AHB /testbench/dut/hart/ebu/HRDATA

View File

@ -45,13 +45,13 @@ module ahblite (
output logic [`XLEN-1:0] InstrRData, output logic [`XLEN-1:0] InstrRData,
output logic InstrAckF, output logic InstrAckF,
// Signals from Data Cache // Signals from Data Cache
input logic [`PA_BITS-1:0] DCtoAHBPAdrM, input logic [`PA_BITS-1:0] LsuBusAdr,
input logic DCtoAHBReadM, input logic LsuBusRead,
input logic DCtoAHBWriteM, input logic LsuBusWrite,
input logic [`XLEN-1:0] DCtoAHBWriteData, input logic [`XLEN-1:0] LsuBusHWDATA,
output logic [`XLEN-1:0] DCfromAHBReadData, output logic [`XLEN-1:0] LsuBusHRDATA,
input logic [1:0] MemSizeM, // *** remove input logic [2:0] LsuBusSize,
output logic DCfromAHBAck, output logic LsuBusAck,
// AHB-Lite external signals // AHB-Lite external signals
(* mark_debug = "true" *) input logic [`AHBW-1:0] HRDATA, (* mark_debug = "true" *) input logic [`AHBW-1:0] HRDATA,
(* mark_debug = "true" *) input logic HREADY, HRESP, (* mark_debug = "true" *) input logic HREADY, HRESP,
@ -98,8 +98,8 @@ module ahblite (
// interface that might be used in place of the ahblite. // interface that might be used in place of the ahblite.
always_comb always_comb
case (BusState) case (BusState)
IDLE: if (DCtoAHBReadM) NextBusState = MEMREAD; // Memory has priority over instructions IDLE: if (LsuBusRead) NextBusState = MEMREAD; // Memory has priority over instructions
else if (DCtoAHBWriteM)NextBusState = MEMWRITE; else if (LsuBusWrite)NextBusState = MEMWRITE;
else if (InstrReadF) NextBusState = INSTRREAD; else if (InstrReadF) NextBusState = INSTRREAD;
else NextBusState = IDLE; else NextBusState = IDLE;
MEMREAD: if (~HREADY) NextBusState = MEMREAD; MEMREAD: if (~HREADY) NextBusState = MEMREAD;
@ -116,17 +116,17 @@ module ahblite (
// bus outputs // bus outputs
assign #1 GrantData = (NextBusState == MEMREAD) || (NextBusState == MEMWRITE); assign #1 GrantData = (NextBusState == MEMREAD) || (NextBusState == MEMWRITE);
assign #1 AccessAddress = (GrantData) ? DCtoAHBPAdrM[31:0] : InstrPAdrF[31:0]; assign #1 AccessAddress = (GrantData) ? LsuBusAdr[31:0] : InstrPAdrF[31:0];
assign #1 HADDR = AccessAddress; assign #1 HADDR = AccessAddress;
assign ISize = 3'b010; // 32 bit instructions for now; later improve for filling cache with full width; ignored on reads anyway assign ISize = 3'b010; // 32 bit instructions for now; later improve for filling cache with full width; ignored on reads anyway
assign HSIZE = (GrantData) ? {1'b0, MemSizeM} : ISize; assign HSIZE = (GrantData) ? {1'b0, LsuBusSize[1:0]} : ISize;
assign HBURST = 3'b000; // Single burst only supported; consider generalizing for cache fillsfH assign HBURST = 3'b000; // Single burst only supported; consider generalizing for cache fillsfH
assign HPROT = 4'b0011; // not used; see Section 3.7 assign HPROT = 4'b0011; // not used; see Section 3.7
assign HTRANS = (NextBusState != IDLE) ? 2'b10 : 2'b00; // NONSEQ if reading or writing, IDLE otherwise assign HTRANS = (NextBusState != IDLE) ? 2'b10 : 2'b00; // NONSEQ if reading or writing, IDLE otherwise
assign HMASTLOCK = 0; // no locking supported assign HMASTLOCK = 0; // no locking supported
assign HWRITE = NextBusState == MEMWRITE; assign HWRITE = NextBusState == MEMWRITE;
// delay write data by one cycle for // delay write data by one cycle for
flop #(`XLEN) wdreg(HCLK, DCtoAHBWriteData, HWDATA); // delay HWDATA by 1 cycle per spec; *** assumes AHBW = XLEN flop #(`XLEN) wdreg(HCLK, LsuBusHWDATA, HWDATA); // delay HWDATA by 1 cycle per spec; *** assumes AHBW = XLEN
// delay signals for subword writes // delay signals for subword writes
flop #(3) adrreg(HCLK, HADDR[2:0], HADDRD); flop #(3) adrreg(HCLK, HADDR[2:0], HADDRD);
flop #(4) sizereg(HCLK, {UnsignedLoadM, HSIZE}, HSIZED); flop #(4) sizereg(HCLK, {UnsignedLoadM, HSIZE}, HSIZED);
@ -137,8 +137,8 @@ module ahblite (
assign InstrRData = HRDATA; assign InstrRData = HRDATA;
assign DCfromAHBReadData = HRDATA; assign LsuBusHRDATA = HRDATA;
assign InstrAckF = (BusState == INSTRREAD) && (NextBusState != INSTRREAD); assign InstrAckF = (BusState == INSTRREAD) && (NextBusState != INSTRREAD);
assign DCfromAHBAck = (BusState == MEMREAD) && (NextBusState != MEMREAD) || (BusState == MEMWRITE) && (NextBusState != MEMWRITE); assign LsuBusAck = (BusState == MEMREAD) && (NextBusState != MEMREAD) || (BusState == MEMWRITE) && (NextBusState != MEMWRITE);
endmodule endmodule

View File

@ -63,13 +63,13 @@ module lsu
output logic StoreMisalignedFaultM, StoreAccessFaultM, output logic StoreMisalignedFaultM, StoreAccessFaultM,
// connect to ahb // connect to ahb
(* mark_debug = "true" *) output logic [`PA_BITS-1:0] DCtoAHBPAdrM, (* mark_debug = "true" *) output logic [`PA_BITS-1:0] LsuBusAdr,
output logic DCtoAHBReadM, output logic LsuBusRead,
output logic DCtoAHBWriteM, output logic LsuBusWrite,
input logic DCfromAHBAck, input logic LsuBusAck,
(* mark_debug = "true" *) input logic [`XLEN-1:0] DCfromAHBReadData, (* mark_debug = "true" *) input logic [`XLEN-1:0] LsuBusHRDATA,
output logic [`XLEN-1:0] DCtoAHBWriteData, output logic [`XLEN-1:0] LsuBusHWDATA,
output logic [2:0] DCtoAHBSizeM, output logic [2:0] LsuBusSize,
// mmu management // mmu management
@ -410,11 +410,11 @@ module lsu
.HWDATAIN(FinalAMOWriteDataM), .HWDATAIN(FinalAMOWriteDataM),
.HWDATA(FinalWriteDataM)); .HWDATA(FinalWriteDataM));
assign DCtoAHBWriteData = CacheableM | SelFlush ? DC_HWDATA_FIXNAME : WriteDataM; assign LsuBusHWDATA = CacheableM | SelFlush ? DC_HWDATA_FIXNAME : WriteDataM;
generate generate
if (`XLEN == 32) assign DCtoAHBSizeM = CacheableM | SelFlush ? 3'b010 : LsuFunct3M; if (`XLEN == 32) assign LsuBusSize = CacheableM | SelFlush ? 3'b010 : LsuFunct3M;
else assign DCtoAHBSizeM = CacheableM | SelFlush ? 3'b011 : LsuFunct3M; else assign LsuBusSize = CacheableM | SelFlush ? 3'b011 : LsuFunct3M;
endgenerate; endgenerate;
// Bus Side logic // Bus Side logic
@ -426,8 +426,8 @@ module lsu
generate generate
for (index = 0; index < WORDSPERLINE; index++) begin:fetchbuffer for (index = 0; index < WORDSPERLINE; index++) begin:fetchbuffer
flopen #(`XLEN) fb(.clk(clk), flopen #(`XLEN) fb(.clk(clk),
.en(DCfromAHBAck & DCtoAHBReadM & (index == FetchCount)), .en(LsuBusAck & LsuBusRead & (index == FetchCount)),
.d(DCfromAHBReadData), .d(LsuBusHRDATA),
.q(DCacheMemWriteData[(index+1)*`XLEN-1:index*`XLEN])); .q(DCacheMemWriteData[(index+1)*`XLEN-1:index*`XLEN]));
end end
endgenerate endgenerate
@ -438,12 +438,12 @@ module lsu
assign BasePAdrOffsetM = CacheableM ? {{OFFSETLEN}{1'b0}} : BasePAdrM[OFFSETLEN-1:0]; assign BasePAdrOffsetM = CacheableM ? {{OFFSETLEN}{1'b0}} : BasePAdrM[OFFSETLEN-1:0];
assign BasePAdrMaskedM = {BasePAdrM[`PA_BITS-1:OFFSETLEN], BasePAdrOffsetM}; assign BasePAdrMaskedM = {BasePAdrM[`PA_BITS-1:OFFSETLEN], BasePAdrOffsetM};
assign DCtoAHBPAdrM = ({{`PA_BITS-LOGWPL{1'b0}}, FetchCount} << $clog2(`XLEN/8)) + BasePAdrMaskedM; assign LsuBusAdr = ({{`PA_BITS-LOGWPL{1'b0}}, FetchCount} << $clog2(`XLEN/8)) + BasePAdrMaskedM;
assign DC_HWDATA_FIXNAME = ReadDataBlockSetsM[FetchCount]; assign DC_HWDATA_FIXNAME = ReadDataBlockSetsM[FetchCount];
assign FetchCountFlag = (FetchCount == FetchCountThreshold[LOGWPL-1:0]); assign FetchCountFlag = (FetchCount == FetchCountThreshold[LOGWPL-1:0]);
assign CntEn = PreCntEn & DCfromAHBAck; assign CntEn = PreCntEn & LsuBusAck;
flopenr #(LOGWPL) flopenr #(LOGWPL)
FetchCountReg(.clk(clk), FetchCountReg(.clk(clk),
@ -473,8 +473,8 @@ module lsu
CntReset = 1'b0; CntReset = 1'b0;
BusStall = 1'b0; BusStall = 1'b0;
PreCntEn = 1'b0; PreCntEn = 1'b0;
DCtoAHBWriteM = 1'b0; LsuBusWrite = 1'b0;
DCtoAHBReadM = 1'b0; LsuBusRead = 1'b0;
CommittedMfromBus = 1'b0; CommittedMfromBus = 1'b0;
BUSACK = 1'b0; BUSACK = 1'b0;
SelUncached = 1'b0; SelUncached = 1'b0;
@ -489,14 +489,14 @@ module lsu
BusNextState = STATE_BUS_UNCACHED_WRITE; BusNextState = STATE_BUS_UNCACHED_WRITE;
CntReset = 1'b1; CntReset = 1'b1;
BusStall = 1'b1; BusStall = 1'b1;
DCtoAHBWriteM = 1'b1; LsuBusWrite = 1'b1;
end end
// uncached read // uncached read
else if(DCRWM[1] & ~CacheableM) begin else if(DCRWM[1] & ~CacheableM) begin
BusNextState = STATE_BUS_UNCACHED_READ; BusNextState = STATE_BUS_UNCACHED_READ;
CntReset = 1'b1; CntReset = 1'b1;
BusStall = 1'b1; BusStall = 1'b1;
DCtoAHBReadM = 1'b1; LsuBusRead = 1'b1;
end end
// D$ Fetch Line // D$ Fetch Line
else if(DCFetchLine) begin else if(DCFetchLine) begin
@ -514,9 +514,9 @@ module lsu
STATE_BUS_UNCACHED_WRITE : begin STATE_BUS_UNCACHED_WRITE : begin
BusStall = 1'b1; BusStall = 1'b1;
DCtoAHBWriteM = 1'b1; LsuBusWrite = 1'b1;
CommittedMfromBus = 1'b1; CommittedMfromBus = 1'b1;
if(DCfromAHBAck) begin if(LsuBusAck) begin
BusNextState = STATE_BUS_UNCACHED_WRITE_DONE; BusNextState = STATE_BUS_UNCACHED_WRITE_DONE;
end else begin end else begin
BusNextState = STATE_BUS_UNCACHED_WRITE; BusNextState = STATE_BUS_UNCACHED_WRITE;
@ -525,9 +525,9 @@ module lsu
STATE_BUS_UNCACHED_READ: begin STATE_BUS_UNCACHED_READ: begin
BusStall = 1'b1; BusStall = 1'b1;
DCtoAHBReadM = 1'b1; LsuBusRead = 1'b1;
CommittedMfromBus = 1'b1; CommittedMfromBus = 1'b1;
if(DCfromAHBAck) begin if(LsuBusAck) begin
BusNextState = STATE_BUS_UNCACHED_READ_DONE; BusNextState = STATE_BUS_UNCACHED_READ_DONE;
end else begin end else begin
BusNextState = STATE_BUS_UNCACHED_READ; BusNextState = STATE_BUS_UNCACHED_READ;
@ -547,10 +547,10 @@ module lsu
STATE_BUS_FETCH: begin STATE_BUS_FETCH: begin
BusStall = 1'b1; BusStall = 1'b1;
PreCntEn = 1'b1; PreCntEn = 1'b1;
DCtoAHBReadM = 1'b1; LsuBusRead = 1'b1;
CommittedMfromBus = 1'b1; CommittedMfromBus = 1'b1;
if (FetchCountFlag & DCfromAHBAck) begin if (FetchCountFlag & LsuBusAck) begin
BusNextState = STATE_BUS_READY; BusNextState = STATE_BUS_READY;
BUSACK = 1'b1; BUSACK = 1'b1;
end else begin end else begin
@ -561,9 +561,9 @@ module lsu
STATE_BUS_WRITE: begin STATE_BUS_WRITE: begin
BusStall = 1'b1; BusStall = 1'b1;
PreCntEn = 1'b1; PreCntEn = 1'b1;
DCtoAHBWriteM = 1'b1; LsuBusWrite = 1'b1;
CommittedMfromBus = 1'b1; CommittedMfromBus = 1'b1;
if(FetchCountFlag & DCfromAHBAck) begin if(FetchCountFlag & LsuBusAck) begin
BusNextState = STATE_BUS_READY; BusNextState = STATE_BUS_READY;
BUSACK = 1'b1; BUSACK = 1'b1;
end else begin end else begin

View File

@ -134,12 +134,12 @@ module wallypipelinedhart (
logic InstrAckF; logic InstrAckF;
// AHB LSU interface // AHB LSU interface
logic [`PA_BITS-1:0] DCtoAHBPAdrM; logic [`PA_BITS-1:0] LsuBusAdr;
logic DCtoAHBReadM; logic LsuBusRead;
logic DCtoAHBWriteM; logic LsuBusWrite;
logic DCfromAHBAck; logic LsuBusAck;
logic [`XLEN-1:0] DCfromAHBReadData; logic [`XLEN-1:0] LsuBusHRDATA;
logic [`XLEN-1:0] DCtoAHBWriteData; logic [`XLEN-1:0] LsuBusHWDATA;
logic BPPredWrongE; logic BPPredWrongE;
logic BPPredDirWrongM; logic BPPredDirWrongM;
@ -148,7 +148,7 @@ module wallypipelinedhart (
logic BPPredClassNonCFIWrongM; logic BPPredClassNonCFIWrongM;
logic [4:0] InstrClassM; logic [4:0] InstrClassM;
logic InstrAccessFaultF; logic InstrAccessFaultF;
logic [2:0] DCtoAHBSizeM; logic [2:0] LsuBusSize;
logic ExceptionM; logic ExceptionM;
logic PendingInterruptM; logic PendingInterruptM;
@ -246,8 +246,8 @@ module wallypipelinedhart (
.IEUAdrE, .IEUAdrM, .WriteDataM, .IEUAdrE, .IEUAdrM, .WriteDataM,
.ReadDataM, .FlushDCacheM, .ReadDataM, .FlushDCacheM,
// connected to ahb (all stay the same) // connected to ahb (all stay the same)
.DCtoAHBPAdrM, .DCtoAHBReadM, .DCtoAHBWriteM, .DCfromAHBAck, .LsuBusAdr, .LsuBusRead, .LsuBusWrite, .LsuBusAck,
.DCfromAHBReadData, .DCtoAHBWriteData, .DCtoAHBSizeM, .LsuBusHRDATA, .LsuBusHWDATA, .LsuBusSize,
// connect to csr or privilege and stay the same. // connect to csr or privilege and stay the same.
.PrivilegeModeW, // connects to csr .PrivilegeModeW, // connects to csr
@ -280,10 +280,10 @@ module wallypipelinedhart (
.InstrPAdrF, // *** rename these to match block diagram .InstrPAdrF, // *** rename these to match block diagram
.InstrReadF, .InstrRData, .InstrAckF, .InstrReadF, .InstrRData, .InstrAckF,
// Signals from Data Cache // Signals from Data Cache
.DCtoAHBPAdrM, .DCtoAHBReadM, .DCtoAHBWriteM, .DCtoAHBWriteData, .LsuBusAdr, .LsuBusRead, .LsuBusWrite, .LsuBusHWDATA,
.DCfromAHBReadData, .LsuBusHRDATA,
.MemSizeM(DCtoAHBSizeM[1:0]), // *** remove .LsuBusSize,
.DCfromAHBAck, .LsuBusAck,
.HRDATA, .HREADY, .HRESP, .HCLK, .HRESETn, .HRDATA, .HREADY, .HRESP, .HCLK, .HRESETn,
.HADDR, .HWDATA, .HWRITE, .HSIZE, .HBURST, .HADDR, .HWDATA, .HWRITE, .HSIZE, .HBURST,