mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Minor changes to LSU.
This commit is contained in:
parent
0bd533473c
commit
a60332b455
@ -140,10 +140,11 @@ module lsu (
|
|||||||
|
|
||||||
// MMU and Misalignment fault logic required if privileged unit exists
|
// MMU and Misalignment fault logic required if privileged unit exists
|
||||||
if(`ZICSR_SUPPORTED == 1) begin : dmmu
|
if(`ZICSR_SUPPORTED == 1) begin : dmmu
|
||||||
|
logic DisableTranslation;
|
||||||
|
assign DisableTranslation = SelHPTW | FlushDCacheM;
|
||||||
mmu #(.TLB_ENTRIES(`DTLB_ENTRIES), .IMMU(0))
|
mmu #(.TLB_ENTRIES(`DTLB_ENTRIES), .IMMU(0))
|
||||||
dmmu(.clk, .reset, .SATP_REGW, .STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP,
|
dmmu(.clk, .reset, .SATP_REGW, .STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP,
|
||||||
.PrivilegeModeW, .DisableTranslation(SelHPTW | FlushDCacheM),
|
.PrivilegeModeW, .DisableTranslation,
|
||||||
.PAdr(PreLSUPAdrM),
|
.PAdr(PreLSUPAdrM),
|
||||||
.VAdr(IEUAdrM),
|
.VAdr(IEUAdrM),
|
||||||
.Size(LSUFunct3M[1:0]),
|
.Size(LSUFunct3M[1:0]),
|
||||||
@ -158,7 +159,9 @@ module lsu (
|
|||||||
.InstrPageFaultF(),.LoadPageFaultM, .StoreAmoPageFaultM,
|
.InstrPageFaultF(),.LoadPageFaultM, .StoreAmoPageFaultM,
|
||||||
.LoadMisalignedFaultM, .StoreAmoMisalignedFaultM,
|
.LoadMisalignedFaultM, .StoreAmoMisalignedFaultM,
|
||||||
.DAPageFault(DataDAPageFaultM),
|
.DAPageFault(DataDAPageFaultM),
|
||||||
.AtomicAccessM(|LSUAtomicM), .ExecuteAccessF(1'b0), // **** change this to just use PreLSURWM
|
// *** should use LSURWM as this is includes the lr/sc squash. However this introduces a combo loop
|
||||||
|
// from squash, depends on LSUPAdrM, depends on TLBHit, depends on these *AccessM inputs.
|
||||||
|
.AtomicAccessM(|LSUAtomicM), .ExecuteAccessF(1'b0),
|
||||||
.WriteAccessM(PreLSURWM[0]), .ReadAccessM(PreLSURWM[1]),
|
.WriteAccessM(PreLSURWM[0]), .ReadAccessM(PreLSURWM[1]),
|
||||||
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW);
|
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW);
|
||||||
|
|
||||||
@ -177,6 +180,7 @@ module lsu (
|
|||||||
logic [`XLEN-1:0] ReadDataWordM;
|
logic [`XLEN-1:0] ReadDataWordM;
|
||||||
logic [`XLEN-1:0] ReadDataWordMuxM;
|
logic [`XLEN-1:0] ReadDataWordMuxM;
|
||||||
logic IgnoreRequest;
|
logic IgnoreRequest;
|
||||||
|
logic SelUncachedAdr;
|
||||||
assign IgnoreRequest = IgnoreRequestTLB | IgnoreRequestTrapM;
|
assign IgnoreRequest = IgnoreRequestTLB | IgnoreRequestTrapM;
|
||||||
|
|
||||||
if (`DMEM == `MEM_TIM) begin : dtim
|
if (`DMEM == `MEM_TIM) begin : dtim
|
||||||
@ -184,7 +188,7 @@ module lsu (
|
|||||||
.ReadDataWordM, .BusStall, .LSUBusWrite,.LSUBusRead, .BusCommittedM,
|
.ReadDataWordM, .BusStall, .LSUBusWrite,.LSUBusRead, .BusCommittedM,
|
||||||
.ReadDataWordMuxM, .DCacheStallM, .DCacheCommittedM,
|
.ReadDataWordMuxM, .DCacheStallM, .DCacheCommittedM,
|
||||||
.DCacheMiss, .DCacheAccess);
|
.DCacheMiss, .DCacheAccess);
|
||||||
|
assign SelUncachedAdr = '0; // value does not matter.
|
||||||
end else begin : bus
|
end else begin : bus
|
||||||
localparam integer WORDSPERLINE = (`DMEM == `MEM_CACHE) ? `DCACHE_LINELENINBITS/`XLEN : 1;
|
localparam integer WORDSPERLINE = (`DMEM == `MEM_CACHE) ? `DCACHE_LINELENINBITS/`XLEN : 1;
|
||||||
localparam integer LINELEN = (`DMEM == `MEM_CACHE) ? `DCACHE_LINELENINBITS : `XLEN;
|
localparam integer LINELEN = (`DMEM == `MEM_CACHE) ? `DCACHE_LINELENINBITS : `XLEN;
|
||||||
@ -199,7 +203,6 @@ module lsu (
|
|||||||
logic [`PA_BITS-1:0] WordOffsetAddr;
|
logic [`PA_BITS-1:0] WordOffsetAddr;
|
||||||
logic SelBus;
|
logic SelBus;
|
||||||
logic [LOGWPL-1:0] WordCount;
|
logic [LOGWPL-1:0] WordCount;
|
||||||
logic SelUncachedAdr;
|
|
||||||
|
|
||||||
busdp #(WORDSPERLINE, LINELEN, LOGWPL, 1) busdp(
|
busdp #(WORDSPERLINE, LINELEN, LOGWPL, 1) busdp(
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
@ -212,9 +215,12 @@ module lsu (
|
|||||||
|
|
||||||
mux2 #(`XLEN) UnCachedDataMux(.d0(ReadDataWordM), .d1(DCacheBusWriteData[`XLEN-1:0]),
|
mux2 #(`XLEN) UnCachedDataMux(.d0(ReadDataWordM), .d1(DCacheBusWriteData[`XLEN-1:0]),
|
||||||
.s(SelUncachedAdr), .y(ReadDataWordMuxM));
|
.s(SelUncachedAdr), .y(ReadDataWordMuxM));
|
||||||
mux2 #(`XLEN) lsubushwdatamux( .d0(ReadDataWordM), .d1(FinalWriteDataM),
|
mux2 #(`XLEN) LsuBushwdataMux(.d0(ReadDataWordM), .d1(FinalWriteDataM),
|
||||||
.s(SelUncachedAdr), .y(LSUBusHWDATA));
|
.s(SelUncachedAdr), .y(LSUBusHWDATA));
|
||||||
assign WordOffsetAddr = LSUBusWriteCrit ? ({{`PA_BITS-LOGWPL{1'b0}}, WordCount} << $clog2(`XLEN/8)) : LSUPAdrM;
|
mux2 #(`PA_BITS) WordAdrrMux(.d0(LSUPAdrM),
|
||||||
|
.d1({{`PA_BITS-LOGWPL{1'b0}}, WordCount} << $clog2(`XLEN/8)), .s(LSUBusWriteCrit),
|
||||||
|
.y(WordOffsetAddr));
|
||||||
|
|
||||||
|
|
||||||
if(`DMEM == `MEM_CACHE) begin : dcache
|
if(`DMEM == `MEM_CACHE) begin : dcache
|
||||||
logic [1:0] RW, Atomic;
|
logic [1:0] RW, Atomic;
|
||||||
@ -241,24 +247,26 @@ module lsu (
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
subwordread subwordread(.ReadDataWordMuxM, .LSUPAdrM(LSUPAdrM[2:0]),
|
|
||||||
.Funct3M(LSUFunct3M), .ReadDataM);
|
|
||||||
|
|
||||||
if(`DMEM != `MEM_BUS) begin
|
if(`DMEM != `MEM_BUS) begin
|
||||||
logic [`XLEN-1:0] ReadDataWordMaskedM;
|
logic [`XLEN-1:0] ReadDataWordMaskedM;
|
||||||
assign ReadDataWordMaskedM = CacheableM ? ReadDataWordM : '0; // AND-gate
|
assign ReadDataWordMaskedM = SelUncachedAdr ? '0 : ReadDataWordM; // AND-gate
|
||||||
subwordwrite subwordwrite(.HRDATA(ReadDataWordMaskedM), .HADDRD(LSUPAdrM[2:0]),
|
subwordwrite subwordwrite(.HRDATA(ReadDataWordMaskedM), .HADDRD(LSUPAdrM[2:0]),
|
||||||
.HSIZED({LSUFunct3M[2], 1'b0, LSUFunct3M[1:0]}),
|
.HSIZED({LSUFunct3M[2], 1'b0, LSUFunct3M[1:0]}),
|
||||||
.HWDATAIN(FinalAMOWriteDataM), .HWDATA(PostSWWWriteDataM));
|
.HWDATAIN(FinalAMOWriteDataM), .HWDATA(PostSWWWriteDataM));
|
||||||
end else
|
end else
|
||||||
assign PostSWWWriteDataM = FinalAMOWriteDataM;
|
assign PostSWWWriteDataM = FinalAMOWriteDataM;
|
||||||
|
|
||||||
|
subwordread subwordread(.ReadDataWordMuxM, .LSUPAdrM(LSUPAdrM[2:0]),
|
||||||
|
.Funct3M(LSUFunct3M), .ReadDataM);
|
||||||
|
|
||||||
|
|
||||||
assign FinalWriteDataM = SelHPTW ? PTE : PostSWWWriteDataM;
|
assign FinalWriteDataM = SelHPTW ? PTE : PostSWWWriteDataM;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Atomic operations
|
// Atomic operations
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// *** why does this need DTLBMissM?
|
||||||
if (`A_SUPPORTED) begin:atomic
|
if (`A_SUPPORTED) begin:atomic
|
||||||
atomic atomic(.clk, .reset, .FlushW, .CPUBusy, .ReadDataM, .WriteDataM, .LSUPAdrM,
|
atomic atomic(.clk, .reset, .FlushW, .CPUBusy, .ReadDataM, .WriteDataM, .LSUPAdrM,
|
||||||
.LSUFunct7M, .LSUFunct3M, .LSUAtomicM, .PreLSURWM, .IgnoreRequest,
|
.LSUFunct7M, .LSUFunct3M, .LSUAtomicM, .PreLSURWM, .IgnoreRequest,
|
||||||
|
@ -59,7 +59,7 @@ module lsuvirtmem(
|
|||||||
output logic [1:0] LSUAtomicM,
|
output logic [1:0] LSUAtomicM,
|
||||||
output logic [11:0] LSUAdrE,
|
output logic [11:0] LSUAdrE,
|
||||||
output logic [`PA_BITS-1:0] PreLSUPAdrM,
|
output logic [`PA_BITS-1:0] PreLSUPAdrM,
|
||||||
input logic [`XLEN+1:0] IEUAdrExtM,
|
input logic [`XLEN+1:0] IEUAdrExtM, // *** can move internally.
|
||||||
|
|
||||||
output logic InterlockStall,
|
output logic InterlockStall,
|
||||||
output logic CPUBusy,
|
output logic CPUBusy,
|
||||||
|
Loading…
Reference in New Issue
Block a user