将输入 A 的部分数组设置为模块的输入

Set partial array of input A to a module's input

XYZ 接受 [1:0] 输入 并且 QRS[2 :0].所以在QRS中声明XYZ时,如何设置QRS a[1] and a[0] to XYZ a and QRS b[1]b[0]XYZ b查看我代码中的注释清楚明白我的问题

module XYZ (
    y,
    a, b
);
    output y;
    input [1:0] a, b;
  
    //....

endmodule


module QRS (
    y,
    a, b
);
    output y;
    input [2:0] a, b;
    wire w;


    XYZ xyz(w, //How to assign a[1] and a[0] to a, and same for b)
    
endmodule

好的,你可以这样做

XYZ xyz(w, a[1:0], b[1:0])