MAX PLUS 2编程中library编译时出现错误怎么办?
程序是这样的libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitysta...
程序是这样的
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity start_5_20 is
port(clk1,rst,start5,start20:in std_logic;
b,a:out std_logic_vector(3 downto 0); --输出定时初值
s_flag:out std_logic); --置数信号
end entity;
architecture one of start_5_20 is
signal datain:std_logic_vector(1 downto 0);
type st_type is (st0,st1,st2); --定义状态
signal c_st:st_type;
begin
datain<=start5&start20; --两个输入信号放在一起判断
process(rst,clk1)
begin
if rst='0' then --复位
b<="0000";a<="0000";c_st<=st0;s_flag<='0';
elsif clk1 event and clk1='1' then
case c_st is
when st0=> if datain="01" then
c_st<=st1; --输入信号为01,转st1状态
s_flag<='1'; --置数信号有效
b<="0000";a<="0101"; --定时初值"05"
elsif datain="10" then c_st<=st2; --输入信号为10,转st1状态
s_flag<='1'; --置数信号有效
b<="0011";a<="0000"; --定时初值"30"
else c_st<=st0; --输入信号为11,保持st0状态
end if;
when st1=>if datain="11" then
c_st<=st0;--防按键抖动,为11时才转st0状态
s_flag<='0'; --置数信号无效
else c_st<=st1; --按键没弹起,继续等待
end if;
when st2=>if datain="11" then c_st<=st0;s_flag<='0';
else c_st<=st2;
end if;
when others=>c_st<=st0;b<="0000";a<="0000";
end case;
end if;
end process;
end architecture;
编译时出现了一个错误 展开
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity start_5_20 is
port(clk1,rst,start5,start20:in std_logic;
b,a:out std_logic_vector(3 downto 0); --输出定时初值
s_flag:out std_logic); --置数信号
end entity;
architecture one of start_5_20 is
signal datain:std_logic_vector(1 downto 0);
type st_type is (st0,st1,st2); --定义状态
signal c_st:st_type;
begin
datain<=start5&start20; --两个输入信号放在一起判断
process(rst,clk1)
begin
if rst='0' then --复位
b<="0000";a<="0000";c_st<=st0;s_flag<='0';
elsif clk1 event and clk1='1' then
case c_st is
when st0=> if datain="01" then
c_st<=st1; --输入信号为01,转st1状态
s_flag<='1'; --置数信号有效
b<="0000";a<="0101"; --定时初值"05"
elsif datain="10" then c_st<=st2; --输入信号为10,转st1状态
s_flag<='1'; --置数信号有效
b<="0011";a<="0000"; --定时初值"30"
else c_st<=st0; --输入信号为11,保持st0状态
end if;
when st1=>if datain="11" then
c_st<=st0;--防按键抖动,为11时才转st0状态
s_flag<='0'; --置数信号无效
else c_st<=st1; --按键没弹起,继续等待
end if;
when st2=>if datain="11" then c_st<=st0;s_flag<='0';
else c_st<=st2;
end if;
when others=>c_st<=st0;b<="0000";a<="0000";
end case;
end if;
end process;
end architecture;
编译时出现了一个错误 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询