[an error occurred while processing this directive]
|
БОЛЬШОЕ СПАСИБО ВСЕМ КТО ОТКЛИКНУЛСЯ!!! ВСЕ ВАРИАНТЫ ОБЯЗАТЕЛЬНО ПОПРОБУЮ!!!!
Но очень интересно где у меня ошибка,вот практически полностью рабочий таймер, глюк возникает только при prog="0000000000000001". На выходе импульс выскакивает не через один такт, а через два.Подскажите,где ошибка?
---------------------Листинг-----------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity del_clk is
Port ( set : in STD_LOGIC;
out_clk : out STD_LOGIC;
clk : in STD_LOGIC;
prog : in STD_LOGIC_VECTOR (15 downto 0));
end del_clk;
architecture Behavioral of del_clk is
signal st : STD_LOGIC_VECTOR (15 downto 0):="0000000000000000";
signal outsig : STD_LOGIC:='0';
signal setup : STD_LOGIC:='0';
begin
process(set,outsig)
variable crt : integer:=0;
begin
if set='1' then
crt := crt + 1;
end if;
if outsig = '1' then
crt := crt - 1;
end if;
if crt=0 then
setup<='0';
else
setup<='1';
end if;
end process;
process(clk)
begin
if setup='1' then
if clk='1' then
if (prog="0000000000000001" and st/="0000000000000001") then
st<=st+1;
elsif (prog="0000000000000001" and st=prog) then
st<= conv_std_logic_vector(0,16);
elsif (st=prog-1 and prog/="0000000000000001") then
st<= conv_std_logic_vector(0,16);
else st<=st+1;
end if;
end if;
end if;
if (prog="0000000000000001" and st=prog and clk='1') then
out_clk <= '1';
outsig <= '1';
elsif (st=prog-1 and clk='1' and prog/="0000000000000001") then
out_clk <= '1';
outsig <= '1';
else
out_clk <= '0';
outsig <= '0';
end if;
end process;
end Behavioral;