顶层模块的wire信号和其他模块的inout信号如何连接

How to make connection between wire signal of top module and inout signal of other module

代码如下:

module abc(a,b,c...);
  inout [15:0] a;
endmodule

module top;
   wire [15:0] data_a;
endmodule

如何将顶部模块的线信号 data_a 与其他模块的输入输出信号 a 连接起来,以便 data_a 的任何变化都反映在输入输出端口?

Inout端口在本质上与输出端口或输入端口没有区别。您可以在实例化模块时将inout端口直接连接到电线上。

在顶部模块中,在声明您的 data_a 连线后,写入:

abc abc_inst (
...
.a(data_a)
);

how to instantiate module上有很详细的回答,说明了如何在模块之间建立连接。

inouts没什么区别,实例化模块,接好里面的线top

module abc(a,b,c...);
  inout [15:0] a;
endmodule

module top;
   wire [15:0] data_a;
   abc u_abs(            //module instance
     .a( data_a )        //port connections
   );
endmodule