Re: How do I combine 2 sperate bits in a 2bit input
Posted by
cadet1620 on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/How-do-I-combine-2-sperate-bits-in-a-2bit-input-tp3593549p3595077.html
Malco wrote
I'm not very familiar with hardware description languages. But I think anyone familiar with programming will find this unusual. A parameter can be passed to a construct split across multiple... well, 'parameters'. Maybe that's how most description languages do it. Is it?
What you need to do is to realize that HDL is a wiring diagram, not a program. Each line of the PARTS section says "hook these wires to this part this way," not "call this function with these arguments."
Declaring an input or and output as a bus is just a shorthand to save typing a lot of almost identical wire connections. Sometimes, like for the various mux select inputs, it is not obvious if the part will be more easily used with the pins broken out as in sel0, sel1, sel2, or as a bus sel[3]. In this case, you'll be using the muxes a lot in chapter 3 in an application where it is convenient that the sel inputs are buses.
Also, there is no problem hooking more than one wire to an output pin.
It also doesn't matter in what order you have the statements in the PARTS section, just like it doesn't matter which part of a schematic diagram you draw first. As long as you eventually draw the entire diagram, somebody else can build the circuit.
--Mark