Multiplexers are another beautiful component also known as MUX. MUX basically switches inputs depending on the "select line". The "select line" decides which input to be switched the at output. Multiplexers are clock less hence change in output is reflected as soon as the select value changes.
Depending on the requirement one may use 2, 4, 8 .. input multiplexers. Number of inputs are function "select line" width. If select line is x then number of inputs will be (x^2). Only the input which is selected through select line will be routed to the output, value change on all non selected input will be ignored by MUX.
Below are VHDL implementation of some MUXs..
Two input MUX |
---|
VHDL Code
data_out <= data_1 when select = '0' else data_2; |
Four input MUX |
---|
VHDL Code
data_out <= data_1 WHEN select = "00" ELSE IF data_2 WHEN select = "01" ELSE IF data_3 WHEN select = "11" ELSE data_4; |
Note that inputs can be of any width (1-bit or n-bits), but all the inputs and output should be of the same width.