我对此单元有一些问题,我不知道为什么它不起作用。平台ISE Project Navigator给我一个错误:unit automat:the following signal(s) form a combinatorial loop
。我想收到一些建议,如果您可以告诉我如何解决此问题。
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;
entity automat is
port(CLK,EN,SEN,MONED:in STD_LOGIC;
COMP:STD_LOGIC_VECTOR(2 DOWNTO 0);
REN,MEN,ENR,IM_REST,REST,BILET,CLK_EN,RESET: out STD_LOGIC;
S1,S2,com:out STD_LOGIC_VECTOR(1 downto 0)
);
end automat;
architecture arh_automat of automat is
type STARE is(A,B,C,D,E,F,G,H,I,J);
signal ST,NXST:STARE;
begin
tranzitie:process(CLK,ST,EN,SEN,MONED,COMP)
begin
REN<='0';MEN<='0';clk_en<='0';RESET<='0';
ENR<='0';IM_REST<='0';REST<='0';BILET<='0';
S1<="00";S2<="00";com<="00";
case ST is
when A=>NXST<=B;
com<="00";
if(CLK'EVENT and CLK='1') then
if EN='1' then
ST<=B;
else
ST<=A;
end if;
END IF;
when B=>NXST<=C ;
RESET<='1';
com<="01";
if(CLK'EVENT and CLK='1') then
if EN='1' then
ST<=C;
else
ST<=B;
end if;
end if;
when C=>NXST<=D;
REN<='1';
CLK_EN<='1';
com<="10";
if(CLK'EVENT and CLK='1') then
if SEN ='1' then
ST<=D;
else
ST<=C;
end if;
end if;
when D=>NXST<=E ;
s1<="01";
s2<="10";
com<="10";
if(CLK'EVENT and CLK='1') then
if MONED='1' then
ST<=E;
else
ST<=F;
end if;
end if;
when E=>NXST<=F;
com<="00";
if(CLK'EVENT and CLK='1') then
ST<=F;
end if;
when F=>NXST<=G ;
MEN<='1';
com<="00";
if(CLK'EVENT and CLK='1') then
if COMP="010" or COMP="100" then
ST<=G;
else
ST<=C;
end if;
end if;
when G=>NXST<=H;
ENR<='1';
S1<="00";
S2<="11";
com<="00";
if(CLK'EVENT and CLK='1') then
if COMP="100" OR COMP="001" OR COMP="010" then
ST<=H;
else
ST<=I;
end if;
END IF;
when H=>NXST<=J;
REST<='1';
BILET<='1';
com<="00";
if(CLK'EVENT and CLK='1') then
ST<=J;
end if;
when I=>NXST<=J;
IM_REST<='1';
BILET<='1';
com<="00";
if(CLK'EVENT and CLK='1') then
ST<=J;
end if;
when J=>NXST<=A;
com<="00";
if(CLK'EVENT and CLK='1') then
ST<=A;
end if;
end case;
end process tranzitie;
end arh_automat;
您不说哪些信号形成循环,而是您的过程&amp;案例构造的书写不好。
尝试将组合和同步信号分为单独的过程。您的时钟也弄乱了。在同步过程中,仅使用一个" clk'event and clk ='1'"语句与案例语句。
组合循环是当您将某些组合逻辑的输出反馈到自身中时。我能想到的最基本的例子是:
My_PROC : process(A)
begin
A <= not A;
end process;
显然不可能综合它。很难弄清楚代码中发生了什么,但是您需要查找某些组合逻辑的输出回馈自身的情况。就像@LSF_Design所说的那样,您应该将组合和时钟同步逻辑分开。我建议使用此处描述的格式。
我会尝试给您的信号更多描述性名称。而不是使用a,b,c等。对于您的状态名称,它将它们命名为实际描述了这种情况的东西。