forked from Github_Repos/cvw
		
	Merge branch 'main' of github.com:davidharrishmc/riscv-wally into main
This commit is contained in:
		
						commit
						dac93bb366
					
				@ -98,8 +98,6 @@ module ifu (
 | 
			
		||||
  logic 	    reset_q; // *** look at this later.
 | 
			
		||||
 | 
			
		||||
  logic 	    BPPredDirWrongE, BTBPredPCWrongE, RASPredPCWrongE, BPPredClassNonCFIWrongE;
 | 
			
		||||
 | 
			
		||||
  logic 	    PMPInstrAccessFaultF, PMAInstrAccessFaultF;
 | 
			
		||||
  
 | 
			
		||||
  logic [`PA_BITS-1:0] PCPFmmu, PCNextFPhys; // used to either truncate or expand PCPF and PCNextF into `PA_BITS width.
 | 
			
		||||
  logic [`XLEN+1:0]    PCFExt;
 | 
			
		||||
 | 
			
		||||
@ -78,7 +78,7 @@ module tlbcontrol #(parameter ITLB = 0) (
 | 
			
		||||
  endgenerate
 | 
			
		||||
 | 
			
		||||
  // Determine whether TLB is being used
 | 
			
		||||
  assign TLBAccess = ReadAccess || WriteAccess;
 | 
			
		||||
  assign TLBAccess = ReadAccess | WriteAccess;
 | 
			
		||||
 | 
			
		||||
  // Check whether upper bits of virtual addresss are all equal
 | 
			
		||||
 | 
			
		||||
@ -120,5 +120,5 @@ module tlbcontrol #(parameter ITLB = 0) (
 | 
			
		||||
  endgenerate
 | 
			
		||||
 | 
			
		||||
  assign TLBHit = CAMHit & TLBAccess;
 | 
			
		||||
  assign TLBMiss = ~CAMHit & ~TLBFlush & Translate & TLBAccess;
 | 
			
		||||
  assign TLBMiss = (~CAMHit | TLBFlush) & Translate & TLBAccess;
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
@ -102,6 +102,7 @@ module privileged (
 | 
			
		||||
  logic       STATUS_MIE, STATUS_SIE;
 | 
			
		||||
  logic [11:0] MIP_REGW, MIE_REGW, SIP_REGW, SIE_REGW;
 | 
			
		||||
  logic md, sd;
 | 
			
		||||
  logic       StallMQ;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  ///////////////////////////////////////////
 | 
			
		||||
@ -157,8 +158,16 @@ module privileged (
 | 
			
		||||
 | 
			
		||||
  assign BreakpointFaultM = ebreakM; // could have other causes too
 | 
			
		||||
  assign EcallFaultM = ecallM;
 | 
			
		||||
  assign ITLBFlushF = sfencevmaM;
 | 
			
		||||
 | 
			
		||||
  flopr #(1) StallMReg(.clk, .reset, .d(StallM), .q(StallMQ));
 | 
			
		||||
  assign ITLBFlushF = sfencevmaM & ~StallMQ;
 | 
			
		||||
  assign DTLBFlushM = sfencevmaM;
 | 
			
		||||
  // sets ITLBFlush to pulse for one cycle of the sfence.vma instruction
 | 
			
		||||
  // In this instr we want to flush the tlb and then do a pagetable walk to update the itlb and continue the program.
 | 
			
		||||
  // But we're still in the stalled sfence instruction, so if itlbflushf == sfencevmaM, tlbflush would never drop and 
 | 
			
		||||
  // the tlbwrite would never take place after the pagetable walk. by adding in ~StallMQ, we are able to drop itlbflush 
 | 
			
		||||
  // after a cycle AND pulse it for another cycle on any further back-to-back sfences. 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // A page fault might occur because of insufficient privilege during a TLB
 | 
			
		||||
  // lookup or a improperly formatted page table during walking
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user