File tree Expand file tree Collapse file tree
Labs/10. Interrupt subsystem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,8 +28,6 @@ int err_count;
2828always # 5 clk_i <= ~ clk_i;
2929
3030initial begin
31- $display (" \n\n ===========================\n\n Press button 'Run All' (F3)\n\n ===========================\n\n " );
32- $stop ();
3331 clk_i = '0 ;
3432 exception_i = '0 ;
3533 mret_i = '0 ;
@@ -388,4 +386,16 @@ task error_info(irq, irq_ret);
388386 if (irq_cause_o!== 32'h8000_0010 ) begin $error (" invalid irq_cause_o = %08h , expected value 32'h8000_0010." , $sampled (irq_cause_o) ); err_count++ ; end
389387endtask
390388
389+ initial begin
390+ automatic int not_stopped = 1 ;
391+ forever begin
392+ @ (posedge clk_i);
393+ if ((err_count >= 10 ) && not_stopped) begin
394+ $display (" Simulation stopped after ten errors." );
395+ $stop ();
396+ not_stopped = 0 ;
397+ end
398+ end
399+ end
400+
391401endmodule
You can’t perform that action at this time.
0 commit comments