VHDL警告XST:1293 FF /锁存器具有0

问题描述:

没有在互联网上回答的恒定值我工作,因为我在VHDL初学者。VHDL警告XST:1293 FF /锁存器具有0

我正在与按钮和LED VHDL密码界面。 我的程序按预期正确模拟。

基本上,我想的LED进入错误密码时,眨眼,但输入正确的密码时,连续发光。你可以看到,这在仿真中起作用。

SIMULATION IMAGE (在模拟第一输入错误口令,然后正确的密码)

虽然合成,以下主要发生报警:

Optimizing unit <safehouse> ... 
WARNING:Xst:1293 - FF/Latch <entry_pass.ncount_6> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_7> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
. 
. 
. 

VHDL代码是:

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity safehouse is 
    Port (keyled : out STD_LOGIC_VECTOR(0 TO 4); 
       keypad : in STD_LOGIC_VECTOR(0 to 7); 
       clk : in STD_LOGIC); 
end safehouse; 

architecture safehouse of safehouse is 

signal temp : std_logic_vector(0 to 7) := "00000000"; 

begin 

entry_pass: process(clk,keypad,temp) 

    type integer_vector is array (0 to 3) of integer; 
    variable i : integer := 0; 
    constant passoriginal : integer_vector := (2,5,2,6); 
    variable passcode : integer_vector := (0,0,0,0); 
    variable dcount : integer := 0; 
    variable ncount : integer := 0; 

begin 
    if (rising_edge(clk)) then 

      keyled(4) <= '1'; 

      if i < 4 then 

       keyled(0) <= '1'; 

       if (temp /= keypad) then 
        case keypad is 
         when "10001000" => 
          passcode(i) := 1; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "10000100" => 
          passcode(i) := 2; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "10000010" => 
          passcode(i) := 3; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "10000001" => 
          passcode(i) := 10; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "01001000" => 
          passcode(i) := 4; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "01000100" => 
          passcode(i) := 5; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "01000010" => 
          passcode(i) := 6; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "01000001" => 
          passcode(i) := 11; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00101000" => 
          passcode(i) := 7; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00100100" => 
          passcode(i) := 8; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00100010" => 
          passcode(i) := 9; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00100001" => 
          passcode(i) := 12; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00011000" => 
          passcode(i) := 14; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00010100" => 
          passcode(i) := 0; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00010010" => 
          passcode(i) := 15; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when "00010001" => 
          passcode(i) := 13; 
          keyled(i+1) <= '1'; 
          i := i + 1; 
         when others => 
          keyled(4) <= '1'; 
        end case; 
        temp <= keypad; 
       end if; 

      else 

       if passcode = passoriginal then 

        dcount := dcount + 1; 
        if dcount >= 50000000 then 

         keyled <= ('1','1','1','1','1'); 

         dcount := 1; 
         ncount := ncount + 1; 

         if ncount >= 8 then 

          i := 0; 
          passcode := (0,0,0,0); 
          keyled <= ('0','0','0','0','1'); 

          ncount := 1; 
         end if;  
        end if; 

       else 

        dcount := dcount + 1; 
        if dcount >= 50000000 then 
         if (ncount rem 2) = 0 then 

          keyled <= ('1','1','1','1','1'); 

         else 

          keyled <= ('0','0','0','0','1'); 

         end if; 
         dcount := 1; 
         ncount := ncount + 1; 

         if ncount >= 8 then 

          i := 0; 
          keyled <= ('1','0','0','0','1'); 

          ncount := 1; 
         end if; 
        end if;                    
       end if;  
      end if;    
    end if; 
end process; 

end safehouse; 

我知道变量ncount正在修剪但我需要它。 可变NCOUNT用于创建的使用可变DCOUNT其用来创建的0.5秒的延迟4秒的延迟。 无变量ncount我无法创建延迟4秒。

完整的警告是:

WARNING:Xst:1710 - FF/Latch <keyled_4> (without init value) has a constant value of 1 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 

Optimizing unit <safehouse> ... 
WARNING:Xst:1293 - FF/Latch <entry_pass.ncount_6> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_7> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_8> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_11> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_9> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_10> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_14> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_12> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_13> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_17> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_15> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_16> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_20> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_18> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_19> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_23> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_21> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_22> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_26> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_24> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_25> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_29> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_27> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_28> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_30> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_31> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.dcount_26> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.dcount_29> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.dcount_27> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.dcount_28> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.dcount_30> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.dcount_31> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_3> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_4> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_5> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_6> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_7> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_8> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_9> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_10> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_11> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_12> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_13> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_14> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_15> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_16> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_17> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_18> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_19> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_20> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_21> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_22> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_23> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_24> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_25> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_26> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_27> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_28> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_29> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_30> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.i_31> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_4> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_3> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 
WARNING:Xst:1896 - Due to other FF/Latch trimming, FF/Latch <entry_pass.ncount_5> has a constant value of 0 in block <safehouse>. This FF/Latch will be trimmed during the optimization process. 

我使用的FPGA开发板是:赛灵思Spartan 6 XC6SLX9 TQG144。 请帮帮我。

+0

的这些第一金属块是从声明的东西作为一个整数,而不是一个限制整数。 entry_pass.ncount只有1到8的范围。你明显不需要你表达的代码中的其余部分。想想二进制/数字逻辑以及数字的意思。一个无约束的整数在综合中被详细描述为32位二进制并表示一个二进制补码值。如果你只使用它的四个位,你会看到其余的修剪。 – user1155120

+1

[VHDL综合 - FF/Latch常量值]的可能重复(https://*.com/questions/16087307/vhdl-synthesis-ff-latch-constant-value) – user1155120

+0

Thankyou,@ user1155120您的评论,代码在我发布的答案解决了我的问题。但是,您可能希望通过代码背后的原因来启发我们。 –

我自己解决了这个问题。谢谢大家。

与信号替换变量和添加约束(其范围的值)

添加约束变量可以解决这个问题。

我的程序能够在不改变的变量(如我,DCOUNT,NCOUNT)的信号,让我觉得这个问题是范围如果声明后的任何警告合成的事实​​。由于对变量的赋值操作在嵌套的if语句内部,因此合成器未找到所需范围内的变量值的变化并假定它具有恒定值。信号的范围比变量好得多。

然而,正如我初学者我上述的原因可能是错误的。但这里是解决我的问题的代码。

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity safehouse is 
    Port (keyled : out STD_LOGIC_VECTOR(0 TO 4); 
       keypad : in STD_LOGIC_VECTOR(0 to 7); 
       clk : in STD_LOGIC); 
end safehouse; 

architecture safehouse of safehouse is 

signal temp : std_logic_vector(0 to 7) := "00000000"; 
signal dcount : integer range 0 to 100000000 := 0; 
signal ncount : integer range 0 to 10 := 0; 
signal i : integer range 0 to 5; 

begin 

entry_pass: process(clk,keypad,temp,dcount,ncount,i) 

    type integer_vector is array (0 to 3) of integer; 
    constant passoriginal : integer_vector := (2,5,2,6); 
    variable passcode : integer_vector := (0,0,0,0); 

begin 
    if (rising_edge(clk)) then 

      keyled(4) <= '1'; 

      if i < 4 then 

       keyled(0) <= '1'; 

       if (temp /= keypad) then 
        case keypad is 
         when "10001000" => 
          passcode(i) := 1; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "10000100" => 
          passcode(i) := 2; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "10000010" => 
          passcode(i) := 3; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "10000001" => 
          passcode(i) := 10; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "01001000" => 
          passcode(i) := 4; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "01000100" => 
          passcode(i) := 5; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "01000010" => 
          passcode(i) := 6; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "01000001" => 
          passcode(i) := 11; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00101000" => 
          passcode(i) := 7; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00100100" => 
          passcode(i) := 8; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00100010" => 
          passcode(i) := 9; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00100001" => 
          passcode(i) := 12; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00011000" => 
          passcode(i) := 14; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00010100" => 
          passcode(i) := 0; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00010010" => 
          passcode(i) := 15; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when "00010001" => 
          passcode(i) := 13; 
          keyled(i+1) <= '1'; 
          i <= i + 1; 
         when others => 
          keyled(4) <= '1'; 
        end case; 
        temp <= keypad; 
       end if; 

      else 

       if passcode = passoriginal then 

        dcount <= dcount + 1; 
        if dcount >= 50000000 then 

         keyled <= ('1','1','1','1','1'); 

         dcount <= 1; 
         ncount <= ncount + 1; 

         if ncount >= 8 then 

          i <= 0; 
          passcode := (0,0,0,0); 
          keyled <= ('0','0','0','0','1'); 

          ncount <= 1; 
         end if;  
        end if; 

       else 

        dcount <= dcount + 1; 
        if dcount >= 50000000 then 
         if (ncount rem 2) = 0 then 

          keyled <= ('1','1','1','1','1'); 

         else 

          keyled <= ('0','0','0','0','1'); 

         end if; 
         dcount <= 1; 
         ncount <= ncount + 1; 

         if ncount >= 8 then 

          i <= 0; 
          keyled <= ('1','0','0','0','1'); 

          ncount <= 1; 
         end if; 
        end if;                    
       end if;  
      end if;    
    end if; 
end process; 

end safehouse; 

这是我的这个网站上的第一个问题。我会鼓励每一个回应。我有一个很好的经验。谢谢。

+0

你为什么警告消失的推理似乎不正确。这不是因为它们是信号,而是因为它们受到限制,你可以对原始变量进行处理。 – user1155120

+0

我认为你是对的。 –