Re: 'Wire' command?

Posted by cadet1620 on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Wire-command-tp2982387p2982457.html

If I understand correctly, you want to And a 16-bit bus with a single-bit signal. The best you can do with And16 is
    And16(a=a16, b[0]=b, b[1]=b ... b[15]=b, out=out16)
where a16 and out16 are 16-bit buses and b is a single-bit signal.

Although single-bit signals can't connect to buses, the builtin 'true' and 'false' can be connected to buses. There are clever ways to use Mux16 to convert a simple signal to a bus, and to make the 16x1 And and Or.

(I did initially write a Wire part using out=!!in, and a Make16 part that used Wire to connect the in to all the outs, before I figured out the Mux16 tricks.)

--Mark