如何将自己写的verilog模块封装成IP核(一)

平台与材料

  • 一个写好的工程,综合通过,不用布局布线,ISE或Vivado皆可。如果是ISE,需要在properties里取消选中 iobuf 。这样就只能被当做内部模块调用了。
  • Vivado

步骤

打开Vivado,创建一个工程
Tools -> Create or package IP
里面有三个选项,分别是打包本工程,打包本工程的一个Design,打包一个目录下的工程。
一般会选第三个
在该目录下,应该有一个Vivado或者ISE工程,综合通过了的。
选择完打包的目录后,选择Automatically select top module。
一般都能选择到正确的top module,如果选错了,先查看文件是否全部导入,如果全部导入了还选错顶层模块,那就右键手动set as top。
这个时候在右上侧的代码视窗里应该出现了配置IP核的选项,有好几种,慢慢选,完了在最后一栏检查有没错漏,然后点package IP。
然后IP就生成好了,在Block Design的原理图视窗右键add IP,就能找到你刚刚打包的IP了。


官方解释:

Description

There is a black-box submodule in the design which is fed with an EDIF/NGC netlist. The following errors and warnings are issued during Translate:

"ERROR:NgdBuild:770 - IBUF 'b_IBUF' and IBUF 'b_ibuf' on net 'b_IBUF' are linedup in series. Buffers of the same direction cannot be placed in series.
WARNING:NgdBuild:463 - input pad net 'b_IBUF' has an illegal input buffer
ERROR:NgdBuild:925 - input net 'b_IBUF' is connected to the incorrect side ofbuffer(s):
pin O on block b_IBUF with type IBUF
ERROR:NgdBuild:924 - input pad net 'clk_BUFGP' is driving non-buffer primitives:
pin C on block h with type FDR, pin C on block g with type FD, pin O on block clk_BUFGP/BUFG with type BUFG
ERROR:NgdBuild:809 - output pad net 'e' has an illegal load:
pin I1 on block Mxor_g_xor0000_Result1 with type LUT2
ERROR:NgdBuild:455 - logical net 'h' has multiple driver(s):
pin Q on block h with type FDR, pin PAD on block h.PAD with type PAD"

How can I resolve these errors?

Solution

These errors are issued because the submodule EDIF/NGC netlist contains IBUFs/OBUFs. XST also adds IBUFs and OBUFs to the top level, so that they are lined up or the pads are driving/being driven by non-buffer components.

When an EDIF/NGC netlist is used as a submodule of another design, the following conditions must be met:

  • If the input/output ports of the submodule are connected to the top module ports directly, like port1in the following figure, the IBUFs/OBUFs can be put in the submodule,but theXST property "Read Cores"has tobe checked. Then,XSTwill read the netlistin the project directory or a location specified in "Cores Search Directories" and will not add extra IBUFs/OBUFs on these top level ports.
  • If theinput/output ports of the submodule are NOT connected to the top module ports directly, like port2 inthe following figure, the IBUFs/OBUFs must not be put in the submodule.

The following are some solutions to this problem.

  1. Disable IBUF/OBUF insertion when you generate the submodule netlist. Add all IBUFs/OBUFsto the top level.
    • For XST, go to Synthesis Properties -> Xilinx Specific Options -> uncheck "Add I/O Buffers"
    • For Synplify Pro, go to Implementation Options -> Device tab -> check "Disable I/O Insertion"
  2. Selectively disableIBUF/OBUF insertion onthe input/output ports that are NOT connected to the top module ports directly.
    • For XST, use "buffer_type" constraint. Please refer to XST User Guide.
    • For Synplify Pro, refer to (Xilinx Answer 4508).
  3. If theIBUF/OBUFs are instantiated in the submodule, disablingIBUF/OBUF insertiondoes not remove the buffers from the submodule. If this is the case, remove theIBUF/OBUFs instantaiation from the submodule and instantiate them in the top level.

Verilog是一种硬件描述语言,用于设计集电路(IC)和可编程逻辑器件(FPGA)中的数字电路。要编一个IP(知识产权)即可重复使用的模块,需要遵循一定的规范和步骤。 首先,IP设计的第一步是确定模块的功能和接口。我们可以定义输入和输出端口以及内部信号。接着,我们需要模块的主体代码,即定义模块的行为。例如,如果我们要设计一个4位加法器,我们可以定义4个输入端口(A,B)和1个输出端口(Sum)。 下一步是编模块的功能代码。这可能涉及到使用寄存器、组合逻辑和其他模块来实现所需的功能。对于4位加法器的例子,我们可以使用4个寄存器和一些组合逻辑来实现加法操作,并输出结果到Sum端口。 然后,我们需要进行功能验证,即测试IP的正确性。我们可以编一个测试台来提供各种输入情况,并验证输出是否与预期结果一致。这可以通过使用Verilog自带的仿真工具来实现。 最后,我们可以将IP打包可重复使用的模块,以方便在其他项目中重新使用。这可以通过将模块封装IP核或使用FPGA制造商提供的IP生工具来实现。 总的来说,编一个Verilog IP需要明确定义模块的功能和接口,编模块的功能代码,进行功能验证,并将其打包可重复使用的模块。这样可以提高开发效率,并方便在不同项目中重复使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值