mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Properly flush cacheLRU.
This commit is contained in:
		
							parent
							
								
									e403800ce8
								
							
						
					
					
						commit
						3442b04f9e
					
				
							
								
								
									
										2
									
								
								pipelined/src/cache/cache.sv
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								pipelined/src/cache/cache.sv
									
									
									
									
										vendored
									
									
								
							@ -131,7 +131,7 @@ module cache #(parameter LINELEN,  NUMLINES,  NUMWAYS, LOGBWPL, WORDLEN, MUXINTE
 | 
			
		||||
    .FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .ValidWay, .VictimDirtyWay, .VictimTagWay, .FlushStage, .InvalidateCache);
 | 
			
		||||
  if(NUMWAYS > 1) begin:vict
 | 
			
		||||
    cacheLRU #(NUMWAYS, SETLEN, OFFSETLEN, NUMLINES) cacheLRU(
 | 
			
		||||
      .clk, .reset, .ce, .HitWay, .ValidWay, .VictimWay, .CAdr, .LRUWriteEn(LRUWriteEn & ~FlushStage),
 | 
			
		||||
      .clk, .reset, .ce, .FlushStage, .HitWay, .ValidWay, .VictimWay, .CAdr, .LRUWriteEn(LRUWriteEn & ~FlushStage),
 | 
			
		||||
      .SetValid, .PAdr(PAdr[SETTOP-1:OFFSETLEN]), .InvalidateCache);
 | 
			
		||||
  end else assign VictimWay = 1'b1; // one hot.
 | 
			
		||||
  assign CacheHit = | HitWay;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										6
									
								
								pipelined/src/cache/cacheLRU.sv
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								pipelined/src/cache/cacheLRU.sv
									
									
									
									
										vendored
									
									
								
							@ -32,7 +32,7 @@
 | 
			
		||||
 | 
			
		||||
module cacheLRU
 | 
			
		||||
  #(parameter NUMWAYS = 4, SETLEN = 9, OFFSETLEN = 5, NUMLINES = 128)(
 | 
			
		||||
   input logic                clk, reset, ce,
 | 
			
		||||
   input logic                clk, reset, ce, FlushStage,
 | 
			
		||||
   input logic [NUMWAYS-1:0]  HitWay,
 | 
			
		||||
   input logic [NUMWAYS-1:0]  ValidWay,
 | 
			
		||||
   output logic [NUMWAYS-1:0] VictimWay,
 | 
			
		||||
@ -121,8 +121,8 @@ module cacheLRU
 | 
			
		||||
  always_ff @(posedge clk) begin
 | 
			
		||||
    if (reset) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
 | 
			
		||||
    if(ce) begin
 | 
			
		||||
      if(InvalidateCache) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
 | 
			
		||||
      else if (LRUWriteEn) begin 
 | 
			
		||||
      if(InvalidateCache & ~FlushStage) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
 | 
			
		||||
      else if (LRUWriteEn & ~FlushStage) begin 
 | 
			
		||||
        LRUMemory[PAdr] <= NextLRU;
 | 
			
		||||
        CurrLRU <= #1 NextLRU;
 | 
			
		||||
      end else begin
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user