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

Assignments: Variable Declaration Assignment

Verilog Examples

Runnable example from the Verilog Assignments tutorial (Variable Declaration Assignment)

Open in IDE
testbench.v
module my_block;
  reg [31:0] data = 32'hdead_cafe;   // Initialize at declaration

  initial begin
    #20 data = 32'h1234_5678;   // data will have dead_cafe from time 0 to time 20
                                // At time 20, data will get 1234_5678
  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.