0
\$\begingroup\$

I understand that if the requirement was to implement a mux that was a power of two there is the trick where you can do do x -1, so for instance if I wanted to implement a 8-to-1 mux, I would use 7 muxes because 8 = 23 and 23 - 1 = 7. But how does that change if you wanted to implemented a mux that is not a clean power of 2?

\$\endgroup\$
  • \$\begingroup\$ 7× 2:1 mux have a total number of inputs that is 14. I'm surprised you can mux 128 inputs with that! Are you sure you've got that righ? \$\endgroup\$ – Marcus Müller Jan 27 at 16:12
  • \$\begingroup\$ @MarcusMüller They're claiming an 8-to-1 mux with 7, not 128-to-one. \$\endgroup\$ – Hearth Jan 27 at 16:13
  • \$\begingroup\$ @Hearth ah shoot, my mistake \$\endgroup\$ – Marcus Müller Jan 27 at 16:15
1
\$\begingroup\$

Add another 2:1 mux in front of your 128:1 mux; that gives you exactly 129 possible states, with the least additional components.

\$\endgroup\$
  • \$\begingroup\$ So in total that is 8 muxes right? \$\endgroup\$ – PeraltaLearns Jan 27 at 16:11
  • 1
    \$\begingroup\$ @PeraltaLearns You need a lot more than 7 2:1 muxes to get a 128:1 mux. \$\endgroup\$ – Hearth Jan 27 at 16:12
  • \$\begingroup\$ 2^(7) = 128 - 1 = 127 muxes needed just to get a 128:1 mux. If I wanted the 129:1 mux in the question I would need and additional mux so 128 in total? \$\endgroup\$ – PeraltaLearns Jan 27 at 16:16
  • \$\begingroup\$ @PeraltaLearns I think you can trust your own math well enough to not need our confirmation in this \$\endgroup\$ – Marcus Müller Jan 27 at 16:17
  • 2
    \$\begingroup\$ If you don't trust yourself, draw the entire circuit on a napkin for 2, 4 and 8 inputs and see that the count matches a proposed math model. Then use that model for the large case. \$\endgroup\$ – Chris Stratton Jan 27 at 16:32
0
\$\begingroup\$

Ports MUXes (2:1) ...

N     X                 INT((Log(N)/LOG(2)+0.5) -1 
0     0                    0
1     1                    1
2     1                    1
3     2                    2
4     2                    2
5     3                    3

Roundup (Log N / Log 2) = X = INT((Log(N)/LOG(2)+0.5) -1 for \$2^X\$

for N=129 X=8 (2:1 MUX's)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.