VHDL With Select
Quick Syntax
with mux_sel select output <=
input1 when '0',
input2 when '1',
(others => '0') when others;
Purpose
The most common use for the with select statement is to a create a multiplexer, or MUX. The with is in reference to a select signal, which then determines the selection of the output signal, as the input options are then laid out given specific selects.
I usually never come across a with select statement. Frankly, the when else statement is so much easier to code, read, and maintain that it's used 99.9% of the time over with select.
Perhaps there is an advantage of with select, but I have never been able to come up with any. My recommendation is to use when else instead.
Best Practices
1. With select statements are great for creating a MUX.
2. Make sure that all of the select signal possibilities are covered. It's a good idea to also cover a when others as a catch all just in case.
3. When else is a better option since it's much easier to read for everyone.