Silicon to Scripting 3

Invert

Looking at the NAND truth table

ABOutput
FFT
TFT
FTT
TTF

we can try to reduce it into the INV truth table.

AOutput
FT
TF

If we look at the first and last row of the NAND table, it looks similar to the INV one, we just need to duplicate the input, which we can do.

invert solution

And

Looking at the NAND and AND truth tables next to each other:

ABNANDAND
FFTF
TFTF
FTTF
TTFT

we can see that when NAND is true, AND is false, and vice versa. We can simply invert the output of NAND with an INV.

and solution

Or

Looking at the truth table for OR, we can see that instead of the 3-1 pattern on the output, it is a 1-3 pattern.

ABOutput
FFF
FTT
TFT
TTT

We can’t just invert the output. instead we can invert the inputs of a NAND to turn it into a 3-1 pattern. Conveniently, this is the solution.

or solution

Xor

Moving onto XOR, it looks very similar to OR, except when both inputs are true, it outputs false.

ABOutput
FFF
FTT
TFT
TTF

We can start with an OR, and then try and find some component to AND with the output of.

xor 1

We need something that outputs false when both inputs are on: NAND.

xor 2

part 4