Re: 16bit syntax problems

Posted by cadet1620 on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/16bit-syntax-problems-tp4001846p4002324.html

TurdFurgusand wrote
Hello everyone. Yes, I did read the Appendix a few times. For some reason, I can't get the syntax right with multi-bit bus input and outputs, I always get an error. I'm editing the .hdl files for Chapter 1, to implement them in the Hardware Simulator. I drew all of the Chapter 1 implementations out on paper. I know how to do all of them, so no one will take away from my learning if they show me how it's coded.

Here is some example code that doesn't work.

    IN  in[16];
    OUT out[16];

    PARTS: Foo(a[0..15] = in[0..15], b[0..15] = in[0..15], out = out[0..15]);
This only works if Foo has 16-bit a, b and out. To build the Xxx16 chips you need to do each bit with its own Xxx chip, selecting one bit of the 16-bit I/O signals at a time.
    Xxx(a=a[0], b=b[0], out=out[0]);
    etc.

--Mark