Pretty simple, really. I want to negate an integer which is represented in 2’s complement, and to do so, I need to first flip all the bits in the byte. I know this is simple with XOR–just use XOR with a bitmask 11111111. But what about without XOR? (i.e. just AND and OR). Oh, and in this crappy assembly language I’m using, NOT doesn’t exist. So no dice there, either.
Share
You can’t build a NOT gate out of AND and OR gates.
As I was asked to explain, here it is nicely formatted. Let’s say you have any number of
ANDandORgates. Your inputs areA, 0 and 1. You have six possibilities as you can make three pairs out of three signals (pick one that’s left out) and two gates. Now:So after you fed any of your signals into the first gate, your new set of signals is still just A, 0 and 1. Therefore any combination of these gates and signals will only get you A, 0 and 1. If your final output is A, then this means that for both values of A it won’t equal !A, if your final output is 0 then A = 0 is such a value that your final value is not !A same for 1.
Edit: that monotony comment is also correct! Let me repeat here: if you change any of the inputs of AND / OR from 0 to 1 then the output won’t decrease. Therefore if you claim to build a NOT gate then I will change your input from 0 to 1 , your output also can’t decrease but it should — that’s a contradiction.