Functions: Boolean Logic Gates
Using lazy points to hold binary values, we can build layouts to operate as Boolean logic gates.
These circuits are built as functions. They are added to computer layouts in a similar manner as previous function circuits. No circuit alters the value of A or B, the points are inputs and so are 'read' only. They can though be linked vertically to other functions or gates.
The train enters on the right and proceeds to the left. It returns back along the same track for logic 0 (false), or exits the function (output) on the left for logic 1 (true).
AND gate
Output if both A and B are 1, else return along the same track ... or ...
Return if either A or B is 0, else output.
The 'AND' gate is a vertical reflection of a 'NOR' gate layout.
B |
A |
AND |
0
0
1
1 |
0
1
0
1 |
0
0
0
1 |
|
AND gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
OR gate
Output if either A or B is 1, else return along the same track ... or ...
Return if both A and B are 0, else output.
The 'OR' gate is a vertical reflection of a 'NAND' gate layout.
B |
A |
OR |
0
0
1
1 |
0
1
0
1 |
0
1
1
1 |
|
OR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
NAND gate
Output if either A or B is 0, else return along the same track ... or ...
Return if both A and B are 1, else output.
B |
A |
NAND |
0
0
1
1 |
0
1
0
1 |
1
1
1
0 |
|
NAND gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
NOR gate
Output if both A and B are 0, else return along the same track ... or ...
Return if either A or B is 1, else output.
B |
A |
NOR |
0
0
1
1 |
0
1
0
1 |
1
0
0
0 |
|
NOR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
XOR gate (exclusive OR)
Output if A and B are different, else return along the same track ... or ...
Return if A and B are the same, else output.
A double linked point is required for Boolean B. The central lazy point only serves to combine tracks and so its position is not labelled.
B |
A |
XOR |
0
0
1
1 |
0
1
0
1 |
0
1
1
0 |
|
XOR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
XNOR gate (exclusive NOR)
Output if A and B are the same, else return along the same track ... or ...
Return if A and B are different, else output.
A double linked point is required for Boolean B. The central lazy point only serves to combine tracks and so its position is not labelled.
B |
A |
XNOR |
0
0
1
1 |
0
1
0
1 |
1
0
0
1 |
|
XNOR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
Not gate
Output if A is 0, else return along the same track ... or ...
Return if A is 1, else output.
|
Not gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
Multi input gates
You can see from the track layouts that the AND and NOR gates are easily extended to 3 or more inputs.
AND gates
The multi input AND gate can be used to check that every data bit is a 1.
C |
B |
A |
AND |
0
0
0
0
1
1
1
1 |
0
0
1
1
0
0
1
1 |
0
1
0
1
0
1
0
1 |
0
0
0
0
0
0
0
1 |
|
3 input AND gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
NOR gates
The multi input NOR gate can be used to check that every data bit in a register is 0 (return if register is not 0).
C |
B |
A |
NOR |
0
0
0
0
1
1
1
1 |
0
0
1
1
0
0
1
1 |
0
1
0
1
0
1
0
1 |
1
0
0
0
0
0
0
0 |
|
3 input NOR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
Other gates are not so easy. One solution is to deMux the inputs and then join similar 0 or 1 outputs.
3 input XOR gate
C |
B |
A |
XOR |
0
0
0
0
1
1
1
1 |
0
0
1
1
0
0
1
1 |
0
1
0
1
0
1
0
1 |
0
1
1
0
1
0
0
1 |
|
3 input XOR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |
3 input XNOR gate
The XNOR gate is an XOR gate with the 0 and 1 outputs swopped over. It is also shown in a slightly more compact layout than the XOR gate above.
C |
B |
A |
XNOR |
0
0
0
0
1
1
1
1 |
0
0
1
1
0
0
1
1 |
0
1
0
1
0
1
0
1 |
1
0
0
1
0
1
1
0 |
|
3 input XNOR gate
|
|
Click layout to pause/run train |
Click points to switch 0/1 |
Click start circle to reset train/points |