本帖最后由 甜甜苦咖啡 于 2017-9-29 10:07 编辑
我用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灯亮,说明状态机没进入第二个状态。请大侠指教一下!! |