Answers for "Verilog"

0

Verilog

module tb;
  reg clk, d, rstn;
  wire q;
  reg [3:0] delay;

  my_design u0 ( .clk(clk), .d(d),
`ifdef INCLUDE_RSTN
                .rstn(rstn),
`endif
                .q(q));

  always #10 clk = ~clk;

  initial begin
    integer i;

    {d, rstn, clk} <= 0;

	#20 rstn <= 1;
    for (i = 0 ; i < 20; i=i+1) begin
      delay = $random;
      #(delay) d <= $random;
    end

    #20 $finish;
  end
endmodule
Posted by: Guest on July-02-2021

Browse Popular Code Answers by Language