[英]generate block in system verilog
module A#(parameter NUM_PORT=2);
logic port_wire[NUM_PORT];
DUT dut_inst(
generate
for(genvar idx=0; idx<NUM_PORT; idx++) begin:num_port
.port[idx] (port_wire[idx]);
end:num_port
endgenerate
);
endmodule
Is the above implementation of generate block is allowed?是否允许上述生成块的实现? I mean inside a module instantiation.
我的意思是在模块实例化中。 Sorry if the question is too silly.
对不起,如果问题太愚蠢了。
No, you can't use a generate construct in the middle of a port list.不,您不能在端口列表中间使用 generate 构造。
But if one of the ports in the list is an array, you can do但是如果列表中的一个端口是一个数组,你可以这样做
module A#(parameter NUM_PORT=2);
logic port_wire[NUM_PORT];
DUT dut_inst(
.port (port_wire);
);
endmodule
module DUT #(int NP=2)(input logic port[NP]);
...
endmodule
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.