2013-02-15 54 views
1

我在VHDL编程初学者,我试图合成以下VHDL代码(软件谴责的按钮)使用ISE项目导航13.1赛灵思VHDL错误827:信号<name>不能合成

entity PBdebouncer is 
Port (PB : in STD_LOGIC; 
     CLK : in STD_LOGIC; 
     reset : in STD_LOGIC; 
     PBdebounced : out STD_LOGIC); 
end PBdebouncer; 

architecture Behavioral of PBdebouncer is 

begin 

    p1: process(CLK , PB , reset) 
     variable enable,count : integer range 0 to 100000 := 0; 
    begin 
     if(reset = '1') then 
      count := 0; 
      enable :=0; 
     elsif(CLK' event and CLK = '1') then 
      if (enable = 1) then 
       count := count + 1; 
      end if; 

      if(count = 99999) then 
       if(PB = '0') then 
        PBdebounced <= '0'; 
       else 
        PBdebounced <= '0'; 
       end if; 

       count := 0; 
       enable := 0; 
      end if; 

      count := count; 

     else 
      enable := 1; 
     end if; 

    end process; 
end Behavioral; 

ERROR:Xst:827 - ".../digital lab II 110/PBdebouncer/PBdebouncer.vhd" line 43: Signal enable cannot be synthesized, bad synchronous description. The description style you are using to describe a synchronous element (register, memory, etc.) is not supported in the current software release.

所以,请你解释一下这个错误我:不幸的是,我有以下错误撞到?

回答

4

尝试没有和事件Clk时之间的空间” ......

其他一些问题:
为什么‘使’有一个范围从0到100000时,你只使用其中的两个值?为什么不使用布尔或std_logic?
是“pbdebounced”曾经应该设置为“0”以外的任何值吗?
为什么布尔表达式的圆括号?
为什么PB在灵敏度列表中?
它在仿真中按预期工作吗?

这些可能现在做...

编辑:坏格式藏问题:

begin 
    if reset = '1' then 
     count := 0; 
     enable :=0; 
    elsif rising_edge(clk) then 
     if enable = 1 then 
     count := count + 1; 
     end if; 
     if count = 99999 then 
     -- do stuff 
     end if; 
     count:= count; 
-- else 
-- enable := 1; 
-- THE TWO LINES ABOVE are the problem 
-- They are outside both the CLK and RESET clauses. 
    end if; 
end process; 
+0

关于< enable >类型我试过每一件事,但仍然是相同的错误 – Wazani 2013-02-15 21:45:44

+0

关于我在前面的代码中有一个错误,它应该是:'if(PB ='0')then PBdebounced <='0' ; \t \t别的PBdebounced <= '1'; \t \t end if;'关于圆括号 – Wazani 2013-02-15 21:47:01

+0

:我试过的代码没有他们,但它仍然同样的问题 – Wazani 2013-02-15 21:50:39

1

问题的原因似乎已经确定Brians答案 - 但我在这些情况下,您只需添加一条提示:

在Xilinx ISE中,您可以查看多种语言模板(选择编辑 - >语言模板),这可以帮助您在实现各种类型的触发器(同步/异步复位,上升/下降沿触发ered等)和其他构造。

这些可以是真正有用的 - 得到错误的消息这样的,其通常是由于描述不能在所选择的设备来合成硬件语法正确的VHDL代码时尤其如此。

2

只是一个小建议:避免变量作为初学者。 他们似乎在软件程序中工作,但他们有时映射到硬件的讨厌的东西。