Skip to content

Commit d72f6b4

Browse files
authored
ЛР10. Добавление остановки после 10 ошибок в tb_irq
1 parent 0604def commit d72f6b4

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Labs/10. Interrupt subsystem/lab_10.tb_irq.sv

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ int err_count;
2828
always #5 clk_i <= ~clk_i;
2929

3030
initial begin
31-
$display("\n\n===========================\n\nPress 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
389387
endtask
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+
391401
endmodule

0 commit comments

Comments
 (0)