mux

SpecialNodes mux

parameter ports:
Name Type Description Optional

case0

?0

case selector for in0

yes

case1

?0

case selector for in1

yes

…​

ase N-1

?0

case selector for in N-1

yes

input ports:
Name Type Description Optional

selector

?0

selector value

no

in0

?1

input selected when case0 is matched

yes

in1

?1

input selected when case1 is matched

yes

…​

in N-1

?1

input selected when case N-1 is matched

yes

output ports:
Name Type Description Optional

output

?1

destination for selected input value

no

mux reads a selector value and a value from each of its data inputs in0 through inN-1. It compares the selector value to the case labels case0 through caseN-1. If the selector value is equal to casei, the value read from ini is sent to the output port. Otherwise the value read from the default input, if there is one, is sent to output. Otherwise it is an error. The default input is the input for which the corresponding case label is unused, i.e., has no incoming link. There can be at most one default input.

Please note carefully that the difference between between mux and choose is that all of mux’s data input ports are triggered, whereas `choose’s data input ports are untriggered. `mux reads each of its input ports every time it fires, whereas choose reads only one data input port, the selected one. mux reads all and selects one value; choose selects one data input port to read, and reads only that one. mux is suitable for use in instances where several values are available simultaneously, one is to be chosen and the others are to be discarded.