hdlbits-module name

This problem is similar to module. You are given a module named that has 2 outputs and 4 inputs, in some order. You must connect the 6 ports by name to your top-level module's ports: mod_a
 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( .out1(out1),
10                    .out2(out2), 
11                    .in1(a), 
12                    .in2(b), 
13                    .in3(c), 
14                    .in4(d));
15 endmodule

 与上一题进行对比

 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

可以发现此题的代码即是上一题自己写的注释内的代码,两者的题目也是非常接近,究竟是哪里不同了,导致了最终的区别?

再做:当然是有不同的,这一题的引用,不需要考虑别的,只要在规定位置填好即可,而上一题是单独引用变量

一个是按位置,一个是按名称

posted @ 2023-04-19 10:44  江左子固  阅读(16)  评论(0)    收藏  举报