在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 17705|回复: 4

[求助] 关于Warning: Output pins are stuck at VCC or GND

[复制链接]
发表于 2010-6-1 00:34:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本人初学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"
如何解决呀,头痛。
发表于 2010-6-1 12:57:19 | 显示全部楼层
第三个process里面,最好不要这么去判断clk,这不是一个可以综合的代码风格。
发表于 2010-6-1 15:02:06 | 显示全部楼层
我也遇到这个问题
发表于 2010-6-7 22:42:04 | 显示全部楼层
这个问题是说你的这个信号始终接到了GND或是VCC。并没有按照你的想法变化。
发表于 2010-6-8 11:13:52 | 显示全部楼层
在第二个进程里面,variable count 的值是一直为0的,所以状态并没有产生跳转
另外要注意的是,变量只在所定义的进程内有效,不能跨进程传递;如果想在进程与进程之间进行进行传递,需要用信号,而不能用变量的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

X

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-6-28 02:01 , Processed in 0.022656 second(s), 12 queries , Gzip On, MemCached On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表