Difference between revisions of "Carsten Milkau/NOT Gate"
From Unofficial Stationeers Wiki
< User:Carsten Milkau
(Created page with "= NOT Gate = A NOT gate, sometimes also called ''inverter'', is a circuit that outputs the value that was not input. It has a single input and output, and each can only take...") |
(→Implementation) |
||
(8 intermediate revisions by one other user not shown) | |||
Line 8: | Line 8: | ||
|+ value table | |+ value table | ||
|- | |- | ||
− | ! | + | !'''inputs''' || '''outputs''' |
+ | |- | ||
+ | !x || y | ||
|- | |- | ||
|0||1 | |0||1 | ||
Line 17: | Line 19: | ||
=== Connectors === | === Connectors === | ||
− | * Input: one of two values (0 or 1) | + | * Input x: one of two values (0 or 1) |
− | * Output: the other of the two values | + | * Output y: the other of the two values |
== Implementation == | == Implementation == | ||
− | NOT gates can often be avoided by modifying the circuit. For instance, | + | NOT gates can often be avoided by modifying the circuit. For instance, an [[User:Carsten Milkau/OR Gate|OR Gate]] with two NOT gates connected to its inputs and outputs can always be replaced by an AND gate with just one NOT gate connected. |
− | + | === Single Block === | |
+ | |||
+ | [[File:CompareUnit.png|thumb]] | ||
+ | |||
+ | Use the Gate Unit, set it to Nor and both inputs to the same Logic Reader. | ||
=== Using A Less-Than Comparator === | === Using A Less-Than Comparator === | ||
+ | |||
+ | [[File:CompareUnit.png|thumb]] | ||
+ | |||
+ | If you have a circuit available (e.g. a constant memory) that has a value ''b'' known to stay between 0 and 1 (but not 0), you can turn a [[Kit (Logic Processor)#Compare Unit|Compare Unit]] into a logic NOT gate by comparing the input ''x'' to ''b'', i.e. | ||
+ | |||
+ | <pre>y = (x < b)</pre> | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ circuit setup | ||
+ | |- | ||
+ | ! unit || unit type || connector/setting || source / value | ||
+ | |- | ||
+ | |compare 1 || Compare Unit || Input 1 || x '''(input)''' | ||
+ | |- | ||
+ | | || || Input 2 || ''b'' (constant or bounded value) | ||
+ | |- | ||
+ | | || || Operation Selector || Lesser | ||
+ | |- | ||
+ | | || || Output || y '''(output)''' | ||
+ | |} | ||
+ | |||
=== Using An Equality Comparator === | === Using An Equality Comparator === | ||
+ | |||
+ | [[File:CompareUnit.png|thumb]] | ||
+ | |||
+ | If you have a circuit output available that is known to be zero when the NOT gate is used (e.g. a constant memory), you can turn a [[Kit (Logic Processor)#Compare Unit|Compare Unit]] into a logic NOT gate by comparing the input ''x'' to ''0'', i.e. | ||
+ | |||
+ | <pre>y = (x = 0)</pre> | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ circuit setup | ||
+ | |- | ||
+ | ! unit || unit type || connector/setting || source / value | ||
+ | |- | ||
+ | |compare 1 || Compare Unit || Input 1 || x '''(input)''' | ||
+ | |- | ||
+ | | || || Input 2 || 0 (constant) | ||
+ | |- | ||
+ | | || || Operation Selector || Equals | ||
+ | |- | ||
+ | | || || Output || y '''(output)''' | ||
+ | |} | ||
+ | |||
=== Using Subtraction === | === Using Subtraction === | ||
+ | |||
+ | [[File:MathUnit.png|thumb]] | ||
+ | |||
+ | If you do not use 0 and 1 as the two possible input values of the inverter, you can use subtraction for implementation. In this case, you need a constant that is exactly the mean of the two input values, i.e. | ||
+ | |||
+ | <pre>y = (m - x)</pre> | ||
+ | |||
+ | where m = (a + b)/2 is the mean of the two allowed input values, (called ''a'' and ''b'' here). | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ Circuit setup | ||
+ | |- | ||
+ | ! unit || unit type || connector/setting || source/value | ||
+ | |- | ||
+ | | math 1 || [[Kit (Logic Processor)#Math Unit|Math Unit]] || Input 1 || x '''(input)''' | ||
+ | |- | ||
+ | | || || Input 2 || m (constant, see above) | ||
+ | |- | ||
+ | | || || Operation || Subtract | ||
+ | |- | ||
+ | | || || Output || y '''(output)''' | ||
+ | |} |
Latest revision as of 22:00, 14 July 2023
Contents
NOT Gate[edit]
A NOT gate, sometimes also called inverter, is a circuit that outputs the value that was not input. It has a single input and output, and each can only take one of two pre-defined values (typically 0 and 1). Whatever the input value is selected, the output value will be the other of the two.
Definition[edit]
inputs | outputs |
---|---|
x | y |
0 | 1 |
1 | 0 |
Connectors[edit]
- Input x: one of two values (0 or 1)
- Output y: the other of the two values
Implementation[edit]
NOT gates can often be avoided by modifying the circuit. For instance, an OR Gate with two NOT gates connected to its inputs and outputs can always be replaced by an AND gate with just one NOT gate connected.
Single Block[edit]
Use the Gate Unit, set it to Nor and both inputs to the same Logic Reader.
Using A Less-Than Comparator[edit]
If you have a circuit available (e.g. a constant memory) that has a value b known to stay between 0 and 1 (but not 0), you can turn a Compare Unit into a logic NOT gate by comparing the input x to b, i.e.
y = (x < b)
unit | unit type | connector/setting | source / value |
---|---|---|---|
compare 1 | Compare Unit | Input 1 | x (input) |
Input 2 | b (constant or bounded value) | ||
Operation Selector | Lesser | ||
Output | y (output) |
Using An Equality Comparator[edit]
If you have a circuit output available that is known to be zero when the NOT gate is used (e.g. a constant memory), you can turn a Compare Unit into a logic NOT gate by comparing the input x to 0, i.e.
y = (x = 0)
unit | unit type | connector/setting | source / value |
---|---|---|---|
compare 1 | Compare Unit | Input 1 | x (input) |
Input 2 | 0 (constant) | ||
Operation Selector | Equals | ||
Output | y (output) |
Using Subtraction[edit]
If you do not use 0 and 1 as the two possible input values of the inverter, you can use subtraction for implementation. In this case, you need a constant that is exactly the mean of the two input values, i.e.
y = (m - x)
where m = (a + b)/2 is the mean of the two allowed input values, (called a and b here).
unit | unit type | connector/setting | source/value |
---|---|---|---|
math 1 | Math Unit | Input 1 | x (input) |
Input 2 | m (constant, see above) | ||
Operation | Subtract | ||
Output | y (output) |