Close

Two Input Gates

A project log for Ternary Computing Menagerie

A place for documenting the many algorithms, data types, logic diagrams, etc. that would be necessary for the design of a ternary processor.

mechanical-advantageMechanical Advantage 04/17/2019 at 07:370 Comments

Before getting into the ternary 2-input gates, it is useful to review the binary 2-input gates for comparison. Binary 2-input gates have two inputs, each of which have two possible states, and have an output with two possible states. This means that there are 2^2=4 possible input conditions and 2^1=2 possible output conditions for a total of 2^4=16 possible gates. These gates are:

Boolean Two-Input Gates

The six gates with all upper-case names are sometimes called the "named gates" and are generally the only ones used in circuit design along with the single input NOT gate (binary inverter).

Six of these "gates" aren't really gates at all: Constant 0, Constant 1, A, B, Not A, Not B. Constant 0 and Constant 1 are just a value with no modification. A and B are just the A or B input itself without any modification. Not A and Not B are the same as a single-input inverter placed on the wire in question. These six gates don't actually have any logical value as two-input gates.

The six gates with a star are universal gates, meaning that all other gates can be created using combinations of just the one type of gate. You may read in some places that the NAND and NOR gates are the only universal binary gates but this is not strictly true. NAND and NOR are the only ones that are in general use but the two "A AND/OR Not B gates" and the two "B AND/OR Not A gates" are also universal. However, they can be created using one of the other "named gates" and one or more inverters. It's much easier to just ignore them and only use the named gates and inverters.

The above data are enough to form the basis of all binary logic circuits. The amazing thing is that this is a small enough data set to keep in your head, but is powerful enough to build any circuit of any complexity that doesn't require memory (more on that in a later post).

This is not the case with ternary 2-input gates. With these, each gate has 3^2=9 possible input conditions and 3^1=3 possible output conditions for a total of 3^9=19,683 possible gates. These gates are... just kidding, I'm not going to list them all. The scope of the data set is large enough that just talking about it requires the standardization of some vocabulary and a consistent way of representing the gates.

First, I represent a truth table like so:

Generic Ternary Truth Table

The input labeled A can be -, 0, or +. The same goes for input B. The output is whichever of the nine x's matches the inputs. If A is + and B is -, then the bottom left result is the output. As with the names of the single-input gates, I have borrowed this format from Dr. Douglas Jones from the University of Iowa.

Here is a real example of a Min gate (minimum gate) which computes the lesser of the two inputs.

Min (Minimum) Gate

Easy!

Naming gates also needs some attention. First, I devised a way of giving each of the 19 bazillion gates its own unique name without overlap or having to memorize much of anything. You take the output box of nine values and divide it up into 3 rows. Each row now has a pattern of three trits. As detailed in my earlier post on single-input gates, each of the 27 possible sets of three trits has a unique letter or number assigned to it using the heptavintimal (base-27) number system. Thus each two-input gate has a generic name consisting of exactly three letters and/or numbers. The Min gate above has the following horizontal patterns from top to bottom:

Min Gate Patterns

Therefore the generic name for a Min gate is a 0CP gate. This way you only need to memorize or have a reference table of 27 different symbols in order to uniquely identify the 19,683 different gates.

Of course some gates will be used far more often than others and it is convenient to have colloquial names for those. In this case, unlike boolean gates, I have adopted using first letter capitalization instead of all letters capitalized. This is to avoid confusion between a generic name and a colloquial name. For instance, there is a common gate called the Max gate which is the opposite of the Min gate. It calculate the largest of the two inputs. However, M, A, and X are all valid heptavintimal values, meaning that MAX is a valid generic gate name. To avoid confusion, generic names are all-caps and colloquial ones are first-letter capitalized only. I expect that over time, more gates will gain de-facto "official" names which is just fine. I simply wanted to ensure there was a way to keep it all from getting mixed up.

Let's get a few obvious things out of the way. Several gates have no logical value. Examples are the three gates that always output the same value and the two gates that alway output one of the two inputs.

As for universal gates, there are 3,773 of them. Thanks to the good people at http://twistedoakstudios.com/blog/Post7878_exploring-universal-ternary-gates for figuring that out so I didn't have to! With over 19,000 gates to choose from and almost 4,000 of the universal, there is a wealth of options for any need.

Finally, a word on logic diagrams. It is obviously not worth it to try to come up with special symbols for each gate because nobody would ever be able to tell them apart. Instead, I favor a simple box with the name of the gate inside. If it is using a generic name, the all-caps letters would go from top to bottom. If it is a colloquial name, the letters would go from left to right and only the first letter would be capitalized. That would help keep them from getting confused while also reinforcing the top row, middle row, bottom row sequence of generic naming.

Discussions