07-25-2015, 10:45 PM
WARNING: This will be a looooong post!
Hey guys I made something awesome the last couple of days. It’s an expandable XOR gate. So far I made a 2 input, a 5 input and a 10 input design for both of my version!
Originally I wanted to do this because I wanted my calculator to deactivate when no input, or too many inputs were given for A or B. I know now this could have been done simpler, but since then, the expandable XOR has become a project for me so I finished it!
So it started with examining this design for the normal XOR with 2 inputs.
LINK
Then when I learned how exactly it worked, I made this XOR with 3 inputs:
Then I took a step up and made a XOR with 4 inputs:
At this point I already knew this was not expandable. With each addition the amount of combinations I had to make went up like this:
x = combinations
n = amount of inputs
x = ( n2 – n) / 2
n – x
3 – 3
4 – 6
5 – 10
6 – 15
10 – 45
This meant that if I wanted to use all of those connections, it would get way too much really quickly, so I had to create an organized and expandable design where I could combine all pairs of inputs.
After a lot of trying, first horizontal, but soon moving over to diagonal since that solved some problems, I managed to do it. The version that I created is called Expandable XOR v1 (obviously because it is the first version of the expandable XOR). I should by now give a lot of credit to Jeppe. During the designing of the diagonal expandable XOR, he helped tremendously. Without him it wouldn’t have been possible.
This is the screenshot wherein all the expandable version I built are shown (including v2, which I will talk about in a sec)
The way it works is as following:
The inputs go down in north-south lines. The go down to the bottom by repeaters and then turn into east-west lines. By doing that, they form a grid. Within this grid, each pair of levers is combined at intersections. This is done as following:
Top line ▷ repeater-├Torch ▷ Redstone dust dot ▷ Torch ▷ ‘Group’
Bottom line ▷ torch⏌
However we could exclude combining levers that were the same (a-a, b-b, c-c, d-d, e-e etc). This was very convenient as it gave us room to make the top lines be able to change into the bottom lines without taking in space.
These pairs of levers are grouped on top in the following way (in a 5 input version):
Group 1
a-b
a-c
a-d
a-e
Group 2
b-a
b-c
b-d
b-e
Group 3
c-a
c-b
c-d
c-e
Group 4
d-a
d-b
d-c
d-e
Group 5
e-a
e-b
e-c
e-d
And those groups were then inverted, and together formed the output. This makes it work as following:
While writing this thread I realized that I have a-b AND b-a. This is not very useful, because it takes in double the space. The problem with the version was that I NEEDED both of them. If I would delete either of them, the machine would stop working because a-b is the point where A can turn the output on, while b-a is the point where B can turn the output on. I cant do it at both!
I needed to design a version where at a-b, A AND B could turn the output on, thereby roughly halfing the size of the entire thing!
So that's how I came to designing Expandable XOR v2, which is way smaller than v1 and less messy! I made v2 completely by myself. What I had to do is replace the intersections like a-b with individual XORs. The XOR design I used fore those points where that of Tomy. This meant I no longer needed a-b and b-a, just a-b! I also made a 10 input, a 5 input and a 2 input version of this version to compare the two. This would be nice, but then I found out it didn't work! After alot of thinking before I went to sleep I realized I shouldn't put XORs at the intersections. Instead I should put ANDs at the intersections and have a big OR for the inputs!
So how this works:
The OR gate is checking if 0 inputs are on. If 0 are on, it sets the output to off.
Then, if you put one lever on, the OR deactivates and the output can turn on. However if any other lever is now also turned on, one of the ANDs will activate and turn the output back off.
When I showed v2.1 to Decapo and Tuchi, with its ANDs and OR, we found a better way to do it. I finalized the design, making it more compact and even faster. The result is my absolute pride, Expandable XOR v3!!!
This is the pictures where you can see how it developed from v1 to v3:
Terminology Discussion
I have heard people disagreeing about the name, so I’ll explain why I’m near certain that this SHOULD be called a XOR gate.
DISCLAIMER: I am not an electrician or a computer programmer. I am not an expert at any of these things. This is just the explanation of my interpretation of why I think this should be called a XOR. You’re free to call it whatever you want!
Truthtable
00000=0
00001=1
00010=1
00011=0
00100=1
00101=0
00110=0
00111=0
01000=1
01001=0
01010=0
01011=0
01100=0
01101=0
01110=0
01111=0
10000=1
10001=0
10010=0
10011=0
10100=0
10101=0
10110=0
10111=0
11000=0
11001=0
11010=0
11011=0
11100=0
11101=0
11110=0
11111=0
The rule for this gate is:
If ONE input is ON, output is ON
If NO or MORE THAN ONE input is ON, output is OFF
XOR stand for Exclusively OR
Therefore one could phrase that this means:
If exclusively a or exclusively b or exclusively c or exclusively d or exclusively e is ON, output is ON (for 5bit)
To say that the rule for a XOR is that the output changes when an input changes is wrong, it is merely something that happens with a two input XOR, but has nothing to do with the term, Exclusively OR. You should create a rule from the name that already exists. The term, in my mind, clearly means that the output should only be on, if one, and only one, of the inputs is on. I am not the only one that thinks this, or at least acknowledges that this interpretation is well supported:
Logisim is a logic simulator which permits circuits to be designed and simulated using a graphical user interface, and when using multiple input XORs, it uses the rule: Output is 1, when a single input is 1
Advanced math blogs like this one discuss the different interpretations. (LINK: https://mindhunter74.wordpress.com/2011/...ting-gate/)
A published book from IEEE about logic functions also say that the rule for a XOR gate is: "Exclusive OR. One and only one input must be active to activate the output."
Even the computer science branch of the university of Hamburg has the information about the two different interpretations on their website. (LINK: https://tams.informatik.uni-hamburg.de/a...s/xor.html)
To say, a XOR is made of an AND and an OR, and therefore 11111 should equal 1 is also wrong. Using an AND and an OR is an essential part of creating a XOR, but the name and the intended function should make the design, not the other way around. In fact, v3 uses ANDs and an OR, but it doesn't make 11111=1.
Now in electronics, with a 3 input XOR when ALL inputs are ON, the output is ON. This contradicts my view of the XOR, but I think that electronics is doing it wrong. I must admit, I do not know a lot about electronics, but hear me out here. If I am right, and what electronics do is stacking the XOR like this:
A ⏋
B-├▷XOR▷-----├▷XOR▷ Output
C___________⏌
In that case, if electronics does it like that, I think electronics is doing it wrong. I am not saying it is not working, because apparently it works whatever they use it for, but I think the term Exclusively OR should not apply to that device simply because it contradicts the name of the machine since 111 = 1 while the rule should be, output is ON when exclusively a or exclusively b or exclusively c is ON (Exclusively being the key word here).
In conclusion, I made a cool expandable gate (with lots of help of Jeppe) and the meaning of the term XOR is more complicated than you might have thought. I will keep calling my gate a XOR, and you’re free not to! It is clear that both interpretations are widely used and while this interpretation is a little less popular does not mean it should be ignored, because it has a lot of reason to deserve the name ‘Exclusive OR’.
If you want to use this, feel free! The only thing I ask is that if you make a video about it, or publish it, just tell the viewer the expandable XOR was designed by me. If you need any help learning exactly how it put together, feel free to send me a message!
Whats next? I don't know, I think I'm done with the XORs for now. I'm gonna finish my calculator and then I think I want to learn how to build a CPU!
Sorry for the long post, here is a potato:
Hey guys I made something awesome the last couple of days. It’s an expandable XOR gate. So far I made a 2 input, a 5 input and a 10 input design for both of my version!
Originally I wanted to do this because I wanted my calculator to deactivate when no input, or too many inputs were given for A or B. I know now this could have been done simpler, but since then, the expandable XOR has become a project for me so I finished it!
So it started with examining this design for the normal XOR with 2 inputs.
LINK
Then when I learned how exactly it worked, I made this XOR with 3 inputs:
Then I took a step up and made a XOR with 4 inputs:
At this point I already knew this was not expandable. With each addition the amount of combinations I had to make went up like this:
x = combinations
n = amount of inputs
x = ( n2 – n) / 2
n – x
3 – 3
4 – 6
5 – 10
6 – 15
10 – 45
This meant that if I wanted to use all of those connections, it would get way too much really quickly, so I had to create an organized and expandable design where I could combine all pairs of inputs.
After a lot of trying, first horizontal, but soon moving over to diagonal since that solved some problems, I managed to do it. The version that I created is called Expandable XOR v1 (obviously because it is the first version of the expandable XOR). I should by now give a lot of credit to Jeppe. During the designing of the diagonal expandable XOR, he helped tremendously. Without him it wouldn’t have been possible.
This is the screenshot wherein all the expandable version I built are shown (including v2, which I will talk about in a sec)
The way it works is as following:
The inputs go down in north-south lines. The go down to the bottom by repeaters and then turn into east-west lines. By doing that, they form a grid. Within this grid, each pair of levers is combined at intersections. This is done as following:
Top line ▷ repeater-├Torch ▷ Redstone dust dot ▷ Torch ▷ ‘Group’
Bottom line ▷ torch⏌
However we could exclude combining levers that were the same (a-a, b-b, c-c, d-d, e-e etc). This was very convenient as it gave us room to make the top lines be able to change into the bottom lines without taking in space.
These pairs of levers are grouped on top in the following way (in a 5 input version):
Group 1
a-b
a-c
a-d
a-e
Group 2
b-a
b-c
b-d
b-e
Group 3
c-a
c-b
c-d
c-e
Group 4
d-a
d-b
d-c
d-e
Group 5
e-a
e-b
e-c
e-d
And those groups were then inverted, and together formed the output. This makes it work as following:
While writing this thread I realized that I have a-b AND b-a. This is not very useful, because it takes in double the space. The problem with the version was that I NEEDED both of them. If I would delete either of them, the machine would stop working because a-b is the point where A can turn the output on, while b-a is the point where B can turn the output on. I cant do it at both!
I needed to design a version where at a-b, A AND B could turn the output on, thereby roughly halfing the size of the entire thing!
So that's how I came to designing Expandable XOR v2, which is way smaller than v1 and less messy! I made v2 completely by myself. What I had to do is replace the intersections like a-b with individual XORs. The XOR design I used fore those points where that of Tomy. This meant I no longer needed a-b and b-a, just a-b! I also made a 10 input, a 5 input and a 2 input version of this version to compare the two. This would be nice, but then I found out it didn't work! After alot of thinking before I went to sleep I realized I shouldn't put XORs at the intersections. Instead I should put ANDs at the intersections and have a big OR for the inputs!
So how this works:
The OR gate is checking if 0 inputs are on. If 0 are on, it sets the output to off.
Then, if you put one lever on, the OR deactivates and the output can turn on. However if any other lever is now also turned on, one of the ANDs will activate and turn the output back off.
When I showed v2.1 to Decapo and Tuchi, with its ANDs and OR, we found a better way to do it. I finalized the design, making it more compact and even faster. The result is my absolute pride, Expandable XOR v3!!!
This is the pictures where you can see how it developed from v1 to v3:
Terminology Discussion
I have heard people disagreeing about the name, so I’ll explain why I’m near certain that this SHOULD be called a XOR gate.
DISCLAIMER: I am not an electrician or a computer programmer. I am not an expert at any of these things. This is just the explanation of my interpretation of why I think this should be called a XOR. You’re free to call it whatever you want!
Truthtable
00000=0
00001=1
00010=1
00011=0
00100=1
00101=0
00110=0
00111=0
01000=1
01001=0
01010=0
01011=0
01100=0
01101=0
01110=0
01111=0
10000=1
10001=0
10010=0
10011=0
10100=0
10101=0
10110=0
10111=0
11000=0
11001=0
11010=0
11011=0
11100=0
11101=0
11110=0
11111=0
The rule for this gate is:
If ONE input is ON, output is ON
If NO or MORE THAN ONE input is ON, output is OFF
XOR stand for Exclusively OR
Therefore one could phrase that this means:
If exclusively a or exclusively b or exclusively c or exclusively d or exclusively e is ON, output is ON (for 5bit)
To say that the rule for a XOR is that the output changes when an input changes is wrong, it is merely something that happens with a two input XOR, but has nothing to do with the term, Exclusively OR. You should create a rule from the name that already exists. The term, in my mind, clearly means that the output should only be on, if one, and only one, of the inputs is on. I am not the only one that thinks this, or at least acknowledges that this interpretation is well supported:
Logisim is a logic simulator which permits circuits to be designed and simulated using a graphical user interface, and when using multiple input XORs, it uses the rule: Output is 1, when a single input is 1
Advanced math blogs like this one discuss the different interpretations. (LINK: https://mindhunter74.wordpress.com/2011/...ting-gate/)
A published book from IEEE about logic functions also say that the rule for a XOR gate is: "Exclusive OR. One and only one input must be active to activate the output."
Even the computer science branch of the university of Hamburg has the information about the two different interpretations on their website. (LINK: https://tams.informatik.uni-hamburg.de/a...s/xor.html)
To say, a XOR is made of an AND and an OR, and therefore 11111 should equal 1 is also wrong. Using an AND and an OR is an essential part of creating a XOR, but the name and the intended function should make the design, not the other way around. In fact, v3 uses ANDs and an OR, but it doesn't make 11111=1.
Now in electronics, with a 3 input XOR when ALL inputs are ON, the output is ON. This contradicts my view of the XOR, but I think that electronics is doing it wrong. I must admit, I do not know a lot about electronics, but hear me out here. If I am right, and what electronics do is stacking the XOR like this:
A ⏋
B-├▷XOR▷-----├▷XOR▷ Output
C___________⏌
In that case, if electronics does it like that, I think electronics is doing it wrong. I am not saying it is not working, because apparently it works whatever they use it for, but I think the term Exclusively OR should not apply to that device simply because it contradicts the name of the machine since 111 = 1 while the rule should be, output is ON when exclusively a or exclusively b or exclusively c is ON (Exclusively being the key word here).
In conclusion, I made a cool expandable gate (with lots of help of Jeppe) and the meaning of the term XOR is more complicated than you might have thought. I will keep calling my gate a XOR, and you’re free not to! It is clear that both interpretations are widely used and while this interpretation is a little less popular does not mean it should be ignored, because it has a lot of reason to deserve the name ‘Exclusive OR’.
If you want to use this, feel free! The only thing I ask is that if you make a video about it, or publish it, just tell the viewer the expandable XOR was designed by me. If you need any help learning exactly how it put together, feel free to send me a message!
Whats next? I don't know, I think I'm done with the XORs for now. I'm gonna finish my calculator and then I think I want to learn how to build a CPU!
Sorry for the long post, here is a potato: