【问题标题】:ACTIV HDL - VHDL-"Signal cannot be synthesized, bad synchronous description"ACTIV HDL - VHDL-“信号无法合成,同步描述错误”
【发布时间】:2018-01-18 13:45:08
【问题描述】:

在 Xilinx 中合成此代码时出现错误。这个错误是:

“信号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;

为什么?

【问题讨论】:

标签: vhdl


【解决方案1】:

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

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

简而言之,要让您的代码正常工作,您需要去掉 else 子句,无论如何它什么都不做,合成器通常不喜欢 else 或 elsif 子句以及时钟条件( 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;

【讨论】:

    猜你喜欢
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多