|
用Qutus II 10.1sp1 网络版 尝试调用函数时出错
代码如下
module tryfunct(n,clk,rst_n,result);
input clk,rst_n;
input[3:0] n;
output[31:0] result;
reg[31:0] result;
always @ (posedge clk)
begin
if(!rst_n)
result<=0;
else
begin
result<=n * factorial(n)/((n*2)+1);
end
end
function [31:0] factorial;
input[3:0] operand;
reg [3:0] index;
begin
factorial=1;
for(index=4'd2; index <= operand; index=index+1'b1)
factorial = index * factorial;
end
endfunction
endmodule
(程序摘自Verilog 数字系统设计教程 夏宇闻编著)的第318页
编译时出错信息如下:
ERROR(10119):Verilog HDL Loop Statement error at tryfunct.v(23): loop with non-constant loop condition must terminate within 250 iterations
ERROR(10903):Verilog HDL error at tryfunct.v(13): failed to elaborate task or function "factorial"
ERROR:Can't elaborate top-level user hierarchy
调了好久 原来有几个关于SIZE的警告 改掉了 小弟很急 希望各位大侠帮帮忙 谢谢 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|