mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Added timeout check to testbench.
A watchdog checks the value of PCW. If it does not change within 1M cycles immediately stop simulation and report an error.
This commit is contained in:
		
							parent
							
								
									ac94b55e74
								
							
						
					
					
						commit
						3d95aa3423
					
				| @ -428,6 +428,27 @@ logic [3:0] dummy; | |||||||
|         end |         end | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|  | 
 | ||||||
|  |   // check for hange up.
 | ||||||
|  |   logic [`XLEN-1:0] OldPCW; | ||||||
|  |   integer 			WatchDogTimerCount; | ||||||
|  |   localparam WatchDogTimerThreshold = 1000000; | ||||||
|  |   logic 			WatchDogTimeOut; | ||||||
|  |   always_ff @(posedge clk) begin | ||||||
|  | 	OldPCW <= PCW; | ||||||
|  | 	if(OldPCW == PCW) WatchDogTimerCount = WatchDogTimerCount + 1'b1; | ||||||
|  | 	else WatchDogTimerCount = '0; | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   always_comb begin | ||||||
|  | 	WatchDogTimeOut = WatchDogTimerCount >= WatchDogTimerThreshold; | ||||||
|  | 	if(WatchDogTimeOut) begin | ||||||
|  | 	  $display("FAILURE: Watch Dog Time Out triggered. PCW stuck at %x for more than %d cycles", PCW, WatchDogTimerCount); | ||||||
|  | 	  $stop; | ||||||
|  | 	end | ||||||
|  |   end | ||||||
|  |    | ||||||
|  |    | ||||||
| endmodule | endmodule | ||||||
| 
 | 
 | ||||||
| module riscvassertions; | module riscvassertions; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user