forked from Github_Repos/cvw
		
	SFENCE.VMA should be illegal in user mode
This commit is contained in:
		
							parent
							
								
									f436e93fc5
								
							
						
					
					
						commit
						7f42ff06d2
					
				@ -57,7 +57,7 @@ module csr #(parameter
 | 
				
			|||||||
  input  logic [1:0]       NextPrivilegeModeM, PrivilegeModeW,
 | 
					  input  logic [1:0]       NextPrivilegeModeM, PrivilegeModeW,
 | 
				
			||||||
  input  logic [`XLEN-1:0] CauseM, NextFaultMtvalM,
 | 
					  input  logic [`XLEN-1:0] CauseM, NextFaultMtvalM,
 | 
				
			||||||
  output logic [1:0]       STATUS_MPP,
 | 
					  output logic [1:0]       STATUS_MPP,
 | 
				
			||||||
  output logic             STATUS_SPP, STATUS_TSR,
 | 
					  output logic             STATUS_SPP, STATUS_TSR, STATUS_TVM,
 | 
				
			||||||
  output logic [`XLEN-1:0] MEPC_REGW, SEPC_REGW, STVEC_REGW, MTVEC_REGW,
 | 
					  output logic [`XLEN-1:0] MEPC_REGW, SEPC_REGW, STVEC_REGW, MTVEC_REGW,
 | 
				
			||||||
  output logic [`XLEN-1:0]      MEDELEG_REGW, 
 | 
					  output logic [`XLEN-1:0]      MEDELEG_REGW, 
 | 
				
			||||||
  output logic [`XLEN-1:0] SATP_REGW,
 | 
					  output logic [`XLEN-1:0] SATP_REGW,
 | 
				
			||||||
@ -86,7 +86,6 @@ module csr #(parameter
 | 
				
			|||||||
  logic [31:0]     MCOUNTINHIBIT_REGW, MCOUNTEREN_REGW, SCOUNTEREN_REGW;
 | 
					  logic [31:0]     MCOUNTINHIBIT_REGW, MCOUNTEREN_REGW, SCOUNTEREN_REGW;
 | 
				
			||||||
  logic            WriteMSTATUSM, WriteSSTATUSM;
 | 
					  logic            WriteMSTATUSM, WriteSSTATUSM;
 | 
				
			||||||
  logic            CSRMWriteM, CSRSWriteM, CSRUWriteM;
 | 
					  logic            CSRMWriteM, CSRSWriteM, CSRUWriteM;
 | 
				
			||||||
  logic            STATUS_TVM;
 | 
					 | 
				
			||||||
  logic            WriteFRMM, WriteFFLAGSM;
 | 
					  logic            WriteFRMM, WriteFFLAGSM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  logic [`XLEN-1:0] UnalignedNextEPCM, NextEPCM, NextCauseM, NextMtvalM;
 | 
					  logic [`XLEN-1:0] UnalignedNextEPCM, NextEPCM, NextCauseM, NextMtvalM;
 | 
				
			||||||
 | 
				
			|||||||
@ -36,12 +36,12 @@ module privdec (
 | 
				
			|||||||
  input  logic         PrivilegedM, IllegalIEUInstrFaultM, IllegalCSRAccessM, IllegalFPUInstrM, 
 | 
					  input  logic         PrivilegedM, IllegalIEUInstrFaultM, IllegalCSRAccessM, IllegalFPUInstrM, 
 | 
				
			||||||
  input  logic         TrappedSRETM, WFITimeoutM,
 | 
					  input  logic         TrappedSRETM, WFITimeoutM,
 | 
				
			||||||
  input  logic [1:0]   PrivilegeModeW, 
 | 
					  input  logic [1:0]   PrivilegeModeW, 
 | 
				
			||||||
  input  logic         STATUS_TSR, 
 | 
					  input  logic         STATUS_TSR, STATUS_TVM,
 | 
				
			||||||
  input  logic [1:0]   STATUS_FS,
 | 
					  input  logic [1:0]   STATUS_FS,
 | 
				
			||||||
  output logic         IllegalInstrFaultM,
 | 
					  output logic         IllegalInstrFaultM,
 | 
				
			||||||
  output logic         sretM, mretM, ecallM, ebreakM, wfiM, sfencevmaM);
 | 
					  output logic         sretM, mretM, ecallM, ebreakM, wfiM, sfencevmaM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  logic IllegalPrivilegedInstrM;
 | 
					  logic IllegalPrivilegedInstrM, IllegalOrDisabledFPUInstrM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // xRET defined in Privileged Spect 3.2.2
 | 
					  // xRET defined in Privileged Spect 3.2.2
 | 
				
			||||||
  assign sretM =      PrivilegedM & (InstrM[31:20] == 12'b000100000010) & `S_SUPPORTED & 
 | 
					  assign sretM =      PrivilegedM & (InstrM[31:20] == 12'b000100000010) & `S_SUPPORTED & 
 | 
				
			||||||
@ -51,8 +51,10 @@ module privdec (
 | 
				
			|||||||
  assign ecallM =     PrivilegedM & (InstrM[31:20] == 12'b000000000000);
 | 
					  assign ecallM =     PrivilegedM & (InstrM[31:20] == 12'b000000000000);
 | 
				
			||||||
  assign ebreakM =    PrivilegedM & (InstrM[31:20] == 12'b000000000001);
 | 
					  assign ebreakM =    PrivilegedM & (InstrM[31:20] == 12'b000000000001);
 | 
				
			||||||
  assign wfiM =       PrivilegedM & (InstrM[31:20] == 12'b000100000101);
 | 
					  assign wfiM =       PrivilegedM & (InstrM[31:20] == 12'b000100000101);
 | 
				
			||||||
  assign sfencevmaM = PrivilegedM & (InstrM[31:25] ==  7'b0001001) & (PrivilegedModeW == `M_MODE | (PrivilegeModeW == `S_MODE & ~STATUS_TVM)); // *** does this work in U mode?
 | 
					  assign sfencevmaM = PrivilegedM & (InstrM[31:25] ==  7'b0001001) & 
 | 
				
			||||||
 | 
					                      (PrivilegeModeW == `M_MODE | (PrivilegeModeW == `S_MODE & ~STATUS_TVM)); 
 | 
				
			||||||
  assign IllegalPrivilegedInstrM = PrivilegedM & ~(sretM|mretM|ecallM|ebreakM|wfiM|sfencevmaM);
 | 
					  assign IllegalPrivilegedInstrM = PrivilegedM & ~(sretM|mretM|ecallM|ebreakM|wfiM|sfencevmaM);
 | 
				
			||||||
  assign IllegalInstrFaultM = (IllegalIEUInstrFaultM & (IllegalFPUInstrM | (STATUS_FS == 2'b00))) | IllegalPrivilegedInstrM | IllegalCSRAccessM | 
 | 
					  assign IllegalOrDisabledFPUInstrM = IllegalFPUInstrM | (STATUS_FS == 2'b00);
 | 
				
			||||||
                               TrappedSRETM | WFITimeoutM; // *** generalize this for other instructions
 | 
					  assign IllegalInstrFaultM = (IllegalIEUInstrFaultM & IllegalOrDisabledFPUInstrM) | IllegalPrivilegedInstrM | IllegalCSRAccessM | 
 | 
				
			||||||
 | 
					                               TrappedSRETM | WFITimeoutM; 
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
				
			|||||||
@ -99,7 +99,7 @@ module privileged (
 | 
				
			|||||||
  logic MTrapM, STrapM, UTrapM;
 | 
					  logic MTrapM, STrapM, UTrapM;
 | 
				
			||||||
  (* mark_debug = "true" *)  logic InterruptM; 
 | 
					  (* mark_debug = "true" *)  logic InterruptM; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  logic       STATUS_SPP, STATUS_TSR, STATUS_TW; 
 | 
					  logic       STATUS_SPP, STATUS_TSR, STATUS_TW, STATUS_TVM;
 | 
				
			||||||
  logic       STATUS_MIE, STATUS_SIE;
 | 
					  logic       STATUS_MIE, STATUS_SIE;
 | 
				
			||||||
  logic [11:0] MIP_REGW, MIE_REGW, SIP_REGW, SIE_REGW;
 | 
					  logic [11:0] MIP_REGW, MIE_REGW, SIP_REGW, SIE_REGW;
 | 
				
			||||||
  logic md;
 | 
					  logic md;
 | 
				
			||||||
@ -148,7 +148,7 @@ module privileged (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   privdec pmd(.InstrM(InstrM[31:20]), 
 | 
					   privdec pmd(.InstrM(InstrM[31:20]), 
 | 
				
			||||||
              .PrivilegedM, .IllegalIEUInstrFaultM, .IllegalCSRAccessM, .IllegalFPUInstrM, .TrappedSRETM, .WFITimeoutM,
 | 
					              .PrivilegedM, .IllegalIEUInstrFaultM, .IllegalCSRAccessM, .IllegalFPUInstrM, .TrappedSRETM, .WFITimeoutM,
 | 
				
			||||||
              .PrivilegeModeW, .STATUS_TSR, .STATUS_FS, .IllegalInstrFaultM, 
 | 
					              .PrivilegeModeW, .STATUS_TSR, .STATUS_TVM, .STATUS_FS, .IllegalInstrFaultM, 
 | 
				
			||||||
              .sretM, .mretM, .ecallM, .ebreakM, .wfiM, .sfencevmaM);
 | 
					              .sretM, .mretM, .ecallM, .ebreakM, .wfiM, .sfencevmaM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ///////////////////////////////////////////
 | 
					  ///////////////////////////////////////////
 | 
				
			||||||
@ -166,7 +166,7 @@ module privileged (
 | 
				
			|||||||
          .BPPredClassNonCFIWrongM, .InstrClassM, .DCacheMiss, .DCacheAccess, .ICacheMiss, .ICacheAccess,
 | 
					          .BPPredClassNonCFIWrongM, .InstrClassM, .DCacheMiss, .DCacheAccess, .ICacheMiss, .ICacheAccess,
 | 
				
			||||||
          .NextPrivilegeModeM, .PrivilegeModeW,
 | 
					          .NextPrivilegeModeM, .PrivilegeModeW,
 | 
				
			||||||
          .CauseM, .NextFaultMtvalM, .STATUS_MPP,
 | 
					          .CauseM, .NextFaultMtvalM, .STATUS_MPP,
 | 
				
			||||||
          .STATUS_SPP, .STATUS_TSR,
 | 
					          .STATUS_SPP, .STATUS_TSR, .STATUS_TVM,
 | 
				
			||||||
          .MEPC_REGW, .SEPC_REGW, .STVEC_REGW, .MTVEC_REGW,
 | 
					          .MEPC_REGW, .SEPC_REGW, .STVEC_REGW, .MTVEC_REGW,
 | 
				
			||||||
          .MEDELEG_REGW, 
 | 
					          .MEDELEG_REGW, 
 | 
				
			||||||
          .SATP_REGW,
 | 
					          .SATP_REGW,
 | 
				
			||||||
 | 
				
			|||||||
@ -1483,7 +1483,6 @@ string imperas32f[] = '{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 string wally32e[] = '{
 | 
					 string wally32e[] = '{
 | 
				
			||||||
    `WALLYTEST,
 | 
					    `WALLYTEST,
 | 
				
			||||||
    "rv32i_m/I/E-beq-01", "03b010",
 | 
					 | 
				
			||||||
    "rv32i_m/I/E-add-01", "005010",
 | 
					    "rv32i_m/I/E-add-01", "005010",
 | 
				
			||||||
    "rv32i_m/I/E-addi-01", "004010",
 | 
					    "rv32i_m/I/E-addi-01", "004010",
 | 
				
			||||||
    "rv32i_m/I/E-and-01", "005010",
 | 
					    "rv32i_m/I/E-and-01", "005010",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user