# Help with a simple two bit Arithmatic Logic Unit?

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.

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.

• Honestly this is your homework right? you ought to figure it out for yourself - I'll give you a simple hint - you shouldn't be 'activating' a block to choose the function that appears on the outputs Commented Mar 12, 2011 at 8:41
• OK well thanks for your comment, for one I'm only asking here as I'm stuck, and the other is that, 'activating' a block was the starting point that I was told to go on??. Commented Mar 12, 2011 at 10:22
• Are you allowed to use 3-state logic? en.wikipedia.org/wiki/Three-state_logic Commented Mar 12, 2011 at 15:20
• @endolith : oh cheers, I'm not able to use that, but thanks for the info:). Commented Mar 13, 2011 at 0:31

## 1 Answer

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