Electronic – Help with a simple two bit Arithmatic Logic Unit

aludigital-logic

I'm creating a 2-bit alu. It has 8 defined functions (the functions are defined by a 3bit code), AND XOR etc, and these functions act on two, 2-bit binary numbers and produce a 2-bit answer.

my circuit diagram

From what I have done so far, I have a decoder that decodes what the function is, and the output of that powers/activates the corresponding purpose of that function.

for example the function code '000' activates the XOR terminal on the decoder and the XOR box spits out its answer, likewise '001' activates the AND box.

The problem I'm having is, the outputs of the two functions XOR and AND have to go into LSB,MSB and carryOut to indicate the answer, however since the outputs are tied together it causes an error. And I can't have 3 separate LED's defined for each function. I must only use that 3 (LSB,MSB and carryOut).

So my question is how do I not tie the outputs of the AND and XOR and produce a result depending on which function is active?.

*note on the image*

a - LSB of binary number 1  {these are controlled by switches}

b - MSB of binary number 1

c - LSB of binary number 2

d - MSB of binary number 2

cin - carry in.

Also everything inside the boxes are made using the basic gates and not from simulated blocks.

Best Answer

You need multiplexers for the outputs. The decoder is not strictly necessary.