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

Supplies Power & Ground

Verilog Switch Level Modeling

Supplies Power & Ground — a ready-to-run Verilog example.

Open in IDE
design.v
module des (output vdd,
			output gnd);

	supply1 _vdd;
	supply0 _gnd;

	assign vdd = _vdd;
	assign gnd = _gnd;
endmodule
testbench.v
module tb;
  wire vdd, gnd;

  des u0 (.vdd(vdd), .gnd(gnd));

  initial begin
    #10;
    $display ("T=%0t vdd=%0d gnd=%0d", $time, vdd, gnd);
  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.