ACTIV HDL - VHDL- "Signal cannot be synthesized, bad synchronous description"



我在Xillinx中合成此代码时出错。此错误为:

"信号Z_1无法合成,同步描述不良">

entity uk3 is
port(
rst : in BIT;
C : in INTEGER;
clk : in BIT;
S : out INTEGER
);
end uk3;
--}} End of automatically maintained section
architecture uk3 of uk3 is
begin
process (C,clk,rst)
variable Z_1 : integer:=0;
begin
if rst='1' then Z_1:=0;
elsif rst='0'and clk'event and clk='1'and C=1
then 
Z_1:=Z_1 + 1;
elsif rst='0'and clk'event and clk='1'and C=2
then
Z_1:=Z_1 + 2;   
else
Z_1:=Z_1;
end if;
S<=Z_1;
end process;
-- enter your statements here --
end uk3;

为什么?

您有一个包含复位检查条件的if子句,然后是两个单独的门控时钟条件,然后是一个else子句。我认为没有任何工具可以综合它,因为你不太可能真正想要你所描述的东西,而且无论如何都很难放入硬件中。您需要阅读有关HDL和同步设计基础知识的更多信息。

可以这样想:如果你像编译器一样,从上到下、逐行阅读你编写的代码,你将如何实际构建执行你所描述的硬件?你如何构建一个硬件,在一个时钟上做一件事,在另一个时钟上做另一件事,当根本没有应用时钟时做第三件事?如何在 FPGA LUT 中实现这一点?

简而言之,要让你的代码工作,你需要摆脱else子句,无论如何它什么都不做,合成器通常不喜欢elseelsif子句旁边的时钟条件(if rising_egde(clk)if clk'event and clk = '1')。C的条件应在主时钟语句中的单独if子句中进行检查。此外,删除elsif子句中的rst = '0'检查。您已在if语句中检查了rst = '1',并且bit信号只能'1'或"0"。

可合成的代码如下所示:

process (clk, rst)
if rst = '1' then
-- your reset condition
elsif clk'event and clk = '1' then -- if you use a bit type clk, otherwise use elsif rising_edge(clk) then
if signal = condition then
-- whatever you need doing
else
-- whatever you need doing
end if;
end if;
end process;

相关内容

最新更新