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

Interview Questions Set 5: Same variable used in two loops running simultaneousl

Verilog Examples

Runnable example from the Verilog Interview Questions Set 5 tutorial (Same variable used in two loops running simultaneously)

Open in IDE
testbench.v
module tb;  	
  	initial begin
		for (int i = 0; i < 5; i++) begin
        	#5 $display("Loop#1 : i=%0d", i);
		end 
	end
                          
  	initial begin
		for (int i = 0; i < 10; i++) begin
        	#10 $display("Loop#2 : i=%0d", i);
		end 
	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.