FPGA|CPLD|ASIC论坛
直播中

李湍

12年用户 3经验值
擅长:可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 处理器/DSP 数字及可编程逻辑 数字及可编程逻辑 控制/MCU 数字及可编程逻辑 EDA/IC设计 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑 数字及可编程逻辑
私信 关注
[问答]

状态机下载到片子,状态不转移。

我用VHDL编写的程序,Modelsim跑前后仿真都没有问题。下载到片子上怎么都没结果。后来考虑可能是没有进状态机,试着用LED发现没有状态转移。后来编写了一个最基本的状态机程序,发现也是同样问题。

程序如下:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity ProgramTest is
    Port ( Clk, Reset : in  STD_LOGIC;
           LED1,LED2 : out  STD_LOGIC);
end ProgramTest;

architecture Behavioral of ProgramTest is

type tateType is (stIdle, stLed, stComplete);
signal StateType: PresState;
signal StateType: NextState;

signal oLed1, oLed2: std_logic;

begin

process (Clk, Reset)
begin
        if rising_edge(Clk) then
                if Reset = '1' then
                        PresState <= Idle;
                else
                        PresState <= NextState;
                end if;
        end if;
end process;

process (PresState)
begin
        case PresState is
                when stIdle =>
                        oLed1<= '1';
                        NestState <= stLed;
               
                when stLed =>
                        oLed2 <= '1';
                        NextState <= stComplete;
                        
                when stComplete =>
                        NextState <= Idle;
                        
                        
        end case;
               
end process;

end Behavioral;

LED上拉到3.3V,因此高电平的时候LED灯不亮。下载到片子后,LED1灯不亮,LED2灯亮,说明状态机没进入第二个状态。请大侠指教一下!!

回帖(1)

钟哥

2017-11-20 08:39:33
本帖最后由 钟哥30 于 2017-11-20 08:41 编辑

FPGA复位好像是低有效吧,if Reset = '1' then改成if Reset = '0' then
举报

更多回帖

发帖
×
20
完善资料,
赚取积分