generate的使用verilog

根据项目设计的需要,要实例化多个类似的模块,这些类似的模块包括方波波形发生器,这几个模块基本相同,除了参数传递值不同,其他他部分都是相同的

具体实现代码如下:

 

此外有计数模块的例化,这个模块例化多个的关键问题在于,如何产生多个模块的多位输出,这里就涉及到的存储器的使用语法相关,所以我必须学习有关存储器相关的语法以及对应的操作。

 调试多累加模块出现错误

Verilog HDL error at <location>: declaring module ports or function arguments with unpacked array types requires SystemVerilog extensions

(ID: 10773)原因在于

module的port不允许定义一个寄存器数组,如

module mlti_photoncount(
input clk,rst_n,
input [7:0] I_in,Q_in,
input gateenable,clr,
input pmt,
output [31:0]count [7:0]//不允许定义该类型端口
);

仔细思考发现没有做这个的必要,原因在于生成语句虽然少了,但是整体的灵活性降低了。

 

posted on 2018-02-13 20:07  super_star123  阅读(876)  评论(0编辑  收藏  举报

导航