VHDL-“信号无法合成,同步描述不良”

时间:2018-01-18 08:01:44

标签: vhdl active-hdl

在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;

为什么呢? PLS

1 个答案:

答案 0 :(得分:1)

您可能应该正确描述同步过程。这不是c / c ++,你应该使用适当的模板,否则它将不会合成。特别是,你应该只有一个对时钟边缘敏感的陈述。

例如:

process (clk,rst)
variable Z_1 : integer:=0;
begin
    if rst='1' then 
        Z_1:=0;
    elsif rising_edge(clk) then
        case C is
            when 1 =>
                Z_1:=Z_1 + 1;
            when 2 => 
                Z_1:=Z_1 + 2;
            when others =>
                null;
        end case;
        S<=Z_1;
    end if;

end process;

请注意,灵敏度列表中没有C,因为不需要。如果没有上升沿,则无论如何都不会触发(它与时钟的上升沿同步)

我没有测试过这段代码,但它应该可以运行。

实际上,为什么不制作Z_1信号而不是变量?

相关问题