library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following lines to use the declarations that are -- provided for instantiating Xilinx primitive components. --library UNISIM; --use UNISIM.VComponents.all;
entity ckc is generic(N : integer :=15 ); Port ( CK, Q : in std_logic; D : out std_logic; CP, OP : inout std_logic; V : out std_logic_vector(N-1 downto 0)); end ckc;
architecture Behavioral of ckc is
signal COUNT_TMP : std_logic_vector(N-1 downto 0):=(others => '0');
begin
D <= CK and Q;
process( CK, Q, CP ) begin if(CP'event and CP = '1') then COUNT_TMP <= (others => '0'); elsif (Q = '1') then if (CK'event and CK = '1') then COUNT_TMP <= COUNT_TMP + 1; if (COUNT_TMP = "100") then CP <= '0'; OP <= '1'; else null; end if; end if; end if;
if (Q'event and Q = '0') then CP <= '1'; else CP <= '0'; end if; end process;