-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components
--library UNISIM
--use UNISIM.VComponents.all;
entity nhalffenpin is
PORT (
CLK : IN STD_LOGIC;
PREL : IN STD_LOGIC_VECTOR(2 DOWNTO 0):="111";
NCLK : BUFFER STD_LOGIC
) ;
end nhalffenpin;v;p
architecture Behavioral of nhalffenpin is
SIGNAL COUNTER : STD_LOGIC_VECTOR(2 DOWNTO 0):="000"
SIGNAL SIG_CLK : STD_LOGIC ;
SIGNAL LCLK : STD_LOGIC;
SIGNAL PCLK : STD_LOGIC:='1';
begin
LCLK <= CLK XOR PCLK;
PROCESS(LCLK,PREL)
BEGIN
IF RISING_EDGE(LCLK) THEN
IF COUNTER = "000" THEN
COUNTER <= PREL;
ELSE5
COUNTER <= COUNTER - 1;
END IF;
END IF;
END PROCESS;
PROCESS(COUNTER,LCLK)
BEGIN
IF RISING_EDGE(LCLK) THEN
IF COUNTER = "001" THEN
SIG_CLK <= '1';
ELSEX|
SIG_CLK <= '0';
END IF;
END IF;
END PROCESS;
PROCESS(SIG_CLK)
BEGIN
IF RISING_EDGE(SIG_CLK) THEN
PCLK <= NOT PCLK;
END IF;
END PROCESS;
NCLK <= SIG_CLK;
end Behavioral;<mZH
文章评论(0条评论)
登录后参与讨论