I did some thinking about what costs space and does not do much. Then about MUXes and how to optimize them. There is some reading about it but I ended up with the old truth of optimizing:
Optimizing a MUX might be a good idea, but not having it in the first place is even better.
I wonder how much of this:
with selector_OPERANT_source select
dst_operationA_in <= src_registerA when 'A',
src_registerB when 'B';
with selector_OPERANT_source select
dst_operationB_in <= src_registerA when 'A',
src_registerB when 'B';
dst_operationA_out <= foo(dst_operationA_in, ...);
dst_operationB_out <= foo(dst_operationB_in, ...);
with selector_RESULT_source select
dst_register <= dst_operationA_out when 'A',
dst_operationB_out when 'B';
... finds it's way into silicon
when the following would have done the same:
with selector_OPERANT_source select
dst_operationX_in <= src_registerA when 'A',
src_registerB when 'B';
dst_operationA_in <= dst_operationX_in;
dst_operationB_in <= dst_operationX_in;
dst_operationA_out <= foo(dst_operationA_in, ...);
dst_operationB_out <= foo(dst_operationB_in, ...);
with selector_RESULT_source select
dst_register <= dst_operationA_out when 'A',
dst_operationB_out when 'B';
Most likely not written as a combinational statement but inside a process with if-elsif too.
Do synthesisers catch that?
My point is this: Any circuit that drives a MUX input but is not selected is in that state effectively 'open', therefore it does not matter what it is driven with at it's input at that moment. Should that circuits input be on the output of another MUX, then that MUX is also not needed in that state. In the above example and possibly in many cases there is a MUX for each of the sources of the downstream MUX. All but one will be unused at any time.