mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Fixed how the dcache and page table walker stall cpu so that once a tlb miss occurs the CPU is always stalled until the walk is complete, the tlb updated, and the dcache fetched and hits.
This commit is contained in:
		
							parent
							
								
									8610ef204c
								
							
						
					
					
						commit
						b9902b0560
					
				
							
								
								
									
										8
									
								
								wally-pipelined/src/cache/dcache.sv
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								wally-pipelined/src/cache/dcache.sv
									
									
									
									
										vendored
									
									
								
							@ -434,6 +434,13 @@ module dcache
 | 
			
		||||
      STATE_READY: begin
 | 
			
		||||
	// TLB Miss	
 | 
			
		||||
	if(AnyCPUReqM & DTLBMissM) begin
 | 
			
		||||
	  // the LSU arbiter has not yet selected the PTW.
 | 
			
		||||
	  // The CPU needs to be stalled until that happens.
 | 
			
		||||
	  // If we set DCacheStall for 1 cycle before going to
 | 
			
		||||
	  // PTW ready the CPU will stall.
 | 
			
		||||
	  // The page table walker asserts it's control 1 cycle
 | 
			
		||||
	  // after the TLBs miss.
 | 
			
		||||
	  DCacheStall = 1'b1;
 | 
			
		||||
	  NextState = STATE_PTW_READY;
 | 
			
		||||
	end
 | 
			
		||||
	// amo hit
 | 
			
		||||
@ -580,6 +587,7 @@ module dcache
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      STATE_PTW_READY: begin
 | 
			
		||||
	// now all output connect to PTW instead of CPU.
 | 
			
		||||
	CommittedM = 1'b1;
 | 
			
		||||
	// return to ready if page table walk completed.
 | 
			
		||||
	if(DTLBWriteM) begin
 | 
			
		||||
 | 
			
		||||
@ -77,7 +77,6 @@ module pagetablewalker
 | 
			
		||||
    if (`MEM_VIRTMEM) begin
 | 
			
		||||
      // Internal signals
 | 
			
		||||
      // register TLBs translation miss requests
 | 
			
		||||
      logic [`XLEN-1:0] 	    TranslationVAdrQ;
 | 
			
		||||
      logic 			    ITLBMissFQ, DTLBMissMQ;
 | 
			
		||||
      
 | 
			
		||||
      logic [`PPN_BITS-1:0] 	    BasePageTablePPN;
 | 
			
		||||
@ -138,13 +137,6 @@ module pagetablewalker
 | 
			
		||||
      assign TranslationVAdr = (SelDataTranslation) ? MemAdrM : PCF; // *** need to register TranslationVAdr
 | 
			
		||||
      assign SelDataTranslation = DTLBMissMQ | DTLBMissM;
 | 
			
		||||
 | 
			
		||||
      flopenr #(`XLEN) 
 | 
			
		||||
      TranslationVAdrReg(.clk(clk),
 | 
			
		||||
			 .reset(reset),
 | 
			
		||||
			 .en(StartWalk),
 | 
			
		||||
			 .d(TranslationVAdr),
 | 
			
		||||
			 .q(TranslationVAdrQ));
 | 
			
		||||
 | 
			
		||||
      flopenrc #(1)
 | 
			
		||||
      DTLBMissMReg(.clk(clk),
 | 
			
		||||
		   .reset(reset),
 | 
			
		||||
@ -170,7 +162,7 @@ module pagetablewalker
 | 
			
		||||
		       (WalkerState == LEVEL3 && ValidPTE && LeafPTE && ~AccessAlert) ||		   
 | 
			
		||||
		       (WalkerState == FAULT);
 | 
			
		||||
      
 | 
			
		||||
      assign HPTWTranslate = (DTLBMissMQ | ITLBMissFQ) & ~EndWalk;
 | 
			
		||||
      assign HPTWTranslate = (DTLBMissMQ | ITLBMissFQ);
 | 
			
		||||
      //assign HPTWTranslate = DTLBMissM | ITLBMissF;
 | 
			
		||||
 | 
			
		||||
      // unswizzle PTE bits
 | 
			
		||||
 | 
			
		||||
@ -543,10 +543,10 @@ string tests32f[] = '{
 | 
			
		||||
        if (`C_SUPPORTED) tests = {tests, tests64ic};
 | 
			
		||||
        else              tests = {tests, tests64iNOc};
 | 
			
		||||
        if (`M_SUPPORTED) tests = {tests, tests64m};
 | 
			
		||||
        if (`MEM_VIRTMEM) tests = {tests, tests64mmu};
 | 
			
		||||
        //if (`A_SUPPORTED) tests = {tests, tests64a};
 | 
			
		||||
        if (`F_SUPPORTED) tests = {tests64f, tests};
 | 
			
		||||
        if (`D_SUPPORTED) tests = {tests64d, tests};
 | 
			
		||||
        if (`MEM_VIRTMEM) tests = {tests64mmu, tests};
 | 
			
		||||
      end
 | 
			
		||||
      //tests = {tests64a, tests};
 | 
			
		||||
    end else begin // RV32
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user