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 [7:0] addr = 8'h05;    // Initialize to 0x05

  initial
    addr = 8'hee;            // Also assigns at time 0 - RACE CONDITION!
                             // Final value could be 0x05 OR 0xEE (undefined)
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.