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 8: Write simple Verilog code to generate 100MHz clock.

Verilog Examples

Runnable example from the Verilog Interview Questions Set 8 tutorial (Write simple Verilog code to generate 100MHz clock.)

Open in IDE
testbench.v
module tb;
	reg clk;

	initial clk = 0;   // without this, clk stays x forever
	// 1/100M = 10ns period 
	always #5 clk = ~clk;
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.