Phil wrote
Mux16(a=a[0..15], b=b[0..15], sel=sel[0], out=ab[16]);
I'm going to use abcd for Mux16 pins and ABCD for Mux4Way16 pins to try to limit confusion. They all need to be lowercase in your real HDL
CHIP Mux4Way16 {
IN A[16], B[16], C[16], D[16], sel[2];
CHIP Mux16 {
IN a[16], b[16], c[16], d[16], sel[2];
Since
A and
a are both 16-bit buses, you can simple connect them together; no subscripting required.
Mux16(a=A, ...
Whenever you create a new wire by connecting to an output that is a bus, the new wire is a bus of the same width; again, no subscripting required.
Mux16(..., out=ab)
creates an internal wire in Mux4Way16 named
ab.
--Mark