Find function from truth table
How to use the minifier
| A | B | C | D | f(A,B,C,D) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | x |
| 1 | 1 | 1 | 0 | x |
| 1 | 1 | 1 | 1 | x |
Type in the output values for the function as a binary number. The given truth table would be entered as xxx0011011001100. (The x'es are don't cares.)
How to interpret a generated boolean function.
First, you must be familiar with logical operations AND(∧), OR(∨), NOT(¬), XOR(⊕), XNOR(⨀).
There are two kinds of XOR used in this app. One is the "parity function" XOR, which will be used without the gate in Terraria, and is implied in the result by writing inputs right after eachother. The other is the "Turns on when exactly one lamp is active" XOR, which means that you have to use that gate in the game, denoted by ⊕.
Using the function generated from the example table, we get "¬c ⊕ ¬ac ⊕ ¬cd ⊕ acd"
Here's how this function translates into Terraria
¬c ⊕ ¬ac ⊕ ¬cd ⊕ acd
The operation connecting the terms show which logic gate to use ingame.
The terms show which inputs connect to a single logic gate lamp.
The negation sign in front of a term means that the gate lamp should be in an "ON" state
Not all functions can be expressed with a single logic gate. In these cases, the app will list functions in two columns. choose one from each column, create the two gates ingame, and combine their outputs with a common wire.
(November 2023 update) This version now lists all equivalent functions!
When making multi-output modules, the first result rarely has no wire routing issues. This is why the app now lists all equivalent functions, so you can choose the one that works best for you.