[an error occurred while processing this directive]
|
попробуйте промоделировать это.Что получится?
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.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;