目录
3.编写顶层文件或者激励文件:(一定一定点击下面这个例化模板 去对ip核进行例化)
1.新建工程之后 建一个ip核文件:
2.配置ip核:
根据自己的器件型号,选择单时钟:
可以取消rst 会有一个弹窗 点击ok即可
然后勾选上fx的输出,就可以调整输出频率,然后选择时钟输入 点击next
然后填写输出时钟,并点击计算 最后finish完成
3.编写顶层文件或者激励文件:(一定一定点击下面这个例化模板 去对ip核进行例化)
点开是一个.vho的文件,里面就有你建的ip核的元件声明和例化(ip核的名字跟顶层文件或者其他的测试或者其他模块名字不要重!!!我找了一周的错)
这里我选择再新建1个ip核,对时钟进行多个分频输出:
然后编写顶层文件:
顶层代码如下:(VHDL)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity clk_top is
PORT(
clk_in : IN std_logic;
clk_40m : OUT std_logic;
clk_50m : OUT std_logic
);
end clk_top;
architecture Behavioral of clk_top is
signal CLKIN_IBUFG_OUT1 : std_logic;
signal CLK0_OUT1 : std_logic;
signal LOCKED_OUT1 : std_logic;
signal CLKIN_IBUFG_OUT2 : std_logic;
signal CLK0_OUT2 : std_logic;
COMPONENT clk
PORT(
CLKIN_IN : IN std_logic;
CLKFX_OUT : OUT std_logic;
CLKIN_IBUFG_OUT : OUT std_logic;
CLK0_OUT : OUT std_logic;
LOCKED_OUT : OUT std_logic
);
END COMPONENT;
COMPONENT clk1
PORT(
CLKIN_IN : IN std_logic;
CLKFX_OUT : OUT std_logic;
CLKIN_IBUFG_OUT : OUT std_logic;
CLK0_OUT : OUT std_logic
);
END COMPONENT;
begin
u0: clk PORT MAP(
CLKIN_IN => clk_in,
CLKFX_OUT => clk_40m,
CLKIN_IBUFG_OUT => CLKIN_IBUFG_OUT1,
CLK0_OUT => CLK0_OUT1,
LOCKED_OUT => LOCKED_OUT1
);
u1: clk1 PORT MAP(
CLKIN_IN => clk_in,
CLKFX_OUT => clk_50m,
CLKIN_IBUFG_OUT => CLKIN_IBUFG_OUT2,
CLK0_OUT => CLK0_OUT2
);
end Behavioral;
4.查看rtl图:
5.编写测试文件:
tb文件如下:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY clk_top_tb IS
END clk_top_tb;
ARCHITECTURE behavior OF clk_top_tb IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT clk_top
PORT(
clk_in : IN std_logic;
clk_40m : OUT std_logic;
clk_50m : OUT std_logic
);
END COMPONENT;
--Inputs
signal clk_in : std_logic := '0';
--Outputs
signal clk_40m : std_logic;
signal clk_50m : std_logic;
-- Clock period definitions
constant clk_in_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: clk_top PORT MAP (
clk_in => clk_in,
clk_40m => clk_40m,
clk_50m => clk_50m
);
-- Clock process definitions
clk_in_process :process
begin
clk_in <= '0';
wait for clk_in_period/2;
clk_in <= '1';
wait for clk_in_period/2;
end process;
END;
仿真图如下:
工程文件:https://download.csdn.net/download/qq_43811597/86438305