verilog - 如何解决verilog模块实例化错误
问题描述
我试图通过实例化另一个模块来连接两个模块的端口,但我遇到了这个错误:
错误 (10170):mlt.v(25) 附近文本的 Verilog HDL 语法错误:“[”;期待“)”。检查并修复紧接在指定关键字之前或处出现的任何语法错误。英特尔 FPGA 知识数据库包含许多文章,其中包含有关如何解决此错误的具体细节。访问 https://www.altera.com/support/support-resources/knowledge-base/search.html上的知识数据库 并搜索此特定错误消息编号。
我正在尝试将[3:0]d
with in1
and连接起来in2
(对于两个单独的实例)。
这是代码:
module mlt(in1,in2,out,clk,en);
input clk;
input en;
input wire [3:0] in1,in2;
output reg [7:0] out;
reg [7:0]temp_o;
reg t1;
reg [3:0]temp_1;
reg [3:0]temp_2;
wire w1,w2,w3,w4,w5,w6,w7,w8;
d_latch u1 (.d[0](in1[0]),.d[1](in1[1]),.d[2](in1[2]),.d[3](in1[3]),
.clk(clk),
.q[0](w1),.q[1](w2),.q[2](w3),.q[3](w4));
d_latch u2 (.d[0](in2[0]),.d[1](in2[1]),.d[2](in2[2]),.d[3](in2[3]),
.clk(clk),
.q[0](w5),.q[1](w6),.q[2](w7),.q[3](w8));
//…………
//………
module d_latch (d,clk,q);
input [3:0]d;
input clk;
output reg [3:0]q;
always @ (posedge clk)
q<=d;
endmodule
解决方案
您不能拆分端口。使用串联,并注意信号出现的顺序。
d_latch u1 (.d(in1),
.clk(clk),
.q({w4,w3,w2,w1}));
推荐阅读
- reporting-services - SSRS 表达式,用于获取当前周周日至周六
- flutter - Flutter 有两个 SliverPersistentHeader 一个接一个堆叠
- html - 更新 VSCode html 制表符间距
- python - 我将 permission_required 设置为“is_staff”,但出现错误 403 权限被拒绝
- python - 更改桌面屏幕方向
- excel - 在本地复制工作表数据是否比将单元格链接到外部文件更适合内存消耗
- spring - Curl Spring 复杂对象为空
- google-drive-api - Google Drive API:列出共享驱动器下的所有文件夹
- c# - 在 C++ 中将 .bmp 图像大小调整为 1280X720
- javascript - JsonResponse 和 HTTPResponse 有什么区别?