Unneccessary MUXes

By: Moritz (better.delete@this.not.tell), April 27, 2020 12:41 pm
Room: Moderated Discussions
I recently thought about how big MUXes are and how I might shave some off.
Quickly I ended up with the old truth of optimization: Optimizing something might be a good idea, but not having it in the first place is even better.
After trying to talk to some experts and them not getting how there might be an entire needless MUX, I wonder even more how much of this:

with select_OPERAND_source select
dst_operationAin <= src_registerA when 'A',
src_registerB when 'B';

with select_OPERAND_source select
dst_operationBin <= src_registerA when 'A',
src_registerB when 'B';

with select_RESULT_source select
dst_register <= dst_operationAout when 'A',
dst_operationBout when 'B';

... finds it's way into silicon
when the following would have done the same:

with select_OPERAND_source select
dst_operationXin <= src_registerA when 'A',
src_registerB when 'B';
dst_operationAin <= dst_operationXin;
dst_operationBin <= dst_operationXin;

with select_RESULT_source select
dst_register <= dst_operationAout when 'A',
dst_operationBout when 'B';

Of course this might be written inside a process with if-elsif too.
Do synthesizers 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 circuit's 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. If MUXes select from entirely different sources, then they must exist. In the example I provided one up-stream MUX doesn't have to exist more than once at all. Only what is different or is utilized at the same time must exist.
A different case where M MUXes could be optimized internally is when
there are N sources and M targets. If not all N^M combinations are needed the M MUXes can be simplified into one by putting the unneeded input combinations onto the same sub-MUX. Since the choice of any one input excludes the choice of any other.
As an example for how this might come to be: There could be fixed value registers containing -1 +1 0
One would never want to add -1 with +1.
 Next Post in Thread >
TopicPosted ByDate
Unneccessary MUXesMoritz2020/04/27 12:41 PM
  Unneccessary MUXesrwessel2020/04/27 01:58 PM
    my example is inadequateMoritz2020/04/27 07:38 PM
      my example is inadequateRicardo B2020/04/28 04:33 AM
        "elaborate"Moritz2020/04/28 05:59 AM
          "elaborate"anon³2020/04/28 10:42 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell purple?