2021-06-23 05:41:00 +00:00
|
|
|
///////////////////////////////////////////
|
|
|
|
// lsu.sv
|
|
|
|
//
|
|
|
|
// Written: David_Harris@hmc.edu 9 January 2021
|
|
|
|
// Modified:
|
|
|
|
//
|
|
|
|
// Purpose: Load/Store Unit
|
2022-01-20 16:02:08 +00:00
|
|
|
// Top level of the memory-stage core logic
|
2021-06-23 05:41:00 +00:00
|
|
|
// Contains data cache, DTLB, subword read/write datapath, interface to external bus
|
|
|
|
//
|
|
|
|
// A component of the Wally configurable RISC-V project.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2021 Harvey Mudd College & Oklahoma State University
|
|
|
|
//
|
2022-01-07 12:58:40 +00:00
|
|
|
// MIT LICENSE
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
|
|
// software and associated documentation files (the "Software"), to deal in the Software
|
|
|
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
|
|
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
|
|
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
2021-06-23 05:41:00 +00:00
|
|
|
//
|
2022-01-07 12:58:40 +00:00
|
|
|
// The above copyright notice and this permission notice shall be included in all copies or
|
|
|
|
// substantial portions of the Software.
|
2021-06-23 05:41:00 +00:00
|
|
|
//
|
2022-01-07 12:58:40 +00:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
|
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
|
|
// OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
2021-06-23 05:41:00 +00:00
|
|
|
|
|
|
|
`include "wally-config.vh"
|
|
|
|
|
2022-01-15 01:19:44 +00:00
|
|
|
module lsu (
|
2022-01-31 18:11:42 +00:00
|
|
|
input logic clk, reset,
|
|
|
|
input logic StallM, FlushM, StallW, FlushW,
|
|
|
|
output logic LSUStallM,
|
2021-07-06 15:41:36 +00:00
|
|
|
// connected to cpu (controls)
|
2022-01-31 18:11:42 +00:00
|
|
|
input logic [1:0] MemRWM,
|
|
|
|
input logic [2:0] Funct3M,
|
|
|
|
input logic [6:0] Funct7M,
|
|
|
|
input logic [1:0] AtomicM,
|
|
|
|
input logic TrapM,
|
|
|
|
input logic FlushDCacheM,
|
|
|
|
output logic CommittedM,
|
|
|
|
output logic SquashSCW,
|
|
|
|
output logic DCacheMiss,
|
|
|
|
output logic DCacheAccess,
|
2021-07-06 15:41:36 +00:00
|
|
|
// address and write data
|
2022-01-31 18:11:42 +00:00
|
|
|
input logic [`XLEN-1:0] IEUAdrE,
|
|
|
|
(* mark_debug = "true" *)output logic [`XLEN-1:0] IEUAdrM,
|
|
|
|
input logic [`XLEN-1:0] WriteDataM,
|
|
|
|
output logic [`XLEN-1:0] ReadDataM,
|
2021-07-06 15:41:36 +00:00
|
|
|
// cpu privilege
|
2022-01-31 18:11:42 +00:00
|
|
|
input logic [1:0] PrivilegeModeW,
|
|
|
|
input logic DTLBFlushM,
|
2021-07-06 15:41:36 +00:00
|
|
|
// faults
|
2022-01-31 18:11:42 +00:00
|
|
|
output logic LoadPageFaultM, StoreAmoPageFaultM,
|
|
|
|
output logic LoadMisalignedFaultM, LoadAccessFaultM,
|
2021-07-06 15:41:36 +00:00
|
|
|
// cpu hazard unit (trap)
|
2022-01-31 18:11:42 +00:00
|
|
|
output logic StoreAmoMisalignedFaultM, StoreAmoAccessFaultM,
|
|
|
|
// connect to ahb
|
|
|
|
(* mark_debug = "true" *) output logic [`PA_BITS-1:0] LSUBusAdr,
|
|
|
|
(* mark_debug = "true" *) output logic LSUBusRead,
|
|
|
|
(* mark_debug = "true" *) output logic LSUBusWrite,
|
|
|
|
(* mark_debug = "true" *) input logic LSUBusAck,
|
|
|
|
(* mark_debug = "true" *) input logic [`XLEN-1:0] LSUBusHRDATA,
|
|
|
|
(* mark_debug = "true" *) output logic [`XLEN-1:0] LSUBusHWDATA,
|
|
|
|
(* mark_debug = "true" *) output logic [2:0] LSUBusSize,
|
|
|
|
// page table walker
|
|
|
|
input logic [`XLEN-1:0] SATP_REGW, // from csr
|
|
|
|
input logic STATUS_MXR, STATUS_SUM, STATUS_MPRV,
|
|
|
|
input logic [1:0] STATUS_MPP,
|
|
|
|
input logic [`XLEN-1:0] PCF,
|
|
|
|
input logic ITLBMissF,
|
2022-02-17 05:37:36 +00:00
|
|
|
input logic InstrDAPageFaultF,
|
2022-01-31 18:11:42 +00:00
|
|
|
output logic [`XLEN-1:0] PTE,
|
|
|
|
output logic [1:0] PageType,
|
|
|
|
output logic ITLBWriteF,
|
|
|
|
input var logic [7:0] PMPCFG_ARRAY_REGW[`PMP_ENTRIES-1:0],
|
|
|
|
input var logic [`XLEN-1:0] PMPADDR_ARRAY_REGW[`PMP_ENTRIES-1:0] // *** this one especially has a large note attached to it in pmpchecker.
|
2022-01-15 01:19:44 +00:00
|
|
|
);
|
2021-07-06 15:41:36 +00:00
|
|
|
|
2022-01-31 19:16:23 +00:00
|
|
|
logic [`XLEN+1:0] IEUAdrExtM;
|
|
|
|
logic [`PA_BITS-1:0] LSUPAdrM;
|
2022-01-31 18:11:42 +00:00
|
|
|
logic DTLBMissM;
|
|
|
|
logic DTLBWriteM;
|
|
|
|
logic [1:0] LSURWM;
|
|
|
|
logic [1:0] PreLSURWM;
|
|
|
|
logic [2:0] LSUFunct3M;
|
|
|
|
logic [6:0] LSUFunct7M;
|
|
|
|
logic [1:0] LSUAtomicM;
|
|
|
|
(* mark_debug = "true" *) logic [`PA_BITS-1:0] PreLSUPAdrM;
|
|
|
|
logic [11:0] PreLSUAdrE, LSUAdrE;
|
|
|
|
logic CPUBusy;
|
|
|
|
logic DCacheStallM;
|
|
|
|
logic CacheableM;
|
|
|
|
logic SelHPTW;
|
|
|
|
logic BusStall;
|
|
|
|
logic InterlockStall;
|
2022-02-10 01:20:10 +00:00
|
|
|
logic IgnoreRequestTLB, IgnoreRequestTrapM;
|
2022-01-31 18:11:42 +00:00
|
|
|
logic BusCommittedM, DCacheCommittedM;
|
2022-02-10 17:11:16 +00:00
|
|
|
logic LSUBusWriteCrit;
|
2022-02-17 05:37:36 +00:00
|
|
|
logic DataDAPageFaultM;
|
2022-02-21 15:31:29 +00:00
|
|
|
logic [`XLEN-1:0] LSUWriteDataM;
|
2022-03-11 00:44:50 +00:00
|
|
|
logic [(`XLEN-1)/8:0] ByteMaskM;
|
2022-03-10 21:48:31 +00:00
|
|
|
|
2022-03-12 00:09:22 +00:00
|
|
|
// *** TO DO: Burst mode
|
2022-03-04 00:07:31 +00:00
|
|
|
|
2022-01-15 00:24:16 +00:00
|
|
|
flopenrc #(`XLEN) AddressMReg(clk, reset, FlushM, ~StallM, IEUAdrE, IEUAdrM);
|
2022-01-31 19:16:23 +00:00
|
|
|
assign IEUAdrExtM = {2'b00, IEUAdrM};
|
|
|
|
assign LSUStallM = DCacheStallM | InterlockStall | BusStall;
|
2022-01-31 18:11:42 +00:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// HPTW and Interlock FSM (only needed if VM supported)
|
|
|
|
// MMU include PMP and is needed if any privileged supported
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
2022-01-05 16:25:08 +00:00
|
|
|
|
2022-02-03 01:08:34 +00:00
|
|
|
if(`VIRTMEM_SUPPORTED) begin : VIRTMEM_SUPPORTED
|
2022-01-31 17:56:03 +00:00
|
|
|
lsuvirtmem lsuvirtmem(.clk, .reset, .StallW, .MemRWM, .AtomicM, .ITLBMissF, .ITLBWriteF,
|
2022-03-04 00:07:31 +00:00
|
|
|
.DTLBMissM, .DTLBWriteM, .InstrDAPageFaultF, .DataDAPageFaultM,
|
|
|
|
.TrapM, .DCacheStallM, .SATP_REGW, .PCF,
|
|
|
|
.STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP, .PrivilegeModeW,
|
|
|
|
.ReadDataM, .WriteDataM, .Funct3M, .LSUFunct3M, .Funct7M, .LSUFunct7M,
|
|
|
|
.IEUAdrExtM, .PTE, .LSUWriteDataM, .PageType, .PreLSURWM, .LSUAtomicM, .IEUAdrE,
|
|
|
|
.LSUAdrE, .PreLSUPAdrM, .CPUBusy, .InterlockStall, .SelHPTW,
|
|
|
|
.IgnoreRequestTLB, .IgnoreRequestTrapM);
|
2022-01-31 18:11:42 +00:00
|
|
|
end else begin
|
2022-02-10 01:20:10 +00:00
|
|
|
assign {InterlockStall, SelHPTW, PTE, PageType, DTLBWriteM, ITLBWriteF, IgnoreRequestTLB} = '0;
|
|
|
|
assign IgnoreRequestTrapM = TrapM; assign CPUBusy = StallW; assign PreLSURWM = MemRWM;
|
2022-01-31 19:16:23 +00:00
|
|
|
assign LSUAdrE = PreLSUAdrE; assign PreLSUAdrE = IEUAdrE[11:0];
|
|
|
|
assign PreLSUPAdrM = IEUAdrExtM[`PA_BITS-1:0];
|
|
|
|
assign LSUFunct3M = Funct3M; assign LSUFunct7M = Funct7M; assign LSUAtomicM = AtomicM;
|
2022-02-21 15:31:29 +00:00
|
|
|
assign LSUWriteDataM = WriteDataM;
|
2022-01-15 00:24:16 +00:00
|
|
|
end
|
2021-07-04 18:49:38 +00:00
|
|
|
|
2022-02-10 17:40:10 +00:00
|
|
|
// CommittedM tells the CPU's privilege unit the current instruction
|
2021-12-29 23:40:24 +00:00
|
|
|
// in the memory stage is a memory operaton and that memory operation is either completed
|
2022-02-10 17:40:10 +00:00
|
|
|
// or is partially executed. Partially completed memory operations need to prevent an interrupts.
|
|
|
|
// There is not a clean way to restore back to a partial executed instruction. CommiteedM will
|
|
|
|
// delay the interrupt until the LSU is in a clean state.
|
2021-12-29 17:21:44 +00:00
|
|
|
assign CommittedM = SelHPTW | DCacheCommittedM | BusCommittedM;
|
2021-12-28 22:14:10 +00:00
|
|
|
|
2022-01-14 23:02:28 +00:00
|
|
|
// MMU and Misalignment fault logic required if privileged unit exists
|
2022-01-05 16:25:08 +00:00
|
|
|
if(`ZICSR_SUPPORTED == 1) begin : dmmu
|
2022-02-19 20:38:17 +00:00
|
|
|
logic DisableTranslation;
|
|
|
|
assign DisableTranslation = SelHPTW | FlushDCacheM;
|
2022-01-05 16:25:08 +00:00
|
|
|
mmu #(.TLB_ENTRIES(`DTLB_ENTRIES), .IMMU(0))
|
|
|
|
dmmu(.clk, .reset, .SATP_REGW, .STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP,
|
2022-02-19 20:38:17 +00:00
|
|
|
.PrivilegeModeW, .DisableTranslation,
|
2022-01-07 04:30:00 +00:00
|
|
|
.PAdr(PreLSUPAdrM),
|
2022-01-05 16:25:08 +00:00
|
|
|
.VAdr(IEUAdrM),
|
2022-01-07 04:30:00 +00:00
|
|
|
.Size(LSUFunct3M[1:0]),
|
2022-01-05 16:25:08 +00:00
|
|
|
.PTE,
|
|
|
|
.PageTypeWriteVal(PageType),
|
|
|
|
.TLBWrite(DTLBWriteM),
|
|
|
|
.TLBFlush(DTLBFlushM),
|
2022-01-07 04:30:00 +00:00
|
|
|
.PhysicalAddress(LSUPAdrM),
|
2022-01-05 16:25:08 +00:00
|
|
|
.TLBMiss(DTLBMissM),
|
2022-01-28 20:02:05 +00:00
|
|
|
.Cacheable(CacheableM), .Idempotent(), .AtomicAllowed(),
|
2022-01-27 23:11:27 +00:00
|
|
|
.InstrAccessFaultF(), .LoadAccessFaultM, .StoreAmoAccessFaultM,
|
|
|
|
.InstrPageFaultF(),.LoadPageFaultM, .StoreAmoPageFaultM,
|
2022-03-22 21:52:07 +00:00
|
|
|
.LoadMisalignedFaultM, .StoreAmoMisalignedFaultM, // *** these faults need to be supressed during hptw.
|
2022-02-17 05:37:36 +00:00
|
|
|
.DAPageFault(DataDAPageFaultM),
|
2022-02-19 20:38:17 +00:00
|
|
|
// *** 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),
|
2022-01-07 04:30:00 +00:00
|
|
|
.WriteAccessM(PreLSURWM[0]), .ReadAccessM(PreLSURWM[1]),
|
2022-01-28 20:02:05 +00:00
|
|
|
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW);
|
2022-01-05 16:25:08 +00:00
|
|
|
|
|
|
|
end else begin
|
2022-01-27 23:11:27 +00:00
|
|
|
assign {DTLBMissM, LoadAccessFaultM, StoreAmoAccessFaultM, LoadMisalignedFaultM, StoreAmoMisalignedFaultM} = '0;
|
|
|
|
assign {LoadPageFaultM, StoreAmoPageFaultM} = '0;
|
2022-01-28 20:02:05 +00:00
|
|
|
assign LSUPAdrM = PreLSUPAdrM;
|
|
|
|
assign CacheableM = '1;
|
2022-01-05 16:25:08 +00:00
|
|
|
end
|
2021-07-04 18:49:38 +00:00
|
|
|
|
2022-01-31 18:11:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
2022-02-03 15:36:11 +00:00
|
|
|
// Memory System
|
2022-01-14 23:55:27 +00:00
|
|
|
// Either Data Cache or Data Tightly Integrated Memory or just bus interface
|
2022-01-31 18:11:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
2022-02-21 15:31:29 +00:00
|
|
|
logic [`XLEN-1:0] FinalAMOWriteDataM, FinalWriteDataM;
|
2021-12-27 21:56:18 +00:00
|
|
|
logic [`XLEN-1:0] ReadDataWordM;
|
|
|
|
logic [`XLEN-1:0] ReadDataWordMuxM;
|
2022-02-10 17:27:15 +00:00
|
|
|
logic IgnoreRequest;
|
2022-02-19 20:38:17 +00:00
|
|
|
logic SelUncachedAdr;
|
2022-02-10 17:27:15 +00:00
|
|
|
assign IgnoreRequest = IgnoreRequestTLB | IgnoreRequestTrapM;
|
2022-02-05 04:30:04 +00:00
|
|
|
|
2022-02-03 00:41:09 +00:00
|
|
|
if (`DMEM == `MEM_TIM) begin : dtim
|
2022-03-04 00:07:31 +00:00
|
|
|
// *** directly instantiate RAM or ROM here. Instantiate SRAM1P1RW.
|
|
|
|
// Merge SimpleRAM and SRAM1p1rw into one that is good for synthesis and RAM libraries and flops
|
2022-01-31 19:16:23 +00:00
|
|
|
dtim dtim(.clk, .reset, .CPUBusy, .LSURWM, .IEUAdrM, .IEUAdrE, .TrapM, .FinalWriteDataM,
|
|
|
|
.ReadDataWordM, .BusStall, .LSUBusWrite,.LSUBusRead, .BusCommittedM,
|
2022-03-12 06:46:11 +00:00
|
|
|
.DCacheStallM, .DCacheCommittedM, .ByteMaskM, .Cacheable(CacheableM),
|
2022-01-31 19:16:23 +00:00
|
|
|
.DCacheMiss, .DCacheAccess);
|
2022-03-11 21:18:56 +00:00
|
|
|
end
|
|
|
|
if (`DBUS) begin : bus
|
|
|
|
localparam CACHE_ENABLED = `DMEM == `MEM_CACHE;
|
2022-02-22 23:28:26 +00:00
|
|
|
localparam integer WORDSPERLINE = (CACHE_ENABLED) ? `DCACHE_LINELENINBITS/`XLEN : 1;
|
|
|
|
localparam integer LINELEN = (CACHE_ENABLED) ? `DCACHE_LINELENINBITS : `XLEN;
|
|
|
|
localparam integer LOGWPL = (CACHE_ENABLED) ? $clog2(WORDSPERLINE) : 1;
|
2022-02-05 02:42:53 +00:00
|
|
|
logic [LINELEN-1:0] ReadDataLineM;
|
2022-02-13 21:06:18 +00:00
|
|
|
logic [LINELEN-1:0] DCacheBusWriteData;
|
2022-01-31 19:16:23 +00:00
|
|
|
logic [`PA_BITS-1:0] DCacheBusAdr;
|
|
|
|
logic DCacheWriteLine;
|
|
|
|
logic DCacheFetchLine;
|
|
|
|
logic DCacheBusAck;
|
2022-02-05 04:30:04 +00:00
|
|
|
logic SelBus;
|
|
|
|
logic [LOGWPL-1:0] WordCount;
|
|
|
|
|
2022-02-22 23:28:26 +00:00
|
|
|
busdp #(WORDSPERLINE, LINELEN, LOGWPL, CACHE_ENABLED) busdp(
|
2022-02-03 15:36:11 +00:00
|
|
|
.clk, .reset,
|
2022-02-16 21:43:03 +00:00
|
|
|
.LSUBusHRDATA, .LSUBusAck, .LSUBusWrite, .LSUBusRead, .LSUBusSize,
|
2022-02-10 17:11:16 +00:00
|
|
|
.WordCount, .LSUBusWriteCrit,
|
2022-02-05 04:52:51 +00:00
|
|
|
.LSUFunct3M, .LSUBusAdr, .DCacheBusAdr, .DCacheFetchLine,
|
2022-03-08 22:58:26 +00:00
|
|
|
.DCacheWriteLine, .DCacheBusAck, .DCacheBusWriteData, .LSUPAdrM,
|
2022-02-16 21:43:03 +00:00
|
|
|
.SelUncachedAdr, .IgnoreRequest, .LSURWM, .CPUBusy, .CacheableM,
|
2022-02-03 15:36:11 +00:00
|
|
|
.BusStall, .BusCommittedM);
|
2022-02-05 02:42:53 +00:00
|
|
|
|
2022-02-16 21:43:03 +00:00
|
|
|
mux2 #(`XLEN) UnCachedDataMux(.d0(ReadDataWordM), .d1(DCacheBusWriteData[`XLEN-1:0]),
|
|
|
|
.s(SelUncachedAdr), .y(ReadDataWordMuxM));
|
2022-02-19 20:38:17 +00:00
|
|
|
mux2 #(`XLEN) LsuBushwdataMux(.d0(ReadDataWordM), .d1(FinalWriteDataM),
|
2022-02-16 21:43:03 +00:00
|
|
|
.s(SelUncachedAdr), .y(LSUBusHWDATA));
|
2022-01-31 16:11:58 +00:00
|
|
|
|
2022-02-22 23:28:26 +00:00
|
|
|
if(CACHE_ENABLED) begin : dcache
|
2022-01-15 00:39:07 +00:00
|
|
|
cache #(.LINELEN(`DCACHE_LINELENINBITS), .NUMLINES(`DCACHE_WAYSIZEINBYTES*8/LINELEN),
|
2022-03-11 18:44:04 +00:00
|
|
|
.NUMWAYS(`DCACHE_NUMWAYS), .LOGWPL(LOGWPL), .WORDLEN(`XLEN), .MUXINTERVAL(`XLEN), .DCACHE(1)) dcache(
|
2022-03-11 17:03:36 +00:00
|
|
|
.clk, .reset, .CPUBusy, .LSUBusWriteCrit, .RW(LSURWM), .Atomic(LSUAtomicM),
|
2022-02-10 17:27:15 +00:00
|
|
|
.FlushCache(FlushDCacheM), .NextAdr(LSUAdrE), .PAdr(LSUPAdrM),
|
2022-03-11 17:03:36 +00:00
|
|
|
.ByteMask(ByteMaskM), .WordCount,
|
2022-03-08 22:34:02 +00:00
|
|
|
.FinalWriteData(FinalWriteDataM), .Cacheable(CacheableM),
|
2022-02-03 15:36:11 +00:00
|
|
|
.CacheStall(DCacheStallM), .CacheMiss(DCacheMiss), .CacheAccess(DCacheAccess),
|
2022-02-10 17:27:15 +00:00
|
|
|
.IgnoreRequestTLB, .IgnoreRequestTrapM, .CacheCommitted(DCacheCommittedM),
|
2022-03-11 17:03:36 +00:00
|
|
|
.CacheBusAdr(DCacheBusAdr), .ReadDataWord(ReadDataWordM),
|
2022-02-13 21:06:18 +00:00
|
|
|
.CacheBusWriteData(DCacheBusWriteData), .CacheFetchLine(DCacheFetchLine),
|
2022-02-10 17:27:15 +00:00
|
|
|
.CacheWriteLine(DCacheWriteLine), .CacheBusAck(DCacheBusAck), .InvalidateCacheM(1'b0));
|
2022-01-15 00:39:07 +00:00
|
|
|
|
|
|
|
end else begin : passthrough
|
2022-01-31 19:16:23 +00:00
|
|
|
assign {ReadDataWordM, DCacheStallM, DCacheCommittedM, DCacheFetchLine, DCacheWriteLine} = '0;
|
2022-01-15 00:39:07 +00:00
|
|
|
assign DCacheMiss = CacheableM; assign DCacheAccess = CacheableM;
|
|
|
|
end
|
2022-03-11 21:18:56 +00:00
|
|
|
end else begin: nobus // block: bus
|
|
|
|
assign {LSUBusHWDATA, SelUncachedAdr} = '0;
|
|
|
|
assign ReadDataWordMuxM = ReadDataWordM;
|
2022-01-13 23:00:46 +00:00
|
|
|
end
|
2022-01-14 23:55:27 +00:00
|
|
|
|
2022-02-19 20:38:17 +00:00
|
|
|
subwordread subwordread(.ReadDataWordMuxM, .LSUPAdrM(LSUPAdrM[2:0]),
|
|
|
|
.Funct3M(LSUFunct3M), .ReadDataM);
|
|
|
|
|
2022-01-31 18:11:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
2022-01-14 23:55:27 +00:00
|
|
|
// Atomic operations
|
2022-01-31 18:11:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
2022-01-31 18:54:18 +00:00
|
|
|
if (`A_SUPPORTED) begin:atomic
|
2022-02-21 15:31:29 +00:00
|
|
|
atomic atomic(.clk, .reset, .FlushW, .CPUBusy, .ReadDataM, .LSUWriteDataM, .LSUPAdrM,
|
2022-02-10 17:27:15 +00:00
|
|
|
.LSUFunct7M, .LSUFunct3M, .LSUAtomicM, .PreLSURWM, .IgnoreRequest,
|
2022-03-11 00:56:37 +00:00
|
|
|
.FinalAMOWriteDataM, .SquashSCW, .LSURWM);
|
2022-01-14 23:55:27 +00:00
|
|
|
end else begin:lrsc
|
2022-02-21 15:31:29 +00:00
|
|
|
assign SquashSCW = 0; assign LSURWM = PreLSURWM; assign FinalAMOWriteDataM = LSUWriteDataM;
|
2022-01-14 23:55:27 +00:00
|
|
|
end
|
2022-03-11 00:44:50 +00:00
|
|
|
|
|
|
|
subwordwrite subwordwrite(.LSUPAdrM(LSUPAdrM[2:0]),
|
2022-03-11 00:50:03 +00:00
|
|
|
.LSUFunct3M, .FinalAMOWriteDataM, .FinalWriteDataM, .ByteMaskM);
|
2022-03-11 00:44:50 +00:00
|
|
|
|
|
|
|
|
2021-06-23 05:41:00 +00:00
|
|
|
endmodule
|