微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > 关于Warning: Output pins are stuck at VCC or GND

关于Warning: Output pins are stuck at VCC or GND

时间:10-02 整理:3721RD 点击:
本人初学VHDL,写了一个红灯60S,绿灯55S,黄灯5S的十字路字交通灯。代码如下,却出了如下警告,不知如何解决,求解答
代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity traffic3 is
port (rst: in std_logic;
clk: in std_logic;
led: out std_logic_vector (11 downto 0));
end;
architecture bhv of traffic3 is
type states is (st0,st1,st2,st3,st4);
signal current_state,next_state :states :=st0;
begin
process(rst,clk)
variable count : integer range 0 to 65535;
begin
  if rst = '1' then
   count := 0 ;
   current_state <= st0;
   elsif rising_edge(clk) then
    if count =119 then
     count := 0;current_state <= st0;
    else count:=count +1;
     current_state <= next_state;
    end if;
  end if;
end process;

process(current_state)
variable count : integer:=0;
begin
  --if rising_edge(clk) then
   case current_state is
    when st0 =>
     if count >0 and count <56 then        --road1 green,road2 red;
      next_state <= st1;
     end if;
    when st1 =>            
     if count >55 and count <61 then       --road1 yellow,road2 red;
      next_state <= st2;
     end if;
    when st2 =>
     if count >60 and count <116 then       --road1 red,road2 green;
      next_state <= st3;
     end if;
    when st3 =>
     if count >115 and count <121 then       --road1 red,road2 yellow
      next_state <= st4;
     end if;
    when st4 =>
     if count >120 then           --others
     next_state <= st0;
     end if;
    when others => next_state <= st0;
   end case;
end process;

process (current_state,clk)
begin
  case current_state is
   when st0 => led(5 downto 0) <= "000000";      --reset state
      led(11 downto 6) <= "000000";
   when st1 => led(5 downto 0) <= "100010";      --red1,green1,yellow1,red2,green2,yellow2;
      led(11 downto 6)<= "100010";
   when st2 => if clk = '1' then
       led(5 downto 0) <= "100001";      
       led(11 downto 6)<= "100001";
      elsif clk = '0' then
       led(5 downto 0) <="100000";
       led(11 downto 6)<="100000";
      end if;
   when st3 => led(5 downto 0) <= "010100";
      led(11 downto 6) <= "010100";
   when st4 => if clk = '1' then
       led(5 downto 0) <= "001100";
       led(11 downto 6)<= "001100";
      elsif clk = '0' then
       led(5 downto 0) <="010000";
       led(11 downto 6)<="010000";
      end if;
   when others => led(5 downto 0) <= "000000";
       led(11 downto 6) <= "000000";
  end case;
end process;

end bhv;
警告:
Warning (10542): VHDL Variable Declaration warning at traffic3.vhd(30): used initial value expression for variable "count" because variable was never assigned a value
Warning (10631): VHDL Process Statement warning at traffic3.vhd(58): inferring latch(es) for signal or variable "led", which holds its previous value in one or more paths through the process
Warning: Output pins are stuck at VCC or GND
Warning (13410): Pin "led[0]" is stuck at GND
Warning (13410): Pin "led[1]" is stuck at GND
Warning (13410): Pin "led[2]" is stuck at GND
Warning (13410): Pin "led[3]" is stuck at GND
Warning (13410): Pin "led[4]" is stuck at GND
Warning (13410): Pin "led[5]" is stuck at GND
Warning (13410): Pin "led[6]" is stuck at GND
Warning (13410): Pin "led[7]" is stuck at GND
Warning (13410): Pin "led[8]" is stuck at GND
Warning (13410): Pin "led[9]" is stuck at GND
Warning (13410): Pin "led[10]" is stuck at GND
Warning (13410): Pin "led[11]" is stuck at GND
Warning: Design contains 2 input pin(s) that do not drive logic
Warning (15610): No output dependent on input pin "clk"
Warning (15610): No output dependent on input pin "rst"
如何解决呀,头痛。

第三个process里面,最好不要这么去判断clk,这不是一个可以综合的代码风格。

我也遇到这个问题

这个问题是说你的这个信号始终接到了GND或是VCC。并没有按照你的想法变化。

在第二个进程里面,variable count 的值是一直为0的,所以状态并没有产生跳转
另外要注意的是,变量只在所定义的进程内有效,不能跨进程传递;如果想在进程与进程之间进行进行传递,需要用信号,而不能用变量的。

上一篇:推荐两本书
下一篇:SOPC技术发展现状

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top