CLIP入门指南-第一部分:创建VHDL代码
- 更新时间2025-05-20
- 阅读时长4分钟
如要添加组件级IP (CLIP)至FPGA终端,必须以VHDL代码的形式提供IP,以将其编译至FPGA终端。
入门指南使用带触发器的16位加法器。
下列VHDL代码获取2个I16数值的值,并以I16数值格式返回上述数值的和值。VHDL代码还需要来自FPGA模块的时钟和复位信号。如要使用此范例代码,可复制代码至文本文件,将文件另存为DemoClipAdder.vhd。
Library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity DemoClipAdder is port ( clk : in std_logic; aReset : in std_logic; cPortA : in std_logic_vector(15 downto 0); cPortB : in std_logic_vector(15 downto 0); cAddOut : out std_logic_vector(15 downto 0) := (others => '0') ); end DemoClipAdder; architecture rtl of DemoClipAdder is attribute keep_hierarchy : string; attribute keep_hierarchy of rtl : architecture is "yes"; begin process(aReset, clk) begin if(aReset = '1') then cAddOut <= (others => '0'); elsif rising_edge(clk) then cAddOut <= std_logic_vector(signed(cPortA) + signed(cPortB)); end if; end process; end rtl;
为CLIP添加约束
下列UCF代码限制了和值输出的时钟速率不小于100 MHz。如要使用此范例代码,可复制代码至文本文件,将文件另存为(Xilinx ISE) DemoClipAdder.ucf或(Xilinx Vivado) DemoClipAdder.xdc。在配置CLIP向导中添加该约束文件和VHD文件为综合文件,实现约束。
(Xilinx ISE)
NET "%ClipInstancePath%/cAddOut*" TNM_NET = %ClipInstanceName%AddOut;TIMESPEC TS_%ClipInstanceName%ThruAdder = TO "%ClipInstanceName%AddOut" 10 ns;
(Xilinx Vivado)
create_clock -period 10.000 -name %ClipInstanceName%Clk -waveform {0.000 5.000} -add [get_pins %ClipInstancePath%/clk]set_clock_latency -clock [get_clocks {%ClipInstanceName%Clk}] 10.0 [get_pins {%ClipInstancePath%/cAddOut[0]}]
| 上一节:CLIP入门指南:添加组件级IP至FPGA项目 | 下一节:CLIP入门指南-第二部分:定义接口 |