encounter 发表于 2010-6-28 00:21:44

verilog这个程序的错误什么意思啊?

verilog这个程序的错误什么意思啊?
module tryfunct(clk,n,result,reset);
input clk,reset;
input n;
output result;
reg result;
always @(posedge clk)
begin
if(!reset)
result<=0;
else
result<=n*factorial(n)/((n*2)+1);
end
function factorial;
input operand;
reg index;
begin
factorial=1;
for(index=2;index<=operand;index=index+1) //说这行有错
factorial=index*factorial;
end
endfunction
endmodule
Error: Verilog HDL For Statement error at tryfunct.v(18): must use only constant expressions in terminating conditions
Error: Can't elaborate top-level user hierarchy

VVC 发表于 2010-6-28 01:34:25

各位大哥帮下忙吧,我检查不出了

ICE 发表于 2010-6-28 03:03:57

我在自己的机子上编译了一下,通过了啊!<br>
不过看你的那上面的错误提示,好像是说for(index=2;index&lt;=operand;index=index+1)里的operand应该换成常量,不能用变量!<br>
我也是初学者,说的不对,大家别见笑!^_^

usd 发表于 2010-6-28 04:12:03

呵呵,我也是初级学者,我编译的提示错误是<br>
@E: CS162 :"F:\tryfunct.v":20:12:20:26|loop iteration limit 2000 exceeded - add '// synthesis loop_limit 4000' before the loop construct

interi 发表于 2010-6-28 05:40:19

呵呵 我用modelsim编译也过了

CTT 发表于 2010-6-28 06:23:08

好像没什么问题啊!

HDL 发表于 2010-6-28 07:09:47

用modelsim编译的话没有错误的提示,<br>
但是用Syplify综合的话会提示有错误的~<br>
<br>
[ 本帖最后由 jerryer 于 2006-7-18 09:28 编辑 ]

CHAN 发表于 2010-6-28 07:46:45

我是quartus ii编译的,郁闷中。

inter 发表于 2010-6-28 09:27:15

原帖由 jerryer 于 2006-7-18 09:26 发表<br>
用modelsim编译的话没有错误的提示,<br>
但是用Syplify综合的话会提示有错误的~ 废话,你写的本来就是不可综合的代码<br>
for循环不能综合

longtime 发表于 2010-6-28 11:00:35

for可以综合的,while才不行的!
页: [1] 2 3
查看完整版本: verilog这个程序的错误什么意思啊?