forked from Github_Repos/cvw
		
	Added comments about PMP checker fixes when test cases will be ready to initialize PMP before entering user mode
This commit is contained in:
		
							parent
							
								
									031cc6967a
								
							
						
					
					
						commit
						02e7e7d011
					
				@ -50,14 +50,14 @@ module pmpchecker (
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
  // Bit i is high when the address falls in PMP region i
 | 
			
		||||
  logic                    EnforcePMP;
 | 
			
		||||
  logic                    EnforcePMP; // should PMP be checked in this privilege level
 | 
			
		||||
  logic [`PMP_ENTRIES-1:0] Match;      // physical address matches one of the pmp ranges
 | 
			
		||||
  logic [`PMP_ENTRIES-1:0] FirstMatch; // onehot encoding for the first pmpaddr to match the current address.
 | 
			
		||||
  logic [`PMP_ENTRIES-1:0] Active;     // PMP register i is non-null
 | 
			
		||||
  logic [`PMP_ENTRIES-1:0] L, X, W, R; // PMP matches and has flag set
 | 
			
		||||
  logic [`PMP_ENTRIES-1:0] PAgePMPAdr; // for TOR PMP matching, PhysicalAddress > PMPAdr[i]
 | 
			
		||||
 | 
			
		||||
  if (`PMP_ENTRIES > 0) 
 | 
			
		||||
  if (`PMP_ENTRIES > 0) // prevent complaints about array of no elements when PMP_ENTRIES = 0
 | 
			
		||||
    pmpadrdec pmpadrdecs[`PMP_ENTRIES-1:0](
 | 
			
		||||
      .PhysicalAddress, 
 | 
			
		||||
      .PMPCfg(PMPCFG_ARRAY_REGW),
 | 
			
		||||
@ -68,8 +68,10 @@ module pmpchecker (
 | 
			
		||||
 | 
			
		||||
  priorityonehot #(`PMP_ENTRIES) pmppriority(.a(Match), .y(FirstMatch)); // combine the match signal from all the adress decoders to find the first one that matches.
 | 
			
		||||
 | 
			
		||||
  // Only enforce PMP checking for S and U modes when at least one PMP is active or in Machine mode when L bit is set in selected region
 | 
			
		||||
  // Only enforce PMP checking for S and U modes or in Machine mode when L bit is set in selected region
 | 
			
		||||
  assign EnforcePMP = (PrivilegeModeW == `M_MODE) ? |(L & FirstMatch) : |Active; 
 | 
			
		||||
//  assign EnforcePMP = (PrivilegeModeW != `M_MODE) | |(L & FirstMatch); // *** switch to this logic when PMP is initialized for non-machine mode
 | 
			
		||||
//  *** remove unused Active lines from pmpadrdecs
 | 
			
		||||
 | 
			
		||||
  assign PMPInstrAccessFaultF     = EnforcePMP & ExecuteAccessF & ~|(X & FirstMatch) ;
 | 
			
		||||
  assign PMPStoreAmoAccessFaultM  = EnforcePMP & WriteAccessM   & ~|(W & FirstMatch) ;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user