请问怎么消除锁存器?

2019-03-25 07:24发布

是带7位数码管的模100计数器
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity top is
       port(clk,rst:in std_logic;
                      digit1,digit2:out std_logic_vector(6 downto 0));
end top;

architecture Behavioral of top is
begin
     process(clk,rst)
           variable temp1,temp2:integer range 0 to 10;
          begin
     if(rst='1')then
          temp1:=0;
          temp2:=0;
     elsif(clk'event and clk='1')then
          temp1:=temp1+1;
          if(temp1=10)then
          temp1:=0;
          temp2:=temp2+1;
          if(temp2=10)then
          temp2:=0;
     end if;
          end if;
          end if;

   case temp1 is
        when 0 => digit1 <= "1111110";
        when 1 => digit1 <= "0110000";
        when 2 => digit1 <= "1101101";
        when 3 => digit1 <= "1111001";
        when 4 => digit1 <= "0110011";
        when 5 => digit1 <= "1011011";
        when 6 => digit1 <= "1011111";
        when 7 => digit1 <= "1110000";
        when 8 => digit1 <= "1111111";
        when 9 => digit1 <= "1111011";
        when others => null;
        end case;
       
        case temp2 is
        when 0 => digit2 <= "1111110";
        when 1 => digit2 <= "0110000";
        when 2 => digit2 <= "1101101";
        when 3 => digit2 <= "1111001";
        when 4 => digit2 <= "0110011";
        when 5 => digit2 <= "1011011";
        when 6 => digit2 <= "1011111";
        when 7 => digit2 <= "1110000";
        when 8 => digit2 <= "1111111";
        when 9 => digit2 <= "1111011";
        when others => null;
        end case;
end process;
end Behavioral;
总是有如下的警告
WARNING:HDLCompiler:1369 - "C:Userszmcounter op.vhd" Line 11: Possible infinite loop; process does not have a wait statement
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<6>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<5>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<4>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<3>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<2>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<1>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit1<0>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<6>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<5>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<4>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<3>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<2>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<1>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <digit2<0>>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.


此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
2条回答
gs001588
1楼-- · 2019-03-25 16:44
< /
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;

  3. entity top is
  4.         port(
  5.        clk,rst:in std_logic;
  6.        digit1,digit2:out std_logic_vector(6 downto 0)
  7.     );
  8. end top;

  9. architecture Behavioral of top is
  10. begin

  11. process(clk,rst)
  12. variable temp1,temp2:integer range 0 to 10;
  13. begin
  14.         if(rst='1')then
  15.                 temp1:=0;
  16.                 temp2:=0;
  17.         elsif(clk'event and clk='1')then
  18.                 temp1:=temp1+1;
  19.                 if(temp1=10)then
  20.                         temp1:=0;
  21.                         temp2:=temp2+1;
  22.                         if(temp2=10)then
  23.                                 temp2:=0;
  24.                         end if;
  25.                 end if;
  26.         end if;

  27.         if(clk'event and clk='1')then
  28.                 case temp1 is
  29.                         when 0 => digit1 <= "1111110";
  30.                         when 1 => digit1 <= "0110000";
  31.                         when 2 => digit1 <= "1101101";
  32.                         when 3 => digit1 <= "1111001";
  33.                         when 4 => digit1 <= "0110011";
  34.                         when 5 => digit1 <= "1011011";
  35.                         when 6 => digit1 <= "1011111";
  36.                         when 7 => digit1 <= "1110000";
  37.                         when 8 => digit1 <= "1111111";
  38.                         when 9 => digit1 <= "1111011";
  39.                         when others => null;
  40.                 end case;
  41.         end if;
  42.        
  43.         if(clk'event and clk='1')then
  44.                 case temp2 is
  45.                         when 0 => digit2 <= "1111110";
  46.                         when 1 => digit2 <= "0110000";
  47.                         when 2 => digit2 <= "1101101";
  48.                         when 3 => digit2 <= "1111001";
  49.                         when 4 => digit2 <= "0110011";
  50.                         when 5 => digit2 <= "1011011";
  51.                         when 6 => digit2 <= "1011111";
  52.                         when 7 => digit2 <= "1110000";
  53.                         when 8 => digit2 <= "1111111";
  54.                         when 9 => digit2 <= "1111011";
  55.                         when others => null;
  56.                 end case;
  57.         end if;
  58. end process;

  59. end Behavioral;
复制代码
destiny_zm
2楼-- · 2019-03-25 16:55

一周热门 更多>