【问题标题】:flip-flop does not hold value until its clock NOT edge condition触发器在其时钟非​​边缘条件之前不会保持值
【发布时间】:2017-05-23 20:49:35
【问题描述】:

我试图创建一个具有复位启用和同步数据加载的触发器。它在 VHDL 仿真中工作正常,但是当我尝试在 ISE 中合成它时,它给了我以下错误:

第 24 行:语句不可综合,因为它在 NOT(clock-edge) 条件下不保持其值

代码如下:

library ieee;  
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity D_FF is
port (D: in std_logic;
      clk: in std_logic;
      reset_enable: in std_logic;
      reset: in std_logic;
      Q: out std_logic:='0'
); 
end D_FF;    

architecture a1 of D_FF is
begin
  proc: process (D,clk,reset,reset_enable)
  begin
    if (reset_enable='1') then 
      if (reset='1') then
        q<='0';
      end if;
    end if;
    if (clk'event and clk='1') then -- Line 24
      q<=d; 
    end if; 
  end process proc;
end a1;

如何修复此错误,以使代码可合成并与我编写的代码等效?

【问题讨论】:

  • 分配q 的两个 if 语句描述了时序逻辑,一个是锁存器,另一个是寄存器。将它们组合成一个带有异步部分的 if 语句 - if reset_condition ... 后跟 elsifclock_event_condition ....。 Xilinx 避免在其综合用户指南中显示异步复位/设置编码示例。不鼓励使用阻止某些类型的优化。另请参阅 IEEE Std 1076.6-2004 IEEE Standard for VHDL Register Transfer Level (RTL) Synthesis(已撤回)。敏感度列表中不需要 D。
  • 您的时钟进程需要看起来像这样stackoverflow.com/a/34067908/4090959。也不要use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;
  • 什么是reset_enable?最好不要使用这个:您在异步域中添加逻辑,这可能会导致时序收敛问题。

标签: vhdl


【解决方案1】:

为您指明正确的方向:当同时出现复位和 clk 边缘时会发生什么?

解决方案:

if (reset = '1' and reset_enable = '1') then
    q <= '0';
elsif (clk'event and clk = '1') then
    q <= d;
end if;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多