0

When I was implementing Not16 with Not gates:

CHIP Not16 {
    IN in[16];
    OUT out[16];
  
    PARTS:
        Not(in=[0], out=out[0]);
        Not(in=[1], out=out[1]);
        Not(in=[2], out=out[2]);
        Not(in=[3], out=out[3]);
        // ...
        Not(in=[15], out=out[15]);

I got an error "[0]: sub bus of an internal node may not be used" on the first part.

However, implementing this with 16 Nand gates is fine:

Nand(a=in[0], b=in[0], out=out[0]);
// ...

Can someone please point to the issue and difference.

p.s. Using HardwareSimulator from Nand2Tetris

Pandemonium
  • 7,724
  • 3
  • 32
  • 51

2 Answers2

2

I believe you have typos in your Not components. The in should be in the form in=in[x], not in=[x] as you have it currently.

Conversely, your Nand components are properly formatted.

MadOverlord
  • 1,034
  • 6
  • 11
1

Your format is correct, but try in = in[0] instead of just in = [0]