简体   繁体   English

D触发器可合成

[英]D flip-flop synthesizable

I want to make a D ff with a little delay on the reset, D will always be '1', clk will be controlled by a switch(it will give a command for a specific floor on an elevator) and count_aux will be a 1Hz clock, but when I try to synthesize it shows me this error "ERROR:Xst:1534 - Sequential logic for node appears to be controlled by multiple clocks.". 我想使D ff在复位时稍有延迟,D始终为'1',clk将由开关控制(它将给出电梯特定楼层的命令),count_aux将为1Hz时钟,但当我尝试进行合成时,显示此错误“ ERROR:Xst:1534-节点的顺序逻辑似乎由多个时钟控制。” I don't want to clk to be understood as a clock, since it will be just a switch. 我不想将其理解为时钟,因为它只是一个开关。 How can I do that? 我怎样才能做到这一点?

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;
count_aux: in std_logic;
reset: in std_logic;
Q: out std_logic:='0'
); 
end D_FF;    

architecture a1 of D_FF is
signal i: std_logic_vector(3 downto 0):="0000";
begin
proc: process (D,clk,reset)


begin  

    if (reset='1') then 
        if(count_aux'event and count_aux='1') then i<=i+1;
            if (i="0001") then 
        q<='0';
        i<="0000";
            end if;
        end if;
    elsif (clk'event and clk='1') then 
        q<=d;   
    end if;  
    end process proc;
end a1;

You are using clk as a clock in the process, so it will be a clock ;) But the weird thing for the synthesis is that you want to have a clocked flipflop (sequential element or regeister or what ever) but yet you also include combinatorial logic into the reset. 您在此过程中将clk用作时钟,所以它将是一个时钟;)但是,合成过程中很奇怪的一点是,您想要一个带时钟的触发器(顺序元素或regeister或任何其他东西),但同时还包括组合逻辑进入复位状态。 So it has no idea what to synthesize since it has no component in the library for this logic. 因此它不知道要合成什么,因为它在该逻辑库中没有组件。

So my advise is to keep the sequential and combinatorial logic separate. 因此,我的建议是将顺序逻辑和组合逻辑分开。 Sequential logic will have only clk and reset in the sensitivity list and have the code structure of: 顺序逻辑在灵敏度列表中将仅具有clkreset ,并且具有以下代码结构:

process(clk, reset)
begin
  if reset = 1 then
    foobar <= '0';
  elsif rising_edge(clk) then
    foobar <= foo + bar;
  end if;
end process;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM