总是提示:loop with non-constant loop condition must terminate within 250 iterations.
代码如下:
module funtest(clk,rst,n,q);
input clk,rst;
input [3:0]n;
output reg[31:0]q;
always @(posedge clk)
begin
if(rst)
q<=0;
else
begin
q<=factorial(n);
end
end
function [31:0] factorial;
input [3:0]pram_n;
reg [3:0]i=1;
begin
factorial=pram_n?1:0;
factorial=1;
for(i=2;i<=pram_n;i=i+1)
factorial=i*factorial;
end
endfunction
endmodule
肥皂起泡泡
红糖糍粑