zwdtc 发表于 2011-11-25 04:51:37

新手一个很基本的问题一直没弄懂,希望各位解释一下啊

begin
        P1:process(up_ner,Pressed,Rst)
                begin
                        if Rst='0' then
                                temp:=0;
                        elsif falling_edge(Pressed) then
                                if up_ner='0' then
                                        temp:=temp+1;
                                        if temp=16 then
                                                temp:=0;
                                        end if;
                                else
                                        temp:=temp-1;
                                        if temp=0 then
                                                temp:=15;
                                        end if;
                                end if;
                        end if;
                end process;
        Count<=conv_std_logic_vector(temp,4);
end;
为什么最后的Count信号在仿真时就一直是0啊,temp信号能变的,Count一直不变??????

the_wind_blows 发表于 2011-11-25 08:21:56

temp:=temp-1; 说明temp是一个变量,但没有看见你定义。
变量不能用在进程外。
将temp定义成 SIGNAL 才对

zwdtc 发表于 2011-11-27 05:54:44

回复【1楼】the wind blows
-----------------------------------------------------------------------

恩,我现在知道了的,谢谢啦!
页: [1]
查看完整版本: 新手一个很基本的问题一直没弄懂,希望各位解释一下啊