[an error occurred while processing this directive]
|
Вот надеюсь последний вопрос в этой теме.Что нужно изменить в приведённом ниже текстовичке(не обращая внимания на его корявость, пожирание им ресурсов,и странность исполнения и т.д.) чтобы при prog="0000000000000001" на выходе out_clk появлялся сигнал через один такт после прихода на вход set.В данном примере out_clk появляется в одном такте c set. Сигналы равны одному тактовому импульсу.При других prog всё работает идеально.
----------------------Листинг----------------------------------------
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 st=prog-1 then
st<= conv_std_logic_vector(0,16);
else st<=st+1;
end if;
end if;
end if;
if (st=prog-1 and clk='1') then
out_clk <= '1';
outsig <= '1';
else
out_clk <= '0';
outsig <= '0';
end if;
end process;
end Behavioral;