# How do I direct input/output to correct circuit module. (2 bit calculator circuit)

I am designing a 2-bit four function calculator. With separate modules for division, multiplication and add/subtract.

Subtraction is performed by adding 2’s complement to input. So I have 3 modules. These modules are gate based i.e. only AND,OR, NOT,XOR etc are used. I am using a 7-segment display to display output that means I also have a 7447 decoder.

I designed these three modules separately. i.e. on three isolated breadboards. In that phase I had separate decoders and 7-segments for each module

Now the circuit is complete and I have to merge the 3 modules in the following way.

• There will be 4 inputs ( 2 numbers of 2-bits each) a0,a1, b0,b1.

• A selection of function (add,subt,multiply,divide).

• Output should be on 7-seg display

For a single module, I’d happily connect inputs, and outputs will go to decoder, and we have our nice 7 seg display powered up.

But how do I do this with 3 modules in a way that only the selected module gets the input and the output from only the selected module goes to decoder (and hence 7 segment display)? This diagram, I believe will help clarify the scenario.

The last piece you need is a multiplexer, specifically a 1-of-4 multiplexer such as the 74153. Since you have 4 inputs to the decoder you will need 2 chips at 2 multiplexers per chip. Connect the A and B inputs to S0 and S1, each of the C inputs to each of the function output bits in turn, and the Y outputs to the decoder inputs.

• Thanks for the response, but pardon me, Could you please elaborate a bit ? Apr 20, 2014 at 1:52
• Which part specifically? Apr 20, 2014 at 1:54
• Actually, after "..such as the 74153". How you are suggesting to use it ? Apr 20, 2014 at 1:59
• Have you pulled up the datasheet for it yet? Apr 20, 2014 at 2:00
• Yes, I checked the function table. Apr 20, 2014 at 2:04

You COULD use 4 x 3 way selectors to connect the inputs to the desired arithmetic unit BUT you can often just hard connect them as shown. All devices now process all inputs BUT you only select the desired output. If you do not want to hard wire them you can use eg a CD4052 as below in the reverse direction. As noted below - a CD4052 is a bidirectional switch so can be used for 1:4 or 4:1 switching BUT most such ICs can be used in only one or other direction. The CD 4052 is a full analog switch and can be used for transferring voltage levels within it's specified range in either direction.

You need 4 x 3:1 selectors to connect the arithmetic units to the decoder. There are many ICs that do this.
One such is the CD4052 and variants. This has 2 x 4:1 selectors in one package.
You need 3:1 so the 4th channel can be unused.
This is a CMOS IC and can handle analog and is bidirectional BUT is also usable for digital signals.

Data sheet:

CD4052 block diagram.

1 of 4 inputs X0, X1, X2, X3 can be switched to an output X common as selected by binary code on A B 00, 01, 10, 11.
There are two such circuits per package.

SO:

• Thank you for such an excellent and elaborate answer, I came up with this design ( tinypic.com/r/2pq50qt/8 ) based on the last answer. I should have mentioned that I am taking first course in Digital Logic Design, so many things are new for me. Apr 20, 2014 at 15:26