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

Gate Delay

Verilog Gate Level Modeling

Shows how to model in single delay format

Open in IDE
design.v
module des (	input 	a, b,
            	output out1, out2);

	// AND gate has 2 time unit gate delay
  and 		#(2) o1 (out1, a, b);
  
  // BUFIF0 gate has 3 time unit gate delay
  bufif0 	#(3) b1 (out2, a, b);
  
endmodule
testbench.v
module tb;
  reg a, b;
  wire out1, out2;
  
  des d0 (.out1(out1), .out2(out2), .a(a), .b(b));
  
  initial begin
    {a, b} <= 0;
    
    $monitor ("T=%0t a=%0b b=%0b and=%0b bufif0=%0b", $time, a, b, out1, out2);
    
    #10 a <= 1;
    #10 b <= 1;
    #10 a <= 0;
    #10 b <= 0;
  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.