`timescale 1ns/1ps //函数测试 //2011-1-8
module tb3;
reg clk; integer i;
initial begin i=0; end
initial begin clk=0; forever begin #10; clk=~clk; end end
task task_test; begin @(negedge clk); i=i+1; $display("i=%d",i); end endtask
//function 不可行 //function fun_test; //begin // @(negedge clk); // i=i+1; // $display("i=%d",i); //end //endfunction
initial begin repeat(10) begin task_test(); end $stop; end
endmodule