# How to choose which function to use depending on the parameter value? (MUX and Gates implementation)

Let's say we have A,B,C , which are all representation of decimal numbers. A and C are 4bit, B is 2bit.

• if A is any of those numbers (eg: 0,5,6,11 ), the function is

F(A,B,C) = AB+C

• If A is the rest of the numbers , the function is :

F(A,B,C) = B+C

We can use 2x1 MUX, 2input logic gates (both as much as needed), and of course FA .

I tried to treat the numbers as minterms, and use K-map for A3A2A1A0. Where is the 2to1 MUX involved? How exactly should I choose how to operate based on the value of the numbers?

I don't have issues as to how to implement/use the adder (for additions and/or multiplications).I don't need any answer there/ I have troubles understanding :

1. How to treat the actual numbers (as minterms?)

2. Because in the second function, basically the A is missing, and it is an actual multiplication, is it wise to treat it as 1? . B+C is still 1B+C in mathematics. Right?

3. Should I represent every number with gates from scratch, no K-Map needed? What about the MUX?

4. Since I will need each bit separately ,as an input to the adder, then, should I , somehow, implement the 2to1 MUX to each specific bit?

## 1 Answer

1. I'd do A3A2A1A0 as minterms AND maxterms. See which gives minimum gates. The gate count will be close but there is some overlap as maxterms. There is no simplifying 0,5,6,11. All are unique. So decode for A is big and messy either way you go. 4 4-input to a 4 input with 2-input gates is messy. Use this signal to feed MUX as required.

2. So AB+C and B+C are similar. Use 4 2to1 MUX to switch between A and 1. MUX * B + C. No idea how you are doing the multiplication and addition.

3. & 4. Me thinks 1 and 2 sort out 3 & 4.

$$(\overline {A3} + \overline {A2})(\overline {A3} + {A1})........$$