我现在想在输入方波的上升沿,产生一定脉宽的负脉冲
程序师这样编写的
结果试验的时候,结果不对
困扰好长时间了
希望得到大家的帮助
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;
entity d2 is
port( clk : in std_logic;
rst : in std_logic;
en : in std_logic;
qout: out std_logic);
end d2;
architecture behav of d2 is
signal cnt : std_logic_vector(8 downto 0);
signal cnt_EN : std_logic;
signal m: std_logic;
begin
process(rst,clk,en)
begin
if(rst='0')then
cnt_EN<='1';
cnt<="000000000";
elsif(clk'event and clk='1')then
m<=en;
if(m/=en and en='1') then
-- if(en='1')then
cnt_EN<='0';
cnt<="000000000";
elsif(cnt_EN='0' and cnt<400)then
cnt_EN<='0';
cnt<=cnt+1;
else
cnt_EN<='1';
-- end if;
end if;
end if;
end process;
qout<=cnt_EN;
end behav;
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |