module tryfunc(result,num,clk,reset); output[31:0] result; input[3:0] num; input clk,reset; reg[31:0] result; function[31:0] m6; input[3:0] n; reg[3:0] n; reg[4:0] i; begin m6=1; for (i=2;i<=n;i=i+1) m6=m6*i; end endfunction [email=always@(posedge]always@(posedge[/email] clk) begin if (!reset) result<=0; else result<=m6(num); end endmodule 在函数中为什么i只有声明位4位时才能编译并且仿真也正确,理论上分析不是3位就可以了吗???? |