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

Block Statements

Verilog Procedural Blocks

Example of using 'begin end' to form blocks that are executed sequentially

Open in IDE
Related tutorial:
design.v
testbench.v
module design0;
  	reg [31:0] data;
  
  	// "initial" block starts at time 0
	initial begin
      
      	// After 10 time units, data becomes 0xfe 
		#10   data = 8'hfe;
      	$display ("[Time=%0t] data=0x%0h", $time, data);
      
      	// After 20 time units, data becomes 0x11
		#20   data = 8'h11;
      	$display ("[Time=%0t] data=0x%0h", $time, data);
	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.