【问题标题】:how to solve verilog module instantiation error如何解决verilog模块实例化错误
【发布时间】:2020-05-09 13:44:37
【问题描述】:

我试图通过实例化一个模块来连接两个模块的端口,但是我遇到了这个错误:

错误 (10170):mlt.v(25) 附近文本处的 Verilog HDL 语法错误:“[”; 期待“)”。检查并修复出现的任何语法错误 紧接在指定关键字之前或处。英特尔 FPGA 知识数据库包含许多文章,其中详细介绍了如何 解决此错误。访问知识数据库 https://www.altera.com/support/support-resources/knowledge-base/search.html 并搜索此特定错误消息编号。

我正在尝试将[3:0]din1in2 连接(对于两个单独的实例)。

代码如下:

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

【问题讨论】:

    标签: verilog quartus intel-fpga


    【解决方案1】:

    您不能拆分端口。使用串联,并注意信号出现的顺序。

    d_latch u1 (.d(in1),
    
    .clk(clk),
    
    .q({w4,w3,w2,w1}));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多