2
\$\begingroup\$

I'm from math.stackexchange and I wanted to know the name of an operation on multiple variables. I thgouth what I wanted was the XOR gate, but this is not the case. When I looked on this site I noticed the XOR truth table was this:

\begin{matrix} FFF & 0 \\ FFT & 1 \\ FTF & 1 \\ FTT & 0 \\ TFF & 1 \\ TFT & 0 \\ TTF & 0 \\ TTT & 1 \end{matrix} I would have excpeted, and what I'm after is, this \begin{matrix} FFF & 0 \\ FFT & 1 \\ FTF & 1 \\ FTT & 0 \\ TFF & 1 \\ TFT & 0 \\ TTF & 0 \\ TTT & 0 \end{matrix}

Is there a name for this second table as that is what I would like to use and I would like to stick to convention. Thanks in advance, Ben

\$\endgroup\$

closed as off-topic by Elliot Alderson, RoyC, Phil G, Finbarr, Voltage Spike Jun 12 at 18:12

  • This question does not appear to be about electronics design within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ In the second table, the three inputs are not commutative. Is that really what you want? \$\endgroup\$ – CL. Jun 6 at 7:22
  • 3
    \$\begingroup\$ Why do you expect 1 xor 1 xor 1 to be 0? \$\endgroup\$ – Steve G Jun 6 at 7:45
  • 2
    \$\begingroup\$ By asking for a name for that truth table, I would hope I'm being clear that I don't think it is called XOR. I have shown that I understand XOR not to be that truth table and that I wanted a name for the second truth table. If one doesn't exist, I will make one up for what I am doing. \$\endgroup\$ – Ben Crossley Jun 6 at 8:07
  • 2
    \$\begingroup\$ Possible duplicate of How is an XOR with more than 2 inputs supposed to work? \$\endgroup\$ – Elliot Alderson Jun 6 at 11:58
  • 2
    \$\begingroup\$ Probably needs to go back to maths yhis is nothing to do with EE. \$\endgroup\$ – RoyC Jun 7 at 11:00
1
\$\begingroup\$

I think this truth table would result in something like the circuit below, unless I've made a mistake :)

As you mentioned it would be like a 3 Gate XOR (what's represented by your first table) but you have to exclude the case where all three inputs are 1 "True".

schematic

simulate this circuit – Schematic created using CircuitLab

This construct doesn't have a specific name it's XOR(NOT(AND(A,B,C)), XOR(A,B,C))

\$\endgroup\$
  • \$\begingroup\$ Thank you for taking the time to make this however, the answer I am looking for is in the form of a name. I.e. ONE(A,B,C) \$\endgroup\$ – Ben Crossley Jun 6 at 8:16
  • 2
    \$\begingroup\$ This construct doesn't have a specific name it's XOR(NOT(AND(A,B,C)), XOR(A,B,C)) \$\endgroup\$ – Humpawumpa Jun 6 at 8:27
2
\$\begingroup\$

No, there is no name for that custom logic operation.

You'll have to implement the function below in whatever environment you are working in.

\$ f(a,b,c)=\begin{cases} \displaystyle 0 & ,\text{when } abc=1 \\ \displaystyle \text{xor}(a,b,c) & ,\text{otherwise} & \end{cases}\$

Or, if you don't want to deal with cases, this function gives the same answer:

\$ f(a,b,c)=\text{xor}(a,b,c)(1-abc) \$

\$\endgroup\$
  • 1
    \$\begingroup\$ Sorry, but your definition of XOR for >2 inputs is not a universal standard. Some definitions of such an XOR function specify that the output is true when one and only one input is true. \$\endgroup\$ – Elliot Alderson Jun 6 at 12:01
  • \$\begingroup\$ @ElliotAlderson Hmm, it appears that it's up for interpretation according to your answer. And OP has shown how he views xor for 3 inputs with his truth table, which is the one I agree with, and all computers agree with. And since OP is the one that is going to use it then I suppose it's up to his interpretation which matters. - I would love to see any computational execution in any modern programming language that evaluates \$1\oplus1\oplus1\$ to anything other than 1. In my world xor for inputs >2 are just a sum of the ones modulo 2. I mean, this is how parity is calculated. \$\endgroup\$ – Harry Svensson Jun 6 at 12:14
  • \$\begingroup\$ Take a look at the answers to electronics.stackexchange.com/questions/93713/… The OP asked about the convention for the name of the function, and according to some sources (such as the IEEE) the second function is the real XOR. By the way, the IEEE standards recommend a different symbol for parity functions. Can you provide citations for your claim that "all computers" agree with your definition? \$\endgroup\$ – Elliot Alderson Jun 6 at 12:20
  • \$\begingroup\$ @ElliotAlderson No, I don't have any citation anywhere, unless you want me to start linking to datasheets for microcontrollers, I just know what happens if I have three registers, a, b, c, with LSB set to 1 and perform a^b^c then I get 1. And I've so far never come across any microcontroller / processor that gives me 0. Nor have I come across that when dealing with FPGA's, CRC, modulo 2 arithmetic or other boolean logic or truth tables for that matter. But fine, you can call it xor if you want, I won't. \$\endgroup\$ – Harry Svensson Jun 6 at 12:29
  • 1
    \$\begingroup\$ I think the point is that \$\mathrm{xor}(A,B,C)\$ is not necessarily the same as \$\mathrm{xor}(\mathrm{xor}(A,B),C)\$. When you write assembly code or HDL you always use binary xor operators, so the question doesn't come up. \$\endgroup\$ – Elliot Alderson Jun 6 at 15:56
0
\$\begingroup\$

Yes, this gate is called an exclusive-OR (XOR) gate. Some definitions of the XOR gate that has more than 2 inputs state that the output is true if one and only one input is true. This has been discussed at some length before: How is an XOR with more than 2 inputs supposed to work?

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.