connecting ports by position

This problem is similar to the previous one (module). You are given a module named mod_a that has 2 outputs and 4 inputs, in that order. You must connect the 6 ports by position to your top-level module's ports out1, out2, a, b, c, and d, in that order.

You are given the following module:

module mod_a ( output, output, input, input, input, input );
 1 module top_module ( 
 2     input a, 
 3     input b, 
 4     input c,
 5     input d,
 6     output out1,
 7     output out2
 8 );
 9     /*mod_a instance2(
10         .out1(out1),
11         .out2(out2),
12         .in1(a),
13         .in2(b),
14         .in3(c),
15         .in4(d));*/
16     mod_a mod_a_inst(out1,out2,a,b,c,d);   //这个是可以运行的,但是与上面注释内有和不同呢?
17 endmodule

(29条消息) HDLBits 系列(2)——Verilog Language(Modules: Hierarchy、Procedures)_Bronceyang131的博客-CSDN博客 此博客中对于此题的解释,在注释内的写法与我类似,但是不能运行,对于我编写的,报错如下,我还要再想一想:

Error (12002): Port "in1" does not exist in macrofunction "instance2" File: /home/h/work/hdlbits.10364666/top_module.v Line: 15

再写:
这在注释里写的当然是不能运行的,因为这一题就是要按位置引用,并且没有给出可以按名称引用的子模块,所以当然引用不了,想按名称,题目都没条件当然没法写,总是错
posted @ 2023-04-19 10:27  江左子固  阅读(27)  评论(0)    收藏  举报