mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Moved generate statements for optional units into wallypipelinedhart
This commit is contained in:
parent
53cd2ac049
commit
3c3bfd055e
@ -56,8 +56,6 @@ module fpu (
|
|||||||
// single stored in a double: | 32 1s | single precision value |
|
// single stored in a double: | 32 1s | single precision value |
|
||||||
// - sets the underflow after rounding
|
// - sets the underflow after rounding
|
||||||
|
|
||||||
generate if (`F_SUPPORTED | `D_SUPPORTED) begin : fpu
|
|
||||||
|
|
||||||
// control signals
|
// control signals
|
||||||
logic FRegWriteD, FRegWriteE, FRegWriteW; // FP register write enable
|
logic FRegWriteD, FRegWriteE, FRegWriteW; // FP register write enable
|
||||||
logic [2:0] FrmD, FrmE, FrmM; // FP rounding mode
|
logic [2:0] FrmD, FrmE, FrmM; // FP rounding mode
|
||||||
@ -286,16 +284,4 @@ module fpu (
|
|||||||
|
|
||||||
// select the result to be written to the FP register
|
// select the result to be written to the FP register
|
||||||
mux4 #(64) FPUResultMux (ReadResW, FMAResW, FDivResW, FResW, FResultSelW, FPUResultW);
|
mux4 #(64) FPUResultMux (ReadResW, FMAResW, FDivResW, FResW, FResultSelW, FPUResultW);
|
||||||
|
|
||||||
end else begin // no F_SUPPORTED or D_SUPPORTED; tie outputs low
|
|
||||||
assign FStallD = 0;
|
|
||||||
assign FWriteIntE = 0;
|
|
||||||
assign FWriteDataE = 0;
|
|
||||||
assign FIntResM = 0;
|
|
||||||
assign FDivBusyE = 0;
|
|
||||||
assign IllegalFPUInstrD = 1;
|
|
||||||
assign SetFflagsM = 0;
|
|
||||||
end
|
|
||||||
endgenerate
|
|
||||||
|
|
||||||
endmodule // fpu
|
endmodule // fpu
|
||||||
|
@ -40,8 +40,6 @@ module muldiv (
|
|||||||
input logic StallM, StallW, FlushM, FlushW
|
input logic StallM, StallW, FlushM, FlushW
|
||||||
);
|
);
|
||||||
|
|
||||||
generate
|
|
||||||
if (`M_SUPPORTED) begin
|
|
||||||
logic [`XLEN-1:0] MulDivResultM;
|
logic [`XLEN-1:0] MulDivResultM;
|
||||||
logic [`XLEN-1:0] PrelimResultM;
|
logic [`XLEN-1:0] PrelimResultM;
|
||||||
logic [`XLEN-1:0] QuotM, RemM;
|
logic [`XLEN-1:0] QuotM, RemM;
|
||||||
@ -52,21 +50,14 @@ module muldiv (
|
|||||||
logic W64M;
|
logic W64M;
|
||||||
|
|
||||||
// Multiplier
|
// Multiplier
|
||||||
mul mul(
|
mul mul(.clk, .reset, .StallM, .FlushM, .ForwardedSrcAE, .ForwardedSrcBE, .Funct3E, .ProdM);
|
||||||
.clk, .reset,
|
|
||||||
.StallM, .FlushM,
|
|
||||||
// .SrcAE, .SrcBE,
|
|
||||||
.ForwardedSrcAE, .ForwardedSrcBE, // *** these are the src outputs before the mux choosing between them and PCE to put in srcA/B
|
|
||||||
.Funct3E,
|
|
||||||
.ProdM
|
|
||||||
);
|
|
||||||
|
|
||||||
// Divide
|
// Divide
|
||||||
// Start a divide when a new division instruction is received and the divider isn't already busy or finishing
|
// Start a divide when a new division instruction is received and the divider isn't already busy or finishing
|
||||||
assign DivE = MulDivE & Funct3E[2];
|
assign DivE = MulDivE & Funct3E[2];
|
||||||
assign DivSignedE = ~Funct3E[0];
|
assign DivSignedE = ~Funct3E[0];
|
||||||
intdivrestoring div(.clk, .reset, .StallM,
|
intdivrestoring div(.clk, .reset, .StallM, .DivSignedE, .W64E, .DivE,
|
||||||
.DivSignedE, .W64E, .DivE, .ForwardedSrcAE, .ForwardedSrcBE, .DivBusyE, .QuotM, .RemM);
|
.ForwardedSrcAE, .ForwardedSrcBE, .DivBusyE, .QuotM, .RemM);
|
||||||
|
|
||||||
// Result multiplexer
|
// Result multiplexer
|
||||||
always_comb
|
always_comb
|
||||||
@ -83,22 +74,16 @@ module muldiv (
|
|||||||
|
|
||||||
// Handle sign extension for W-type instructions
|
// Handle sign extension for W-type instructions
|
||||||
flopenrc #(1) W64MReg(clk, reset, FlushM, ~StallM, W64E, W64M);
|
flopenrc #(1) W64MReg(clk, reset, FlushM, ~StallM, W64E, W64M);
|
||||||
if (`XLEN == 64) begin // RV64 has W-type instructions
|
generate
|
||||||
|
if (`XLEN == 64) begin:resmux // RV64 has W-type instructions
|
||||||
assign MulDivResultM = W64M ? {{32{PrelimResultM[31]}}, PrelimResultM[31:0]} : PrelimResultM;
|
assign MulDivResultM = W64M ? {{32{PrelimResultM[31]}}, PrelimResultM[31:0]} : PrelimResultM;
|
||||||
end else begin // RV32 has no W-type instructions
|
end else begin:resmux // RV32 has no W-type instructions
|
||||||
assign MulDivResultM = PrelimResultM;
|
assign MulDivResultM = PrelimResultM;
|
||||||
end
|
end
|
||||||
|
|
||||||
// Writeback stage pipeline register
|
|
||||||
|
|
||||||
flopenrc #(`XLEN) MulDivResultWReg(clk, reset, FlushW, ~StallW, MulDivResultM, MulDivResultW);
|
|
||||||
|
|
||||||
end else begin // no M instructions supported
|
|
||||||
assign MulDivResultW = 0;
|
|
||||||
assign DivBusyE = 0;
|
|
||||||
end
|
|
||||||
endgenerate
|
endgenerate
|
||||||
|
|
||||||
|
// Writeback stage pipeline register
|
||||||
|
flopenrc #(`XLEN) MulDivResultWReg(clk, reset, FlushW, ~StallW, MulDivResultM, MulDivResultW);
|
||||||
endmodule // muldiv
|
endmodule // muldiv
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,8 +86,6 @@ module csr #(parameter
|
|||||||
logic IllegalCSRCAccessM, IllegalCSRMAccessM, IllegalCSRSAccessM, IllegalCSRUAccessM, IllegalCSRNAccessM, InsufficientCSRPrivilegeM;
|
logic IllegalCSRCAccessM, IllegalCSRMAccessM, IllegalCSRSAccessM, IllegalCSRUAccessM, IllegalCSRNAccessM, InsufficientCSRPrivilegeM;
|
||||||
logic IllegalCSRMWriteReadonlyM;
|
logic IllegalCSRMWriteReadonlyM;
|
||||||
|
|
||||||
generate
|
|
||||||
if (`ZICSR_SUPPORTED) begin
|
|
||||||
// modify CSRs
|
// modify CSRs
|
||||||
always_comb begin
|
always_comb begin
|
||||||
// Choose either rs1 or uimm[4:0] as source
|
// Choose either rs1 or uimm[4:0] as source
|
||||||
@ -124,8 +122,6 @@ module csr #(parameter
|
|||||||
|
|
||||||
// merge CSR Reads
|
// merge CSR Reads
|
||||||
assign CSRReadValM = CSRUReadValM | CSRSReadValM | CSRMReadValM | CSRCReadValM | CSRNReadValM;
|
assign CSRReadValM = CSRUReadValM | CSRSReadValM | CSRMReadValM | CSRCReadValM | CSRNReadValM;
|
||||||
// *** add W stall 2/22/21 dh to try fixing memory stalls
|
|
||||||
// floprc #(`XLEN) CSRValWReg(clk, reset, FlushW, CSRReadValM, CSRReadValW);
|
|
||||||
flopenrc #(`XLEN) CSRValWReg(clk, reset, FlushW, ~StallW, CSRReadValM, CSRReadValW);
|
flopenrc #(`XLEN) CSRValWReg(clk, reset, FlushW, ~StallW, CSRReadValM, CSRReadValW);
|
||||||
|
|
||||||
// merge illegal accesses: illegal if none of the CSR addresses is legal or privilege is insufficient
|
// merge illegal accesses: illegal if none of the CSR addresses is legal or privilege is insufficient
|
||||||
@ -134,28 +130,4 @@ module csr #(parameter
|
|||||||
assign IllegalCSRAccessM = ((IllegalCSRCAccessM && IllegalCSRMAccessM &&
|
assign IllegalCSRAccessM = ((IllegalCSRCAccessM && IllegalCSRMAccessM &&
|
||||||
IllegalCSRSAccessM && IllegalCSRUAccessM && IllegalCSRNAccessM ||
|
IllegalCSRSAccessM && IllegalCSRUAccessM && IllegalCSRNAccessM ||
|
||||||
InsufficientCSRPrivilegeM) && CSRReadM) || IllegalCSRMWriteReadonlyM;
|
InsufficientCSRPrivilegeM) && CSRReadM) || IllegalCSRMWriteReadonlyM;
|
||||||
end else begin // CSRs not implemented
|
|
||||||
assign STATUS_MPP = 2'b11;
|
|
||||||
assign STATUS_SPP = 2'b0;
|
|
||||||
assign STATUS_TSR = 0;
|
|
||||||
assign MEPC_REGW = 0;
|
|
||||||
assign SEPC_REGW = 0;
|
|
||||||
assign UEPC_REGW = 0;
|
|
||||||
assign UTVEC_REGW = 0;
|
|
||||||
assign STVEC_REGW = 0;
|
|
||||||
assign MTVEC_REGW = 0;
|
|
||||||
assign MEDELEG_REGW = 0;
|
|
||||||
assign MIDELEG_REGW = 0;
|
|
||||||
assign SEDELEG_REGW = 0;
|
|
||||||
assign SIDELEG_REGW = 0;
|
|
||||||
assign SATP_REGW = 0;
|
|
||||||
assign MIP_REGW = 0;
|
|
||||||
assign MIE_REGW = 0;
|
|
||||||
assign STATUS_MIE = 0;
|
|
||||||
assign STATUS_SIE = 0;
|
|
||||||
assign FRM_REGW = 0;
|
|
||||||
assign CSRReadValM = 0;
|
|
||||||
assign IllegalCSRAccessM = CSRReadM;
|
|
||||||
end
|
|
||||||
endgenerate
|
|
||||||
endmodule
|
endmodule
|
||||||
|
@ -239,8 +239,6 @@ module privileged (
|
|||||||
.ExceptionM,
|
.ExceptionM,
|
||||||
.PendingInterruptM,
|
.PendingInterruptM,
|
||||||
.PrivilegedNextPCM, .CauseM, .NextFaultMtvalM);
|
.PrivilegedNextPCM, .CauseM, .NextFaultMtvalM);
|
||||||
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +198,6 @@ module wallypipelinedhart (
|
|||||||
|
|
||||||
); // instruction fetch unit: PC, branch prediction, instruction cache
|
); // instruction fetch unit: PC, branch prediction, instruction cache
|
||||||
|
|
||||||
|
|
||||||
ieu ieu(
|
ieu ieu(
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
|
|
||||||
@ -276,7 +275,7 @@ module wallypipelinedhart (
|
|||||||
.LSUStall); // change to LSUStall
|
.LSUStall); // change to LSUStall
|
||||||
|
|
||||||
|
|
||||||
|
// *** Ross: please make EBU conditional when only supporting internal memories
|
||||||
|
|
||||||
ahblite ebu(// IFU connections
|
ahblite ebu(// IFU connections
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
@ -295,21 +294,6 @@ module wallypipelinedhart (
|
|||||||
.HWRITED);
|
.HWRITED);
|
||||||
|
|
||||||
|
|
||||||
muldiv mdu(
|
|
||||||
.clk, .reset,
|
|
||||||
// Execute Stage interface
|
|
||||||
// .SrcAE, .SrcBE,
|
|
||||||
.ForwardedSrcAE, .ForwardedSrcBE, // *** these are the src outputs before the mux choosing between them and PCE to put in srcA/B
|
|
||||||
.Funct3E, .Funct3M,
|
|
||||||
.MulDivE, .W64E,
|
|
||||||
// Writeback stage
|
|
||||||
.MulDivResultW,
|
|
||||||
// Divide Done
|
|
||||||
.DivBusyE,
|
|
||||||
// hazards
|
|
||||||
.StallM, .StallW, .FlushM, .FlushW
|
|
||||||
); // multiply and divide unit
|
|
||||||
|
|
||||||
hazard hzu(
|
hazard hzu(
|
||||||
.BPPredWrongE, .CSRWritePendingDEM, .RetM, .TrapM,
|
.BPPredWrongE, .CSRWritePendingDEM, .RetM, .TrapM,
|
||||||
.LoadStallD, .StoreStallD, .MulDivStallD, .CSRRdStallD,
|
.LoadStallD, .StoreStallD, .MulDivStallD, .CSRRdStallD,
|
||||||
@ -323,7 +307,8 @@ module wallypipelinedhart (
|
|||||||
.FlushF, .FlushD, .FlushE, .FlushM, .FlushW
|
.FlushF, .FlushD, .FlushE, .FlushM, .FlushW
|
||||||
); // global stall and flush control
|
); // global stall and flush control
|
||||||
|
|
||||||
// Priveleged block operates in M and W stages, handling CSRs and exceptions
|
generate
|
||||||
|
if (`ZICSR_SUPPORTED) begin:priv
|
||||||
privileged priv(
|
privileged priv(
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
.FlushD, .FlushE, .FlushM, .FlushW,
|
.FlushD, .FlushE, .FlushM, .FlushW,
|
||||||
@ -355,8 +340,28 @@ module wallypipelinedhart (
|
|||||||
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW,
|
.PMPCFG_ARRAY_REGW, .PMPADDR_ARRAY_REGW,
|
||||||
.FRM_REGW,.BreakpointFaultM, .EcallFaultM
|
.FRM_REGW,.BreakpointFaultM, .EcallFaultM
|
||||||
);
|
);
|
||||||
|
end else begin
|
||||||
|
assign CSRReadValW = 0;
|
||||||
|
assign PrivilegedNextPCM = 0;
|
||||||
|
assign RetM = 0;
|
||||||
|
assign TrapM = 0;
|
||||||
|
assign ITLBFlushF = 0;
|
||||||
|
assign DTLBFlushM = 0;
|
||||||
|
end
|
||||||
|
if (`M_SUPPORTED) begin:mdu
|
||||||
|
muldiv mdu(
|
||||||
|
.clk, .reset,
|
||||||
|
.ForwardedSrcAE, .ForwardedSrcBE,
|
||||||
|
.Funct3E, .Funct3M, .MulDivE, .W64E,
|
||||||
|
.MulDivResultW, .DivBusyE,
|
||||||
|
.StallM, .StallW, .FlushM, .FlushW
|
||||||
|
);
|
||||||
|
end else begin // no M instructions supported
|
||||||
|
assign MulDivResultW = 0;
|
||||||
|
assign DivBusyE = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
if (`F_SUPPORTED) begin:fpu
|
||||||
fpu fpu(
|
fpu fpu(
|
||||||
.clk, .reset,
|
.clk, .reset,
|
||||||
.FRM_REGW, // Rounding mode from CSR
|
.FRM_REGW, // Rounding mode from CSR
|
||||||
@ -375,5 +380,16 @@ module wallypipelinedhart (
|
|||||||
.IllegalFPUInstrD, // Is the instruction an illegal fpu instruction
|
.IllegalFPUInstrD, // Is the instruction an illegal fpu instruction
|
||||||
.SetFflagsM // FPU flags (to privileged unit)
|
.SetFflagsM // FPU flags (to privileged unit)
|
||||||
); // floating point unit
|
); // floating point unit
|
||||||
|
end else begin // no F_SUPPORTED or D_SUPPORTED; tie outputs low
|
||||||
|
assign FStallD = 0;
|
||||||
|
assign FWriteIntE = 0;
|
||||||
|
assign FWriteDataE = 0;
|
||||||
|
assign FIntResM = 0;
|
||||||
|
assign FDivBusyE = 0;
|
||||||
|
assign IllegalFPUInstrD = 1;
|
||||||
|
assign SetFflagsM = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
endgenerate
|
||||||
|
// Priveleged block operates in M and W stages, handling CSRs and exceptions
|
||||||
endmodule
|
endmodule
|
||||||
|
@ -174,7 +174,7 @@ module testbench();
|
|||||||
// Useful Aliases
|
// Useful Aliases
|
||||||
`define RF dut.hart.ieu.dp.regf.rf
|
`define RF dut.hart.ieu.dp.regf.rf
|
||||||
`define PC dut.hart.ifu.pcreg.q
|
`define PC dut.hart.ifu.pcreg.q
|
||||||
`define CSR_BASE dut.hart.priv.csr.genblk1
|
`define CSR_BASE dut.hart.priv.priv.csr
|
||||||
`define HPMCOUNTER `CSR_BASE.counters.genblk1.HPMCOUNTER_REGW
|
`define HPMCOUNTER `CSR_BASE.counters.genblk1.HPMCOUNTER_REGW
|
||||||
`define PMP_BASE `CSR_BASE.csrm.genblk4
|
`define PMP_BASE `CSR_BASE.csrm.genblk4
|
||||||
`define PMPCFG genblk2.PMPCFGreg.q
|
`define PMPCFG genblk2.PMPCFGreg.q
|
||||||
@ -210,8 +210,8 @@ module testbench();
|
|||||||
`define STATUS_MIE `CSR_BASE.csrsr.STATUS_MIE
|
`define STATUS_MIE `CSR_BASE.csrsr.STATUS_MIE
|
||||||
`define STATUS_SIE `CSR_BASE.csrsr.STATUS_SIE
|
`define STATUS_SIE `CSR_BASE.csrsr.STATUS_SIE
|
||||||
`define STATUS_UIE `CSR_BASE.csrsr.STATUS_UIE
|
`define STATUS_UIE `CSR_BASE.csrsr.STATUS_UIE
|
||||||
`define PRIV dut.hart.priv.privmodereg.q
|
`define PRIV dut.hart.priv.priv.privmodereg.q
|
||||||
`define INSTRET dut.hart.priv.csr.genblk1.counters.genblk1.genblk2.INSTRETreg.q
|
`define INSTRET dut.hart.priv.priv.csr.counters.genblk1.genblk2.INSTRETreg.q
|
||||||
// Common Macros
|
// Common Macros
|
||||||
`define checkCSR(CSR) \
|
`define checkCSR(CSR) \
|
||||||
begin \
|
begin \
|
||||||
@ -308,9 +308,9 @@ module testbench();
|
|||||||
integer ramFile;
|
integer ramFile;
|
||||||
integer readResult;
|
integer readResult;
|
||||||
initial begin
|
initial begin
|
||||||
force dut.hart.priv.SwIntM = 0;
|
force dut.hart.priv.priv.SwIntM = 0;
|
||||||
force dut.hart.priv.TimerIntM = 0;
|
force dut.hart.priv.priv.TimerIntM = 0;
|
||||||
force dut.hart.priv.ExtIntM = 0;
|
force dut.hart.priv.priv.ExtIntM = 0;
|
||||||
$readmemh({`LINUX_TEST_VECTORS,"bootmem.txt"}, dut.uncore.bootrom.bootrom.RAM, 'h1000 >> 3);
|
$readmemh({`LINUX_TEST_VECTORS,"bootmem.txt"}, dut.uncore.bootrom.bootrom.RAM, 'h1000 >> 3);
|
||||||
$readmemb(`TWO_BIT_PRELOAD, dut.hart.ifu.bpred.bpred.Predictor.DirPredictor.PHT.mem);
|
$readmemb(`TWO_BIT_PRELOAD, dut.hart.ifu.bpred.bpred.Predictor.DirPredictor.PHT.mem);
|
||||||
$readmemb(`BTB_PRELOAD, dut.hart.ifu.bpred.bpred.TargetPredictor.memory.mem);
|
$readmemb(`BTB_PRELOAD, dut.hart.ifu.bpred.bpred.TargetPredictor.memory.mem);
|
||||||
@ -365,7 +365,7 @@ module testbench();
|
|||||||
// on the next falling edge the expected state is compared to the wally state.
|
// on the next falling edge the expected state is compared to the wally state.
|
||||||
|
|
||||||
// step 0: read the expected state
|
// step 0: read the expected state
|
||||||
assign checkInstrM = dut.hart.ieu.InstrValidM & ~dut.hart.priv.trap.InstrPageFaultM & ~dut.hart.priv.trap.InterruptM & ~dut.hart.StallM;
|
assign checkInstrM = dut.hart.ieu.InstrValidM & ~dut.hart.priv.priv.trap.InstrPageFaultM & ~dut.hart.priv.priv.trap.InterruptM & ~dut.hart.StallM;
|
||||||
`define SCAN_NEW_INSTR_FROM_TRACE(STAGE) \
|
`define SCAN_NEW_INSTR_FROM_TRACE(STAGE) \
|
||||||
// always check PC, instruction bits \
|
// always check PC, instruction bits \
|
||||||
if (checkInstrM) begin \
|
if (checkInstrM) begin \
|
||||||
@ -479,7 +479,7 @@ module testbench();
|
|||||||
end else begin // update MIP immediately
|
end else begin // update MIP immediately
|
||||||
$display("%tns: Updating MIP to %x",$time,NextMIPexpected);
|
$display("%tns: Updating MIP to %x",$time,NextMIPexpected);
|
||||||
MIPexpected = NextMIPexpected;
|
MIPexpected = NextMIPexpected;
|
||||||
force dut.hart.priv.csr.genblk1.csri.MIP_REGW = MIPexpected;
|
force dut.hart.priv.priv.csr.csri.MIP_REGW = MIPexpected;
|
||||||
end
|
end
|
||||||
// $display("%tn: ExpectedCSRArrayM = %p",$time,ExpectedCSRArrayM);
|
// $display("%tn: ExpectedCSRArrayM = %p",$time,ExpectedCSRArrayM);
|
||||||
// $display("%tn: ExpectedCSRArrayValueM = %p",$time,ExpectedCSRArrayValueM);
|
// $display("%tn: ExpectedCSRArrayValueM = %p",$time,ExpectedCSRArrayValueM);
|
||||||
@ -491,11 +491,11 @@ module testbench();
|
|||||||
// $display("%tn: ExpectedCSRArrayValueM[NumCSRM] %x",$time,ExpectedCSRArrayValueM[NumCSRM]);
|
// $display("%tn: ExpectedCSRArrayValueM[NumCSRM] %x",$time,ExpectedCSRArrayValueM[NumCSRM]);
|
||||||
end
|
end
|
||||||
if(RequestDelayedMIP & checkInstrM) begin
|
if(RequestDelayedMIP & checkInstrM) begin
|
||||||
$display("%tns: Executing Delayed MIP. Current MEPC value is %x",$time,dut.hart.priv.csr.genblk1.csrm.MEPC_REGW);
|
$display("%tns: Executing Delayed MIP. Current MEPC value is %x",$time,dut.hart.priv.priv.csr.csrm.MEPC_REGW);
|
||||||
$display("%tns: Updating MIP to %x",$time,NextMIPexpected);
|
$display("%tns: Updating MIP to %x",$time,NextMIPexpected);
|
||||||
MIPexpected = NextMIPexpected;
|
MIPexpected = NextMIPexpected;
|
||||||
force dut.hart.priv.csr.genblk1.csri.MIP_REGW = MIPexpected;
|
force dut.hart.priv.priv.csr.csri.MIP_REGW = MIPexpected;
|
||||||
$display("%tns: Finished Executing Delayed MIP. Current MEPC value is %x",$time,dut.hart.priv.csr.genblk1.csrm.MEPC_REGW);
|
$display("%tns: Finished Executing Delayed MIP. Current MEPC value is %x",$time,dut.hart.priv.priv.csr.csrm.MEPC_REGW);
|
||||||
RequestDelayedMIP = 0;
|
RequestDelayedMIP = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -576,7 +576,7 @@ module testbench();
|
|||||||
`checkEQ("PCW",PCW,ExpectedPCW)
|
`checkEQ("PCW",PCW,ExpectedPCW)
|
||||||
//`checkEQ("InstrW",InstrW,ExpectedInstrW) <-- not viable because of
|
//`checkEQ("InstrW",InstrW,ExpectedInstrW) <-- not viable because of
|
||||||
// compressed to uncompressed conversion
|
// compressed to uncompressed conversion
|
||||||
`checkEQ("Instr Count",dut.hart.priv.csr.genblk1.counters.genblk1.INSTRET_REGW,InstrCountW)
|
`checkEQ("Instr Count",dut.hart.priv.priv.csr.counters.genblk1.INSTRET_REGW,InstrCountW)
|
||||||
#2; // delay 2 ns.
|
#2; // delay 2 ns.
|
||||||
if(`DEBUG_TRACE >= 5) begin
|
if(`DEBUG_TRACE >= 5) begin
|
||||||
$display("%tns, %d instrs: Reg Write Address %02d ? expected value: %02d", $time, InstrCountW, dut.hart.ieu.dp.regf.a3, ExpectedRegAdrW);
|
$display("%tns, %d instrs: Reg Write Address %02d ? expected value: %02d", $time, InstrCountW, dut.hart.ieu.dp.regf.a3, ExpectedRegAdrW);
|
||||||
@ -601,19 +601,19 @@ module testbench();
|
|||||||
// check csr
|
// check csr
|
||||||
for(NumCSRPostWIndex = 0; NumCSRPostWIndex < NumCSRW; NumCSRPostWIndex++) begin
|
for(NumCSRPostWIndex = 0; NumCSRPostWIndex < NumCSRW; NumCSRPostWIndex++) begin
|
||||||
case(ExpectedCSRArrayW[NumCSRPostWIndex])
|
case(ExpectedCSRArrayW[NumCSRPostWIndex])
|
||||||
"mhartid": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MHARTID_REGW)
|
"mhartid": `checkCSR(dut.hart.priv.priv.csr.csrm.MHARTID_REGW)
|
||||||
"mstatus": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MSTATUS_REGW)
|
"mstatus": `checkCSR(dut.hart.priv.priv.csr.csrm.MSTATUS_REGW)
|
||||||
"mtvec": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MTVEC_REGW)
|
"mtvec": `checkCSR(dut.hart.priv.priv.csr.csrm.MTVEC_REGW)
|
||||||
"mip": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MIP_REGW)
|
"mip": `checkCSR(dut.hart.priv.priv.csr.csrm.MIP_REGW)
|
||||||
"mie": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MIE_REGW)
|
"mie": `checkCSR(dut.hart.priv.priv.csr.csrm.MIE_REGW)
|
||||||
"mideleg": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MIDELEG_REGW)
|
"mideleg": `checkCSR(dut.hart.priv.priv.csr.csrm.MIDELEG_REGW)
|
||||||
"medeleg": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MEDELEG_REGW)
|
"medeleg": `checkCSR(dut.hart.priv.priv.csr.csrm.MEDELEG_REGW)
|
||||||
"mepc": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MEPC_REGW)
|
"mepc": `checkCSR(dut.hart.priv.priv.csr.csrm.MEPC_REGW)
|
||||||
"mtval": `checkCSR(dut.hart.priv.csr.genblk1.csrm.MTVAL_REGW)
|
"mtval": `checkCSR(dut.hart.priv.priv.csr.csrm.MTVAL_REGW)
|
||||||
"sepc": `checkCSR(dut.hart.priv.csr.genblk1.csrs.SEPC_REGW)
|
"sepc": `checkCSR(dut.hart.priv.priv.csr.csrs.SEPC_REGW)
|
||||||
"scause": `checkCSR(dut.hart.priv.csr.genblk1.csrs.genblk1.SCAUSE_REGW)
|
"scause": `checkCSR(dut.hart.priv.priv.csr.csrs.genblk1.SCAUSE_REGW)
|
||||||
"stvec": `checkCSR(dut.hart.priv.csr.genblk1.csrs.STVEC_REGW)
|
"stvec": `checkCSR(dut.hart.priv.priv.csr.csrs.STVEC_REGW)
|
||||||
"stval": `checkCSR(dut.hart.priv.csr.genblk1.csrs.genblk1.STVAL_REGW)
|
"stval": `checkCSR(dut.hart.priv.priv.csr.csrs.genblk1.STVAL_REGW)
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
if (fault == 1) begin
|
if (fault == 1) begin
|
||||||
@ -667,7 +667,7 @@ module testbench();
|
|||||||
begin
|
begin
|
||||||
int i;
|
int i;
|
||||||
// Grab the SATP register from privileged unit
|
// Grab the SATP register from privileged unit
|
||||||
SATP = dut.hart.priv.csr.SATP_REGW;
|
SATP = dut.hart.priv.priv.csr.SATP_REGW;
|
||||||
// Split the virtual address into page number segments and offset
|
// Split the virtual address into page number segments and offset
|
||||||
VPN[2] = adrIn[38:30];
|
VPN[2] = adrIn[38:30];
|
||||||
VPN[1] = adrIn[29:21];
|
VPN[1] = adrIn[29:21];
|
||||||
@ -677,7 +677,7 @@ module testbench();
|
|||||||
SvMode = SATP[63];
|
SvMode = SATP[63];
|
||||||
// Only perform translation if translation is on and the processor is not
|
// Only perform translation if translation is on and the processor is not
|
||||||
// in machine mode
|
// in machine mode
|
||||||
if (SvMode && (dut.hart.priv.PrivilegeModeW != `M_MODE)) begin
|
if (SvMode && (dut.hart.priv.priv.PrivilegeModeW != `M_MODE)) begin
|
||||||
BaseAdr = SATP[43:0] << 12;
|
BaseAdr = SATP[43:0] << 12;
|
||||||
for (i = 2; i >= 0; i--) begin
|
for (i = 2; i >= 0; i--) begin
|
||||||
PAdr = BaseAdr + (VPN[i] << 3);
|
PAdr = BaseAdr + (VPN[i] << 3);
|
||||||
|
@ -287,7 +287,7 @@ logic [3:0] dummy;
|
|||||||
|
|
||||||
// Termination condition
|
// Termination condition
|
||||||
// terminate on a specific ECALL for Imperas tests, or on a jump to self infinite loop for RISC-V Arch tests
|
// terminate on a specific ECALL for Imperas tests, or on a jump to self infinite loop for RISC-V Arch tests
|
||||||
assign DCacheFlushStart = dut.hart.priv.EcallFaultM &&
|
assign DCacheFlushStart = dut.hart.priv.priv.EcallFaultM &&
|
||||||
(dut.hart.ieu.dp.regf.rf[3] == 1 ||
|
(dut.hart.ieu.dp.regf.rf[3] == 1 ||
|
||||||
(dut.hart.ieu.dp.regf.we3 &&
|
(dut.hart.ieu.dp.regf.we3 &&
|
||||||
dut.hart.ieu.dp.regf.a3 == 3 &&
|
dut.hart.ieu.dp.regf.a3 == 3 &&
|
||||||
@ -318,7 +318,7 @@ module riscvassertions;
|
|||||||
initial begin
|
initial begin
|
||||||
assert (`PMP_ENTRIES == 0 || `PMP_ENTRIES==16 || `PMP_ENTRIES==64) else $error("Illegal number of PMP entries: PMP_ENTRIES must be 0, 16, or 64");
|
assert (`PMP_ENTRIES == 0 || `PMP_ENTRIES==16 || `PMP_ENTRIES==64) else $error("Illegal number of PMP entries: PMP_ENTRIES must be 0, 16, or 64");
|
||||||
assert (`DIV_BITSPERCYCLE == 1 || `DIV_BITSPERCYCLE==2 || `DIV_BITSPERCYCLE==4) else $error("Illegal number of divider bits/cycle: DIV_BITSPERCYCLE must be 1, 2, or 4");
|
assert (`DIV_BITSPERCYCLE == 1 || `DIV_BITSPERCYCLE==2 || `DIV_BITSPERCYCLE==4) else $error("Illegal number of divider bits/cycle: DIV_BITSPERCYCLE must be 1, 2, or 4");
|
||||||
assert (`F_SUPPORTED || ~`D_SUPPORTED) else $error("Can't support double without supporting float");
|
assert (`F_SUPPORTED || ~`D_SUPPORTED) else $error("Can't support double (D) without supporting float (F)");
|
||||||
assert (`XLEN == 64 || ~`D_SUPPORTED) else $error("Wally does not yet support D extensions on RV32");
|
assert (`XLEN == 64 || ~`D_SUPPORTED) else $error("Wally does not yet support D extensions on RV32");
|
||||||
assert (`DCACHE_WAYSIZEINBYTES <= 4096 || `MEM_DCACHE == 0 || `MEM_VIRTMEM == 0) else $error("DCACHE_WAYSIZEINBYTES cannot exceed 4 KiB when caches and vitual memory is enabled (to prevent aliasing)");
|
assert (`DCACHE_WAYSIZEINBYTES <= 4096 || `MEM_DCACHE == 0 || `MEM_VIRTMEM == 0) else $error("DCACHE_WAYSIZEINBYTES cannot exceed 4 KiB when caches and vitual memory is enabled (to prevent aliasing)");
|
||||||
assert (`DCACHE_BLOCKLENINBITS >= 128 || `MEM_DCACHE == 0) else $error("DCACHE_BLOCKLENINBITS must be at least 128 when caches are enabled");
|
assert (`DCACHE_BLOCKLENINBITS >= 128 || `MEM_DCACHE == 0) else $error("DCACHE_BLOCKLENINBITS must be at least 128 when caches are enabled");
|
||||||
|
Loading…
Reference in New Issue
Block a user