用鞭炮自制简易手榴弹:VHDL程序查错

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 20:39:52
entity dead is
port(clk,px:in std_logic;
xh,xl:out std_logic;
dead_time:in std_logic_vector(7 downto 0);
q:inout std_logic_vector(7 downto 0));
end dead;
architecture dead of dead is
begin
process(clk)
begin
if(clk'event and clk ='1')then
if((px='1')and(q/=dead_time))then
q<=q+1;
elsif((px='0')and(q/="00000000"))then
q<=q-1;
end if;
if((px='1')and(q=dead_time))then
xh<='1';
else
xh<='0';
end if;
if((px='0')and(q="00000000"))then
xl<='1';
else
xl<='0';
end if;
end if;
end process;
end dead;
以上是死区寄存器的VHDL程序,编译有错,能否帮助修改,运行时q<=q+1行和q<=q-1有错,subprogram error;can’t interpret subprogram call
当然各位高手也可以帮忙重新编写
实现规则如下
1;当输入为0,如果 计数值等于0,则计数值保持不变,否则作减1记数
2;当输入为1,如果 计数值等于MAX,则计数值保持不变,否则作加1记数
3;当输入为1,如果 死区计数器等于MAX,AL=0 ,AH=1,上桥臂导通
4;当输入为0,如果 死区计数器等于0,AL=1 ,AH=0,下桥臂导通
5;当死区计数器在0—MAX之间时AL=0 AH=0,上下桥臂都都截止,形成死区

subprogram error;can’t interpret subprogram call 的意识是不能调用子程序。你的程序没有错误,可能是你某个程序包没打开。我在我的电脑中执行了你的程序。没有错误,可以正常编译。建议在程序的开始加上程序包。具体如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;