//2006.12 by jr
module top;
integer result;
initial
begin
result="jiecheng"(4);//相当于测试程序,一定要加initial,不能省略直接写result=jiecheng(4)
end
function automatic integer jiecheng; //这里一定要加automatic integer,不然的话只运行一次,结果为1,加了后正确结果为24
input [31:0] oper;
begin
if(oper>=2)
jiecheng="jiecheng"(oper-1)*oper;
else
jiecheng="1";
end
endfunction
initial #100 $finish;
endmodule
ash_riple_768180695 2006-12-24 16:12