# What operation does this circuit perform?

I have an assignment due for school, but this one question has been getting the best of my group-mate and I for about a week now. I am in no way asking you to solve the problem for me, but could you please make it a little bit simpler for us to understand.

Question: If the input and output bit patterns in the circuit below are interpreted as binary representations of numeric values, what operation does the circuit perform?

My thinking:

1) If we put in a set of ones and zeroes as input then determined what the output would be , then convert the input bit pattern and output pattern to decimal, then we could try to figure out what base 10 mathematical operation was performed. Although when this was tried, there seemed to be no simple correlation between the input and the output.

2) Assuming that the question is not looking for a mathematical operation , and is instead looking for a logical operation, we tried drawing up a truth table, then go stuck("Where do we go from here? ").

Problems:

1) The question stated that the input and output bit patterns are binary representations of numeric values, we cant figure out why that is important , because when trying to do base ten arithmetic, it did not work.

2) Why did they put the '1' as an input?

3) assuming three inputs, how to you go about finding out what single logical operation is performed in the circuit.

• Have you made a truth table for inputs and the outputs? – Tyler Oct 3 '15 at 12:35
• I've made a truth table for this and the answer is remarkably obvious. Can you recheck your own truth table and make sure you haven't slipped up? Do it slowly - it's easy to keep making the same mistake again and again because you've convinced yourself you haven't made one! Hint: inputs and outputs (left to right) both represent standard weighted binary numbers - 4, 2, 1 respectively. – CharlieHanson Oct 3 '15 at 14:39

Have another go at the numeric hint. The question told you they were binary values.

We normally write binary values left to right, same way as we do for decimal values. So the left hand column is most significant, so weight 4, and the right most column is least significant, weight 1.

You understand XOR gates, right? One way to look at them is 'they do the exclusive OR thang'. Another way to look at them is that they pass through a logic signal unchanged when the other input is 0, and invert it when the other input is 1. The logic operation described is identical, but sometimes it's easier to get what a circuit is doing using one or the other way.

If you look at the logic operation, a pattern emerges.

The '1' output is always inverted.

The '2' output is inverted when the '1' input is low.

The '4' output is inverted when both the '1' and '2' inputs are low.

That sequence is screaming out a pattern to me, like it's meant to do something sensible.

Anyhow, I'm not going to do your homework for you. You started in the right way, writing down all 8 sets of ones and zeroes. However if the answer didn't jump out at you, perhaps you picked a non-standard weighting. Try again with the weighting I suggest and have another look.

• You seem to disagree with my anwser, if it makes you feel better I am going to delete it. – Golaž Oct 3 '15 at 13:16
• You make it seem so obvious , but please remember this is introduction to logic that i'm doing here. When you or the question says 'operation' do you mean logical operation, like AND , OR, etc... or do you mean something else ? – worlboss Oct 4 '15 at 12:46
• Ok , i got it ... i was using interpreting the input as including the '1' that is present in the diagram, making my input have be 4-bits long and my output 3 bits , i can see now that that '1' is probablly a carry, bit , i will investigate this , as well as read up on more logic gates. Answer: The circuit subtracts 1 from the input, by adding the three- bit 2's complement of 1 , which is -1. (is this the way to phrase the response ? lol not quite familiar with jargon yet) – worlboss Oct 4 '15 at 14:59
• @worlboss Ignore the 'static' 1. It's only there to allow three XOR gates to be used in the diagram, which is perhaps to deliberately confuse you. The term 'operation' covers any action that is performed, be it bit-wise (an individual input) or byte-wise (all three inputs). I would say the operation of this circuit is "a one-bit subtractor". – CharlieHanson Oct 5 '15 at 10:41