Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

$stop $finish: $finish

Verilog Examples

Runnable example from the Verilog $stop $finish tutorial ($finish)

Open in IDE
testbench.v
module tb;

  initial begin

    // Some simulation code...
    #10 $display("Waited to 10 units");

    // Terminate simulation and print a diagnostic message
    $finish(1);

    // This delay will never be executed in simulation because it will be
    // terminated by the line before
    #100;
  end

endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.