mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-02 09:45:18 +00:00
csr & wally cleanup
This commit is contained in:
parent
53d0d28828
commit
50fae76207
@ -28,140 +28,140 @@
|
|||||||
/* verilator lint_on UNUSED */
|
/* verilator lint_on UNUSED */
|
||||||
|
|
||||||
module wallypipelinedcore (
|
module wallypipelinedcore (
|
||||||
input logic clk, reset,
|
input logic clk, reset,
|
||||||
// Privileged
|
// Privileged
|
||||||
input logic MTimerInt, MExtInt, SExtInt, MSwInt,
|
input logic MTimerInt, MExtInt, SExtInt, MSwInt,
|
||||||
input logic [63:0] MTIME_CLINT,
|
input logic [63:0] MTIME_CLINT,
|
||||||
// Bus Interface
|
// Bus Interface
|
||||||
input logic [`AHBW-1:0] HRDATA,
|
input logic [`AHBW-1:0] HRDATA,
|
||||||
input logic HREADY, HRESP,
|
input logic HREADY, HRESP,
|
||||||
output logic HCLK, HRESETn,
|
output logic HCLK, HRESETn,
|
||||||
output logic [`PA_BITS-1:0] HADDR,
|
output logic [`PA_BITS-1:0] HADDR,
|
||||||
output logic [`AHBW-1:0] HWDATA,
|
output logic [`AHBW-1:0] HWDATA,
|
||||||
output logic [`XLEN/8-1:0] HWSTRB,
|
output logic [`XLEN/8-1:0] HWSTRB,
|
||||||
output logic HWRITE,
|
output logic HWRITE,
|
||||||
output logic [2:0] HSIZE,
|
output logic [2:0] HSIZE,
|
||||||
output logic [2:0] HBURST,
|
output logic [2:0] HBURST,
|
||||||
output logic [3:0] HPROT,
|
output logic [3:0] HPROT,
|
||||||
output logic [1:0] HTRANS,
|
output logic [1:0] HTRANS,
|
||||||
output logic HMASTLOCK
|
output logic HMASTLOCK
|
||||||
);
|
);
|
||||||
|
|
||||||
logic StallF, StallD, StallE, StallM, StallW;
|
logic StallF, StallD, StallE, StallM, StallW;
|
||||||
logic FlushD, FlushE, FlushM, FlushW;
|
logic FlushD, FlushE, FlushM, FlushW;
|
||||||
logic RetM;
|
logic RetM;
|
||||||
(* mark_debug = "true" *) logic TrapM;
|
(* mark_debug = "true" *) logic TrapM;
|
||||||
|
|
||||||
// new signals that must connect through DP
|
// signals that must connect through DP
|
||||||
logic IntDivE, W64E;
|
logic IntDivE, W64E;
|
||||||
logic CSRReadM, CSRWriteM, PrivilegedM;
|
logic CSRReadM, CSRWriteM, PrivilegedM;
|
||||||
logic [1:0] AtomicM;
|
logic [1:0] AtomicM;
|
||||||
logic [`XLEN-1:0] ForwardedSrcAE, ForwardedSrcBE; //, SrcAE, SrcBE;
|
logic [`XLEN-1:0] ForwardedSrcAE, ForwardedSrcBE;
|
||||||
(* mark_debug = "true" *) logic [`XLEN-1:0] SrcAM;
|
(* mark_debug = "true" *) logic [`XLEN-1:0] SrcAM;
|
||||||
logic [2:0] Funct3E;
|
logic [2:0] Funct3E;
|
||||||
logic [31:0] InstrD;
|
logic [31:0] InstrD;
|
||||||
(* mark_debug = "true" *) logic [31:0] InstrM;
|
(* mark_debug = "true" *) logic [31:0] InstrM;
|
||||||
logic [`XLEN-1:0] PCF, PCE, PCLinkE;
|
logic [`XLEN-1:0] PCF, PCE, PCLinkE;
|
||||||
(* mark_debug = "true" *) logic [`XLEN-1:0] PCM;
|
(* mark_debug = "true" *) logic [`XLEN-1:0] PCM;
|
||||||
logic [`XLEN-1:0] CSRReadValW, MDUResultW;
|
logic [`XLEN-1:0] CSRReadValW, MDUResultW;
|
||||||
logic [`XLEN-1:0] UnalignedPCNextF, PCNext2F;
|
logic [`XLEN-1:0] UnalignedPCNextF, PCNext2F;
|
||||||
(* mark_debug = "true" *) logic [1:0] MemRWM;
|
(* mark_debug = "true" *) logic [1:0] MemRWM;
|
||||||
(* mark_debug = "true" *) logic InstrValidM;
|
(* mark_debug = "true" *) logic InstrValidM;
|
||||||
logic InstrMisalignedFaultM;
|
logic InstrMisalignedFaultM;
|
||||||
logic IllegalBaseInstrFaultD, IllegalIEUInstrFaultD;
|
logic IllegalBaseInstrFaultD, IllegalIEUInstrFaultD;
|
||||||
logic InstrPageFaultF, LoadPageFaultM, StoreAmoPageFaultM;
|
logic InstrPageFaultF, LoadPageFaultM, StoreAmoPageFaultM;
|
||||||
logic LoadMisalignedFaultM, LoadAccessFaultM;
|
logic LoadMisalignedFaultM, LoadAccessFaultM;
|
||||||
logic StoreAmoMisalignedFaultM, StoreAmoAccessFaultM;
|
logic StoreAmoMisalignedFaultM, StoreAmoAccessFaultM;
|
||||||
logic InvalidateICacheM, FlushDCacheM;
|
logic InvalidateICacheM, FlushDCacheM;
|
||||||
logic PCSrcE;
|
logic PCSrcE;
|
||||||
logic CSRWriteFenceM;
|
logic CSRWriteFenceM;
|
||||||
logic DivBusyE;
|
logic DivBusyE;
|
||||||
logic LoadStallD, StoreStallD, MDUStallD, CSRRdStallD;
|
logic LoadStallD, StoreStallD, MDUStallD, CSRRdStallD;
|
||||||
logic SquashSCW;
|
logic SquashSCW;
|
||||||
|
|
||||||
// floating point unit signals
|
// floating point unit signals
|
||||||
logic [2:0] FRM_REGW;
|
logic [2:0] FRM_REGW;
|
||||||
logic [4:0] RdE, RdM, RdW;
|
logic [4:0] RdE, RdM, RdW;
|
||||||
logic FPUStallD;
|
logic FPUStallD;
|
||||||
logic FWriteIntE;
|
logic FWriteIntE;
|
||||||
logic [`FLEN-1:0] FWriteDataM;
|
logic [`FLEN-1:0] FWriteDataM;
|
||||||
logic [`XLEN-1:0] FIntResM;
|
logic [`XLEN-1:0] FIntResM;
|
||||||
logic [`XLEN-1:0] FCvtIntResW;
|
logic [`XLEN-1:0] FCvtIntResW;
|
||||||
logic FCvtIntW;
|
logic FCvtIntW;
|
||||||
logic FDivBusyE;
|
logic FDivBusyE;
|
||||||
logic IllegalFPUInstrM;
|
logic IllegalFPUInstrM;
|
||||||
logic FRegWriteM;
|
logic FRegWriteM;
|
||||||
logic FCvtIntStallD;
|
logic FCvtIntStallD;
|
||||||
logic FpLoadStoreM;
|
logic FpLoadStoreM;
|
||||||
logic [4:0] SetFflagsM;
|
logic [4:0] SetFflagsM;
|
||||||
logic [`XLEN-1:0] FIntDivResultW;
|
logic [`XLEN-1:0] FIntDivResultW;
|
||||||
|
|
||||||
// memory management unit signals
|
// memory management unit signals
|
||||||
logic ITLBWriteF;
|
logic ITLBWriteF;
|
||||||
logic ITLBMissF;
|
logic ITLBMissF;
|
||||||
logic [`XLEN-1:0] SATP_REGW;
|
logic [`XLEN-1:0] SATP_REGW;
|
||||||
logic STATUS_MXR, STATUS_SUM, STATUS_MPRV;
|
logic STATUS_MXR, STATUS_SUM, STATUS_MPRV;
|
||||||
logic [1:0] STATUS_MPP, STATUS_FS;
|
logic [1:0] STATUS_MPP, STATUS_FS;
|
||||||
logic [1:0] PrivilegeModeW;
|
logic [1:0] PrivilegeModeW;
|
||||||
logic [`XLEN-1:0] PTE;
|
logic [`XLEN-1:0] PTE;
|
||||||
logic [1:0] PageType;
|
logic [1:0] PageType;
|
||||||
logic sfencevmaM, WFIStallM;
|
logic sfencevmaM, WFIStallM;
|
||||||
logic SelHPTW;
|
logic SelHPTW;
|
||||||
|
|
||||||
|
|
||||||
// PMA checker signals
|
// PMA checker signals
|
||||||
var logic [`XLEN-1:0] PMPADDR_ARRAY_REGW [`PMP_ENTRIES-1:0];
|
var logic [`XLEN-1:0] PMPADDR_ARRAY_REGW [`PMP_ENTRIES-1:0];
|
||||||
var logic [7:0] PMPCFG_ARRAY_REGW[`PMP_ENTRIES-1:0];
|
var logic [7:0] PMPCFG_ARRAY_REGW[`PMP_ENTRIES-1:0];
|
||||||
|
|
||||||
// IMem stalls
|
// IMem stalls
|
||||||
logic IFUStallF;
|
logic IFUStallF;
|
||||||
logic LSUStallM;
|
logic LSUStallM;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cpu lsu interface
|
// cpu lsu interface
|
||||||
logic [2:0] Funct3M;
|
logic [2:0] Funct3M;
|
||||||
logic [`XLEN-1:0] IEUAdrE;
|
logic [`XLEN-1:0] IEUAdrE;
|
||||||
(* mark_debug = "true" *) logic [`XLEN-1:0] WriteDataM;
|
(* mark_debug = "true" *) logic [`XLEN-1:0] WriteDataM;
|
||||||
(* mark_debug = "true" *) logic [`XLEN-1:0] IEUAdrM;
|
(* mark_debug = "true" *) logic [`XLEN-1:0] IEUAdrM;
|
||||||
logic [`LLEN-1:0] ReadDataW;
|
logic [`LLEN-1:0] ReadDataW;
|
||||||
logic CommittedM;
|
logic CommittedM;
|
||||||
|
|
||||||
// AHB ifu interface
|
// AHB ifu interface
|
||||||
logic [`PA_BITS-1:0] IFUHADDR;
|
logic [`PA_BITS-1:0] IFUHADDR;
|
||||||
logic [2:0] IFUHBURST;
|
logic [2:0] IFUHBURST;
|
||||||
logic [1:0] IFUHTRANS;
|
logic [1:0] IFUHTRANS;
|
||||||
logic [2:0] IFUHSIZE;
|
logic [2:0] IFUHSIZE;
|
||||||
logic IFUHWRITE;
|
logic IFUHWRITE;
|
||||||
logic IFUHREADY;
|
logic IFUHREADY;
|
||||||
|
|
||||||
// AHB LSU interface
|
// AHB LSU interface
|
||||||
logic [`PA_BITS-1:0] LSUHADDR;
|
logic [`PA_BITS-1:0] LSUHADDR;
|
||||||
logic [`XLEN-1:0] LSUHWDATA;
|
logic [`XLEN-1:0] LSUHWDATA;
|
||||||
logic [`XLEN/8-1:0] LSUHWSTRB;
|
logic [`XLEN/8-1:0] LSUHWSTRB;
|
||||||
logic LSUHWRITE;
|
logic LSUHWRITE;
|
||||||
logic LSUHREADY;
|
logic LSUHREADY;
|
||||||
|
|
||||||
logic BPPredWrongE;
|
logic BPPredWrongE;
|
||||||
logic DirPredictionWrongM;
|
logic DirPredictionWrongM;
|
||||||
logic BTBPredPCWrongM;
|
logic BTBPredPCWrongM;
|
||||||
logic RASPredPCWrongM;
|
logic RASPredPCWrongM;
|
||||||
logic PredictionInstrClassWrongM;
|
logic PredictionInstrClassWrongM;
|
||||||
logic [3:0] InstrClassM;
|
logic [3:0] InstrClassM;
|
||||||
logic InstrAccessFaultF, HPTWInstrAccessFaultM;
|
logic InstrAccessFaultF, HPTWInstrAccessFaultM;
|
||||||
logic [2:0] LSUHSIZE;
|
logic [2:0] LSUHSIZE;
|
||||||
logic [2:0] LSUHBURST;
|
logic [2:0] LSUHBURST;
|
||||||
logic [1:0] LSUHTRANS;
|
logic [1:0] LSUHTRANS;
|
||||||
|
|
||||||
logic DCacheMiss;
|
logic DCacheMiss;
|
||||||
logic DCacheAccess;
|
logic DCacheAccess;
|
||||||
logic ICacheMiss;
|
logic ICacheMiss;
|
||||||
logic ICacheAccess;
|
logic ICacheAccess;
|
||||||
logic BreakpointFaultM, EcallFaultM;
|
logic BreakpointFaultM, EcallFaultM;
|
||||||
logic InstrDAPageFaultF;
|
logic InstrDAPageFaultF;
|
||||||
logic BigEndianM;
|
logic BigEndianM;
|
||||||
logic FCvtIntE;
|
logic FCvtIntE;
|
||||||
logic CommittedF;
|
logic CommittedF;
|
||||||
|
|
||||||
|
// instruction fetch unit: PC, branch prediction, instruction cache
|
||||||
ifu ifu(
|
ifu ifu(
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
.StallF, .StallD, .StallE, .StallM, .StallW,
|
.StallF, .StallD, .StallE, .StallM, .StallW,
|
||||||
@ -197,10 +197,9 @@ module wallypipelinedcore (
|
|||||||
// pmp/pma (inside mmu) signals. *** temporarily from AHB bus but eventually replace with internal versions pre H
|
// pmp/pma (inside mmu) signals. *** temporarily from AHB bus but eventually replace with internal versions pre H
|
||||||
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW,
|
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW,
|
||||||
.InstrAccessFaultF,
|
.InstrAccessFaultF,
|
||||||
.InstrDAPageFaultF
|
.InstrDAPageFaultF);
|
||||||
|
|
||||||
); // instruction fetch unit: PC, branch prediction, instruction cache
|
|
||||||
|
|
||||||
|
// integer execution unit: integer register file, datapath and controller
|
||||||
ieu ieu(
|
ieu ieu(
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
|
|
||||||
@ -235,27 +234,25 @@ module wallypipelinedcore (
|
|||||||
.FCvtIntStallD, .LoadStallD, .MDUStallD, .CSRRdStallD,
|
.FCvtIntStallD, .LoadStallD, .MDUStallD, .CSRRdStallD,
|
||||||
.PCSrcE,
|
.PCSrcE,
|
||||||
.CSRReadM, .CSRWriteM, .PrivilegedM,
|
.CSRReadM, .CSRWriteM, .PrivilegedM,
|
||||||
.CSRWriteFenceM, .StoreStallD
|
.CSRWriteFenceM, .StoreStallD);
|
||||||
|
|
||||||
); // integer execution unit: integer register file, datapath and controller
|
|
||||||
|
|
||||||
lsu lsu(
|
lsu lsu(
|
||||||
.clk, .reset, .StallM, .FlushM, .StallW,
|
.clk, .reset, .StallM, .FlushM, .StallW,
|
||||||
.FlushW,
|
.FlushW,
|
||||||
// CPU interface
|
// CPU interface
|
||||||
.MemRWM, .Funct3M, .Funct7M(InstrM[31:25]),
|
.MemRWM, .Funct3M, .Funct7M(InstrM[31:25]),
|
||||||
.AtomicM,
|
.AtomicM,
|
||||||
.CommittedM, .DCacheMiss, .DCacheAccess,
|
.CommittedM, .DCacheMiss, .DCacheAccess,
|
||||||
.SquashSCW,
|
.SquashSCW,
|
||||||
.FpLoadStoreM,
|
.FpLoadStoreM,
|
||||||
.FWriteDataM,
|
.FWriteDataM,
|
||||||
//.DataMisalignedM(DataMisalignedM),
|
//.DataMisalignedM(DataMisalignedM),
|
||||||
.IEUAdrE, .IEUAdrM, .WriteDataM,
|
.IEUAdrE, .IEUAdrM, .WriteDataM,
|
||||||
.ReadDataW, .FlushDCacheM,
|
.ReadDataW, .FlushDCacheM,
|
||||||
// connected to ahb (all stay the same)
|
// connected to ahb (all stay the same)
|
||||||
.LSUHADDR,
|
.LSUHADDR,
|
||||||
.HRDATA, .LSUHWDATA, .LSUHWSTRB, .LSUHSIZE, .LSUHBURST, .LSUHTRANS,
|
.HRDATA, .LSUHWDATA, .LSUHWSTRB, .LSUHSIZE, .LSUHBURST, .LSUHTRANS,
|
||||||
.LSUHWRITE, .LSUHREADY,
|
.LSUHWRITE, .LSUHREADY,
|
||||||
|
|
||||||
// connect to csr or privilege and stay the same.
|
// connect to csr or privilege and stay the same.
|
||||||
.PrivilegeModeW, .BigEndianM, // connects to csr
|
.PrivilegeModeW, .BigEndianM, // connects to csr
|
||||||
@ -279,139 +276,131 @@ module wallypipelinedcore (
|
|||||||
.InstrDAPageFaultF,
|
.InstrDAPageFaultF,
|
||||||
|
|
||||||
.PCF, .ITLBMissF, .PTE, .PageType, .ITLBWriteF, .SelHPTW,
|
.PCF, .ITLBMissF, .PTE, .PageType, .ITLBWriteF, .SelHPTW,
|
||||||
.LSUStallM); // change to LSUStallM
|
.LSUStallM);
|
||||||
|
|
||||||
|
|
||||||
// *** Ross: please make EBU conditional when only supporting internal memories
|
|
||||||
|
|
||||||
if(`BUS) begin : ebu
|
if(`BUS) begin : ebu
|
||||||
ebu ebu(// IFU connections
|
ebu ebu(// IFU connections
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
// IFU interface
|
// IFU interface
|
||||||
.IFUHADDR,
|
.IFUHADDR,
|
||||||
.IFUHBURST,
|
.IFUHBURST,
|
||||||
.IFUHTRANS,
|
.IFUHTRANS,
|
||||||
.IFUHREADY,
|
.IFUHREADY,
|
||||||
.IFUHSIZE,
|
.IFUHSIZE,
|
||||||
// LSU interface
|
// LSU interface
|
||||||
.LSUHADDR,
|
.LSUHADDR,
|
||||||
.LSUHWDATA,
|
.LSUHWDATA,
|
||||||
.LSUHWSTRB,
|
.LSUHWSTRB,
|
||||||
.LSUHSIZE,
|
.LSUHSIZE,
|
||||||
.LSUHBURST,
|
.LSUHBURST,
|
||||||
.LSUHTRANS,
|
.LSUHTRANS,
|
||||||
.LSUHWRITE,
|
.LSUHWRITE,
|
||||||
.LSUHREADY,
|
.LSUHREADY,
|
||||||
// BUS interface
|
// BUS interface
|
||||||
.HREADY, .HRESP, .HCLK, .HRESETn,
|
.HREADY, .HRESP, .HCLK, .HRESETn,
|
||||||
.HADDR, .HWDATA, .HWSTRB, .HWRITE, .HSIZE, .HBURST,
|
.HADDR, .HWDATA, .HWSTRB, .HWRITE, .HSIZE, .HBURST,
|
||||||
.HPROT, .HTRANS, .HMASTLOCK);
|
.HPROT, .HTRANS, .HMASTLOCK);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
// global stall and flush control
|
||||||
hazard hzu(
|
hazard hzu(
|
||||||
.BPPredWrongE, .CSRWriteFenceM, .RetM, .TrapM,
|
.BPPredWrongE, .CSRWriteFenceM, .RetM, .TrapM,
|
||||||
.LoadStallD, .StoreStallD, .MDUStallD, .CSRRdStallD,
|
.LoadStallD, .StoreStallD, .MDUStallD, .CSRRdStallD,
|
||||||
.LSUStallM, .IFUStallF,
|
.LSUStallM, .IFUStallF,
|
||||||
.FCvtIntStallD, .FPUStallD,
|
.FCvtIntStallD, .FPUStallD,
|
||||||
.DivBusyE, .FDivBusyE,
|
.DivBusyE, .FDivBusyE,
|
||||||
.EcallFaultM, .BreakpointFaultM,
|
.EcallFaultM, .BreakpointFaultM,
|
||||||
.WFIStallM,
|
.WFIStallM,
|
||||||
// Stall & flush outputs
|
// Stall & flush outputs
|
||||||
.StallF, .StallD, .StallE, .StallM, .StallW,
|
.StallF, .StallD, .StallE, .StallM, .StallW,
|
||||||
.FlushD, .FlushE, .FlushM, .FlushW
|
.FlushD, .FlushE, .FlushM, .FlushW);
|
||||||
); // global stall and flush control
|
|
||||||
|
|
||||||
if (`ZICSR_SUPPORTED) begin:priv
|
// privileged unit
|
||||||
privileged priv(
|
if (`ZICSR_SUPPORTED) begin:priv
|
||||||
.clk, .reset,
|
privileged priv(
|
||||||
.FlushD, .FlushE, .FlushM, .FlushW,
|
.clk, .reset,
|
||||||
.StallD, .StallE, .StallM, .StallW,
|
.FlushD, .FlushE, .FlushM, .FlushW,
|
||||||
.CSRReadM, .CSRWriteM, .SrcAM, .PCM, .PCNext2F,
|
.StallD, .StallE, .StallM, .StallW,
|
||||||
.InstrM, .CSRReadValW, .UnalignedPCNextF,
|
.CSRReadM, .CSRWriteM, .SrcAM, .PCM, .PCNext2F,
|
||||||
.RetM, .TrapM,
|
.InstrM, .CSRReadValW, .UnalignedPCNextF,
|
||||||
.sfencevmaM,
|
.RetM, .TrapM,
|
||||||
.InstrValidM, .CommittedM, .CommittedF,
|
.sfencevmaM,
|
||||||
.FRegWriteM, .LoadStallD,
|
.InstrValidM, .CommittedM, .CommittedF,
|
||||||
.DirPredictionWrongM, .BTBPredPCWrongM,
|
.FRegWriteM, .LoadStallD,
|
||||||
.RASPredPCWrongM, .PredictionInstrClassWrongM,
|
.DirPredictionWrongM, .BTBPredPCWrongM,
|
||||||
.InstrClassM, .DCacheMiss, .DCacheAccess, .ICacheMiss, .ICacheAccess, .PrivilegedM,
|
.RASPredPCWrongM, .PredictionInstrClassWrongM,
|
||||||
.InstrPageFaultF, .LoadPageFaultM, .StoreAmoPageFaultM,
|
.InstrClassM, .DCacheMiss, .DCacheAccess, .ICacheMiss, .ICacheAccess, .PrivilegedM,
|
||||||
.InstrMisalignedFaultM, .IllegalIEUInstrFaultD,
|
.InstrPageFaultF, .LoadPageFaultM, .StoreAmoPageFaultM,
|
||||||
.LoadMisalignedFaultM, .StoreAmoMisalignedFaultM,
|
.InstrMisalignedFaultM, .IllegalIEUInstrFaultD,
|
||||||
.MTimerInt, .MExtInt, .SExtInt, .MSwInt,
|
.LoadMisalignedFaultM, .StoreAmoMisalignedFaultM,
|
||||||
.MTIME_CLINT,
|
.MTimerInt, .MExtInt, .SExtInt, .MSwInt,
|
||||||
.IEUAdrM,
|
.MTIME_CLINT,
|
||||||
.SetFflagsM,
|
.IEUAdrM,
|
||||||
// Trap signals from pmp/pma in mmu
|
.SetFflagsM,
|
||||||
// *** do these need to be split up into one for dmem and one for ifu?
|
.InstrAccessFaultF, .HPTWInstrAccessFaultM, .LoadAccessFaultM, .StoreAmoAccessFaultM, .SelHPTW,
|
||||||
// instead, could we only care about the instr and F pins that come from ifu and only care about the load/store and m pins that come from dmem?
|
.IllegalFPUInstrM,
|
||||||
.InstrAccessFaultF, .HPTWInstrAccessFaultM, .LoadAccessFaultM, .StoreAmoAccessFaultM, .SelHPTW,
|
.PrivilegeModeW, .SATP_REGW,
|
||||||
.IllegalFPUInstrM,
|
.STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP, .STATUS_FS,
|
||||||
.PrivilegeModeW, .SATP_REGW,
|
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW,
|
||||||
.STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP, .STATUS_FS,
|
.FRM_REGW,.BreakpointFaultM, .EcallFaultM, .WFIStallM, .BigEndianM);
|
||||||
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW,
|
end else begin
|
||||||
.FRM_REGW,.BreakpointFaultM, .EcallFaultM, .WFIStallM, .BigEndianM
|
assign CSRReadValW = 0;
|
||||||
);
|
assign UnalignedPCNextF = PCNext2F;
|
||||||
end else begin
|
assign RetM = 0;
|
||||||
assign CSRReadValW = 0;
|
assign TrapM = 0;
|
||||||
assign UnalignedPCNextF = PCNext2F;
|
assign WFIStallM = 0;
|
||||||
assign RetM = 0;
|
assign sfencevmaM = 0;
|
||||||
assign TrapM = 0;
|
assign BigEndianM = 0;
|
||||||
assign WFIStallM = 0;
|
end
|
||||||
assign sfencevmaM = 0;
|
|
||||||
assign BigEndianM = 0;
|
|
||||||
end
|
|
||||||
if (`M_SUPPORTED) begin:mdu
|
|
||||||
mdu mdu(
|
|
||||||
.clk, .reset,
|
|
||||||
.ForwardedSrcAE, .ForwardedSrcBE,
|
|
||||||
.Funct3E, .Funct3M, .IntDivE, .W64E,
|
|
||||||
.MDUResultW, .DivBusyE,
|
|
||||||
.StallM, .StallW, .FlushE, .FlushM, .FlushW
|
|
||||||
);
|
|
||||||
end else begin // no M instructions supported
|
|
||||||
assign MDUResultW = 0;
|
|
||||||
assign DivBusyE = 0;
|
|
||||||
end
|
|
||||||
|
|
||||||
if (`F_SUPPORTED) begin:fpu
|
// multiply/divide unit
|
||||||
fpu fpu(
|
if (`M_SUPPORTED) begin:mdu
|
||||||
.clk, .reset,
|
mdu mdu(.clk, .reset,
|
||||||
.FRM_REGW, // Rounding mode from CSR
|
.ForwardedSrcAE, .ForwardedSrcBE,
|
||||||
.InstrD, // instruction from IFU
|
.Funct3E, .Funct3M, .IntDivE, .W64E,
|
||||||
.ReadDataW(ReadDataW[`FLEN-1:0]),// Read data from memory
|
.MDUResultW, .DivBusyE,
|
||||||
.ForwardedSrcAE, // Integer input being processed (from IEU)
|
.StallM, .StallW, .FlushE, .FlushM, .FlushW);
|
||||||
.StallE, .StallM, .StallW, // stall signals from HZU
|
end else begin // no M instructions supported
|
||||||
//.TrapM,
|
assign MDUResultW = 0;
|
||||||
.FlushE, .FlushM, .FlushW, // flush signals from HZU
|
assign DivBusyE = 0;
|
||||||
.RdE, .RdM, .RdW, // which FP register to write to (from IEU)
|
end
|
||||||
.STATUS_FS, // is floating-point enabled?
|
|
||||||
.FRegWriteM, // FP register write enable
|
// floating point unit
|
||||||
.FpLoadStoreM,
|
if (`F_SUPPORTED) begin:fpu
|
||||||
.ForwardedSrcBE, // Integer input for intdiv
|
fpu fpu(
|
||||||
.Funct3E, .Funct3M, .IntDivE, .W64E, // Integer flags and functions
|
.clk, .reset,
|
||||||
.FPUStallD, // Stall the decode stage
|
.FRM_REGW, // Rounding mode from CSR
|
||||||
.FWriteIntE, .FCvtIntE, // integer register write enable, conversion operation
|
.InstrD, // instruction from IFU
|
||||||
.FWriteDataM, // Data to be written to memory
|
.ReadDataW(ReadDataW[`FLEN-1:0]),// Read data from memory
|
||||||
.FIntResM, // data to be written to integer register
|
.ForwardedSrcAE, // Integer input being processed (from IEU)
|
||||||
.FCvtIntResW, // fp -> int conversion result to be stored in int register
|
.StallE, .StallM, .StallW, // stall signals from HZU
|
||||||
.FCvtIntW, // fpu result selection
|
//.TrapM,
|
||||||
.FDivBusyE, // Is the divide/sqrt unit busy (stall execute stage)
|
.FlushE, .FlushM, .FlushW, // flush signals from HZU
|
||||||
.IllegalFPUInstrM, // Is the instruction an illegal fpu instruction
|
.RdE, .RdM, .RdW, // which FP register to write to (from IEU)
|
||||||
.SetFflagsM, // FPU flags (to privileged unit)
|
.STATUS_FS, // is floating-point enabled?
|
||||||
.FIntDivResultW
|
.FRegWriteM, // FP register write enable
|
||||||
); // floating point unit
|
.FpLoadStoreM,
|
||||||
end else begin // no F_SUPPORTED or D_SUPPORTED; tie outputs low
|
.ForwardedSrcBE, // Integer input for intdiv
|
||||||
assign FPUStallD = 0;
|
.Funct3E, .Funct3M, .IntDivE, .W64E, // Integer flags and functions
|
||||||
assign FWriteIntE = 0;
|
.FPUStallD, // Stall the decode stage
|
||||||
assign FCvtIntE = 0;
|
.FWriteIntE, .FCvtIntE, // integer register write enable, conversion operation
|
||||||
assign FIntResM = 0;
|
.FWriteDataM, // Data to be written to memory
|
||||||
assign FCvtIntW = 0;
|
.FIntResM, // data to be written to integer register
|
||||||
assign FDivBusyE = 0;
|
.FCvtIntResW, // fp -> int conversion result to be stored in int register
|
||||||
assign IllegalFPUInstrM = 1;
|
.FCvtIntW, // fpu result selection
|
||||||
assign SetFflagsM = 0;
|
.FDivBusyE, // Is the divide/sqrt unit busy (stall execute stage)
|
||||||
assign FpLoadStoreM = 0;
|
.IllegalFPUInstrM, // Is the instruction an illegal fpu instruction
|
||||||
end
|
.SetFflagsM, // FPU flags (to privileged unit)
|
||||||
|
.FIntDivResultW);
|
||||||
|
end else begin // no F_SUPPORTED or D_SUPPORTED; tie outputs low
|
||||||
|
assign FPUStallD = 0;
|
||||||
|
assign FWriteIntE = 0;
|
||||||
|
assign FCvtIntE = 0;
|
||||||
|
assign FIntResM = 0;
|
||||||
|
assign FCvtIntW = 0;
|
||||||
|
assign FDivBusyE = 0;
|
||||||
|
assign IllegalFPUInstrM = 1;
|
||||||
|
assign SetFflagsM = 0;
|
||||||
|
assign FpLoadStoreM = 0;
|
||||||
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user