繁体   English   中英

如何在Xilinx中实现最大公约数? [VHDL]

[英]How to implement the Greatest Common Divisor in Xilinx ? [VHDL]

我正在尝试使用VHDL语言实现一个简单的GCD算法,但出现此错误“ ERROR:HDLCompiler:981:超出了非静态循环限制”。

那么,while语句如何在没有上述错误的情况下工作? 如果它不能与xilinx 14.7配合使用,我可以用什么语句替换它?

signal a,b,GCD: integer;

a<=100; --example of a
b<=50; --example of b
while NOT (a*b=0) loop
if a>b then
a<=a-b;
else
b<=b-a;
end if;
end loop;
if a=0 then --result
GCD<=b; 
else GCD<=a; 
end if;

谢谢,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM