我们可以拥有一组自定义模块吗? [英] Can we have an array of custom modules?

查看:30
本文介绍了我们可以拥有一组自定义模块吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以为自定义模块提供一组实例吗?

Can we have an array of instances for a custom module?

例如:我们可以有 input [15:0] a; - 这会创建一个总线.我们可以对自定义模块做同样的事情,即 DFF [15:0] d;,其中 DFF 是自定义模块吗?这里我打算创建 DFF 模块的 16 个实例.

For example: we can have input [15:0] a; - this creates a bus. Can we do same thing for custom modules, i.e. DFF [15:0] d;, where DFF is a custom module? Here I intend to create 16 instances of the DFF module.

推荐答案

Verilog-1995 (IEEE 1364-1995) 中添加了实例的 Verilog 数组.它们可以与门、用户定义的原语和模块一起使用.Verilog-2001 中添加了更强大但也更复杂的生成器.

Verilog arrays of instances were added in Verilog-1995 (IEEE 1364-1995). They can be used with gates, user-defined primitives, and modules. Generates, which are more powerful but also more complex, were added in Verilog-2001.

这是一个模块实例数组示例:

Here is an example array of module instances:

DFF d[15:0] (clk, DFF_i, DFF_o);

对于每个端口连接,如果大小与形参的大小匹配,则它连接到每个实例.否则,每个实例都连接到表达式的一个部分选择(或位选择).

For each port connection, if the size matches that of the formal parameter then it is connected to every instance. Otherwise each instance is connected to a part-select (or bit-select) of the expression.

这篇关于我们可以拥有一组自定义模块吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆