library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity clk26M is
port( clk : in std_logic;
rst_n : in std_logic;
outclk : buffer std_logic);
end clk26M;
architecture p1 of clk26M is
signal count : std_logic_vector(2 downto 0);
signal div2 : std_logic;
signal div3 : std_logic;
signal dlydiv3 : std_logic;
begin
-- Divided 2
process(clk, rst_n)
begin
if (rst_n = '0') then
div2 <= '0';
elsif(clk'event and clk = '1') then
div2 <= not(div2);
end if;
end process;
-- Divided 3
process(clk, rst_n)
begin
if (rst_n = '0') then
div3 <= '0';
count <= (others => '0');
elsif(clk'event and clk = '1') then
if(count < 2) then
count <= count + '1';
else
div3 <= not(div3);
count <= (others => '0');
end if;
end if;
end process;
-- 1.5 step Delay
process(clk)
begin
if (rst_n = '0') then
dlydiv3 <= '0';
elsif(clk'event and clk = '0') then
if((div2 xor div3) = '1') then
dlydiv3 <= not(dlydiv3);
end if;
end if;
end process;
outclk <= div3 xor dlydiv3;
end p1;