Silicon to Scripting 11

Now that we have many different 16 bit operations, we can make a generic way to apply an operation to two inputs.

Logic Unit

Given a way to select an operation (op0, op1), apply an operation to the two 16 bit inputs X, Y.

op1op0output
00X and Y
01X or Y
10X xor Y
11inv X

Since we know we need to do the and, or, xor, and inv operations, we can add those gates.

logic unit 1

Now we have 4 outlets but only 1 output. That means we need to use 3 select gates to select which operation to use. Looking at the truth table, when op0 is 0, the output should either be and or xor, and when it is 1, the output should be or or inv. The select component selects DO when s is 0, so we can connect and and xor to the two D0 inlets and connect op0 to s.

The same logic applies to the D1 inlets.

logic unit 2

Now that we have only two outlets to work with, we can use the final select to pick the correct one. When op1 is 0, it should select and or or, which is the right select. Same for the left select, when op1 is 1, it should select xor or inv.

logic unit 3

Using multiple selects like this to chose more than just two inlets will show up again, so try to understand it to the best of your ability.

part 12