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

disable: A Basic Example: Disabling One Named Block

SystemVerilog Threads & Processes

Runnable example from the SystemVerilog disable tutorial (A Basic Example: Disabling One Named Block)

Open in IDE
testbench.sv
module tb;
  initial begin
    fork
      begin : timeout_blk
        #100 $display ("[%0t] Timeout reached", $time);
      end

      begin : monitor_blk
        forever #10 $display ("[%0t] Monitoring...", $time);
      end

      begin
        #30 $display ("[%0t] Event occurred", $time);
        disable timeout_blk;   // cancel only the timeout, leave monitor_blk running
      end
    join_none

    #60 $finish;
  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.