求大侠帮我看看这个VHDL程序 ,输入一个瞬时脉冲信号COMPout,高电平时想产生bell=f512,持续60秒。
libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;useieee.std_log...
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity SYYS is
port(mh,sh,ml,sl:in std_logic_vector(3 downto 0);
compout,F1024,f512:in std_logic;
bell:out std_logic);
end SYYS;
architecture rt of SYYS is
signal JSQ:integer range 0 to 30720;
signal b1,b2:std_logic;
begin
A:process(compout,F512) -----产生60秒持续时间 不能达到效果,帮看看哦
begin
if(F512'EVENT AND F512='1') THEN
if compout='1' THEN JSQ<=30720;
elsif JSQ=0 THEN JSQ<=0;
ELSE JSQ<=JSQ-1;end if;
if JSQ/=0 THEN B1<=F512;
ELSe B1<='0';
End if;
end if;
end process;
B:process(mh,sh,ml,sl) -----------------整点报时程序 没有错误
begin
if(mh="0101" and ml="1001" and sh="0101")then
case sl is
when "0001"=>b2<=f512;
when "0011"=>b2<=f512;
when "0101"=>b2<=f512;
when "0111"=>b2<=f512;
when "1001"=>b2<=F1024;
when others=>b2<='0';
end case;
ELSE B2<='0';
END IF;
END PROCESS;
bell<=b1 OR B2;
end rt; 展开
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity SYYS is
port(mh,sh,ml,sl:in std_logic_vector(3 downto 0);
compout,F1024,f512:in std_logic;
bell:out std_logic);
end SYYS;
architecture rt of SYYS is
signal JSQ:integer range 0 to 30720;
signal b1,b2:std_logic;
begin
A:process(compout,F512) -----产生60秒持续时间 不能达到效果,帮看看哦
begin
if(F512'EVENT AND F512='1') THEN
if compout='1' THEN JSQ<=30720;
elsif JSQ=0 THEN JSQ<=0;
ELSE JSQ<=JSQ-1;end if;
if JSQ/=0 THEN B1<=F512;
ELSe B1<='0';
End if;
end if;
end process;
B:process(mh,sh,ml,sl) -----------------整点报时程序 没有错误
begin
if(mh="0101" and ml="1001" and sh="0101")then
case sl is
when "0001"=>b2<=f512;
when "0011"=>b2<=f512;
when "0101"=>b2<=f512;
when "0111"=>b2<=f512;
when "1001"=>b2<=F1024;
when others=>b2<='0';
end case;
ELSE B2<='0';
END IF;
END PROCESS;
bell<=b1 OR B2;
end rt; 展开
1个回答
展开全部
A:process(compout,F512) -----产生60秒持续时间 不能达到效果,帮看看哦
begin
if(F512'EVENT AND F512='1') THEN
if compout='1' THEN JSQ<=30720;
elsif JSQ=0 THEN JSQ<=0;
ELSE JSQ<=JSQ-1;end if;
if JSQ/=0 THEN B1<=F512;
ELSe B1<='0';
End if;
end if;
end process;
分析这段程序,F512做为时钟信号,后面又将它当成赋值信号,这样写是不允许的。更何况逻辑上也有错,在F512上升沿时来对B1赋值,此时F512的值应该是上升沿的前的值,也就是低电平,所以B1一直为低。。
可以改成:
A:process(compout,F512)
begin
if(F512'EVENT AND F512='1') THEN
if compout='1' THEN JSQ<=30720;
elsif JSQ=0 THEN JSQ<=0;
ELSE JSQ<=JSQ-1;end if;
end if;
end process;
B1<='0' when JSQ=0 ELSE
F512;
begin
if(F512'EVENT AND F512='1') THEN
if compout='1' THEN JSQ<=30720;
elsif JSQ=0 THEN JSQ<=0;
ELSE JSQ<=JSQ-1;end if;
if JSQ/=0 THEN B1<=F512;
ELSe B1<='0';
End if;
end if;
end process;
分析这段程序,F512做为时钟信号,后面又将它当成赋值信号,这样写是不允许的。更何况逻辑上也有错,在F512上升沿时来对B1赋值,此时F512的值应该是上升沿的前的值,也就是低电平,所以B1一直为低。。
可以改成:
A:process(compout,F512)
begin
if(F512'EVENT AND F512='1') THEN
if compout='1' THEN JSQ<=30720;
elsif JSQ=0 THEN JSQ<=0;
ELSE JSQ<=JSQ-1;end if;
end if;
end process;
B1<='0' when JSQ=0 ELSE
F512;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询