AND gate that uses trinary logic

Thread Starter

Futurist

Joined Apr 8, 2025
721
I'm curious how one would build a two input AND gate where the inputs and outputs can be 0, 1 or 2 (as opposed to just 0 and 1). The truth table is easy enough but using actual real world MOSFETs how would one design the circuit for this?

1764527673498.png
 

Ian0

Joined Aug 7, 2020
13,097
How were you thinking of representing 0,1 and 2 in terms of voltage?
In the analogue domain, it's just two diodes so that the output is whichever is the lowest voltage.
 

Thread Starter

Futurist

Joined Apr 8, 2025
721
How were you thinking of representing 0,1 and 2 in terms of voltage?
Don't care (do I?) but I'd expect it to be balanced, so 0v, 5v and 10v ?

Perhaps one could just combine some standard conventional CD4000 series gates and build it that way? stack them? -ve supply of the "top" gates going to the +ve supply of the "bottom" gates - in some way...
 
Last edited:

Ian0

Joined Aug 7, 2020
13,097
In its simplest form, something like this:
Screenshot from 2025-11-30 18-59-02.png. . .but it has a few problems, which could be solved by cleverer circuitry:
The supply voltage would have to be higher than the highest output voltage.
(And for an OR gate, it would need a supply lower than the lowest logic voltage)
Probably R1 would be better as a constant current source.
There's nothing to force the output to be one of the "official" logic voltages.
Logic voltages would have to be chosen so that base-emitter junctions didn't zener.
 

Thread Starter

Futurist

Joined Apr 8, 2025
721
In its simplest form, something like this:
View attachment 359758. . .but it has a few problems, which could be solved by cleverer circuitry:
The supply voltage would have to be higher than the highest output voltage.
(And for an OR gate, it would need a supply lower than the lowest logic voltage)
Probably R1 would be better as a constant current source.
There's nothing to force the output to be one of the "official" logic voltages.
Logic voltages would have to be chosen so that base-emitter junctions didn't zener.
Thanks, that's interesting, is that simulatable?
 

Ian0

Joined Aug 7, 2020
13,097
Thanks, that's interesting, is that simulatable?
You could make it with real transistors!
How would a 3-level AND gate translate into boolean algebra?
In C it would be output = (input1<input2)?input1:input2; where all variables are limited to 0,1 and 2.
 

eetech00

Joined Jun 8, 2013
4,704
Don't care (do I?) but I'd expect it to be balanced, so 0v, 5v and 10v ?

Perhaps one could just combine some standard conventional CD4000 series gates and build it that way? stack them? -ve supply of the "top" gates going to the +ve supply of the "bottom" gates - in some way...
Use comparators for 5v or 10v inputs with open collector outputs (or open drain) pulled up for the output logic level voltage of your choice. Then use AND logic devices to match the logic levels.
 

MisterBill2

Joined Jan 23, 2018
27,164
The closest I can come is a multiple input diode NAND gate, for which the output is lo only if all the inputs are low. Which for the requested function will require inverters on both inputs and the output.
 

boostbuck

Joined Oct 5, 2017
1,033
Your question is really an issue of definition. Given you wish to make decisions (AND/OR) about a tri-state input, how would you like to represent the three states?

Once you have decided on your representation (V1,V2,V3 or +V,0V,-V whatever) the circuit is not necessarily difficult. The complexity of the required circuit for each will help determine your choice of solution.
 

WBahn

Joined Mar 31, 2012
32,703
I'm curious how one would build a two input AND gate where the inputs and outputs can be 0, 1 or 2 (as opposed to just 0 and 1). The truth table is easy enough but using actual real world MOSFETs how would one design the circuit for this?

View attachment 359757
I don't know that the truth table is all that easy enough. It depends on what the definition of AND is for your three-state logic.

AND is traditionally defined according to the conventional meaning in human language -- it is TRUE if and only if both of the inputs are TRUE. This definition, for binary logic, is independent of the representation of each variable. For instance, associating '1' or 'HI' (typically meaning a higher signal value than 'LO') with 'TRUE', while the most common, is not required. This choice is called the positive-logic convention. There is also the negative-logic convention in which a '0' or 'LO' value is considered to be 'TRUE'.

For binary logic, this results in a positive-logic AND function also being a negative-logic OR function, and vice-versa. This is known as the duality of Boolean logic.

If you want to extend a binary logic system to a trinary one, you need to make a number of decisions. First, in binary logic, one of your two values represents FALSE and the other TRUE. Something that is NOT(FALSE) is TRUE and something that is NOT(TRUE) is FALSE.

What is the corresponding meaning in your trinary system? Do two of the values represent TRUE and FALSE and, if so, what does the third mean? MAYBE? UNKNOWN?

Do you have a unary operator in your trinary system, similar to NOT() in a binary system, and, if so, how does it behave for each of the three possible inputs? Are these consistent with the interpretations of the three logic values already established? While NOT(TRUE) and NOT(FALSE) have clear meanings, what would NOT(MAYBE) or NOT(UNKNOWN) mean? The first would imply that if something is not a maybe, then it must be a definite, but is that a TRUE or a FALSE. The same with UNKNOWN, but here you can interpret NOT(UNKNOWN) as meaning that it is, literally, not unknown and, therefore, is known. Or, you can interpret it as meaning that something that was unknown before is still unknown if we negate it. Either definition is defensible, but you you have to decide.

That, then, has to be extended to your definitions for AND and OR (and any other operators you define). Your definition seems to say that AND(A,B) is equal to MIN(A,B). How does this translate into the traditional meaning of AND? In other words, is AND even a meaningful name for this operator, or should it be called something else (such as MIN).

What about your OR operator? Is it effectively the MAX operator?

Does your trinary system respect duality between positive and negative logic? If so, what does that mean? If not, is that an issue?

What are the identities that follow from your operator definitions?
 

AnalogKid

Joined Aug 1, 2013
12,043
As with RTL, DTL, ECL, TTL, CMOS, and just about every other logic family, each logical state has an input voltage *range*. These ranges define the transition levels and deadbands between states. What are yours?

ak
 

Thread Starter

Futurist

Joined Apr 8, 2025
721
I don't know that the truth table is all that easy enough. It depends on what the definition of AND is for your three-state logic.

AND is traditionally defined according to the conventional meaning in human language -- it is TRUE if and only if both of the inputs are TRUE. This definition, for binary logic, is independent of the representation of each variable. For instance, associating '1' or 'HI' (typically meaning a higher signal value than 'LO') with 'TRUE', while the most common, is not required. This choice is called the positive-logic convention. There is also the negative-logic convention in which a '0' or 'LO' value is considered to be 'TRUE'.

For binary logic, this results in a positive-logic AND function also being a negative-logic OR function, and vice-versa. This is known as the duality of Boolean logic.

If you want to extend a binary logic system to a trinary one, you need to make a number of decisions. First, in binary logic, one of your two values represents FALSE and the other TRUE. Something that is NOT(FALSE) is TRUE and something that is NOT(TRUE) is FALSE.

What is the corresponding meaning in your trinary system? Do two of the values represent TRUE and FALSE and, if so, what does the third mean? MAYBE? UNKNOWN?

Do you have a unary operator in your trinary system, similar to NOT() in a binary system, and, if so, how does it behave for each of the three possible inputs? Are these consistent with the interpretations of the three logic values already established? While NOT(TRUE) and NOT(FALSE) have clear meanings, what would NOT(MAYBE) or NOT(UNKNOWN) mean? The first would imply that if something is not a maybe, then it must be a definite, but is that a TRUE or a FALSE. The same with UNKNOWN, but here you can interpret NOT(UNKNOWN) as meaning that it is, literally, not unknown and, therefore, is known. Or, you can interpret it as meaning that something that was unknown before is still unknown if we negate it. Either definition is defensible, but you you have to decide.

That, then, has to be extended to your definitions for AND and OR (and any other operators you define). Your definition seems to say that AND(A,B) is equal to MIN(A,B). How does this translate into the traditional meaning of AND? In other words, is AND even a meaningful name for this operator, or should it be called something else (such as MIN).

What about your OR operator? Is it effectively the MAX operator?

Does your trinary system respect duality between positive and negative logic? If so, what does that mean? If not, is that an issue?

What are the identities that follow from your operator definitions?
Fair points, it was just a curiosity, then I stumbled upon this just now

https://homepage.cs.uiowa.edu/~dwjones/ternary/
 

MisterBill2

Joined Jan 23, 2018
27,164
After looking at the last few posts I seriously question the benefit of any new system. Binary seems quite adequate for digital electronic modes, and the current decimal scheme seems to be quite adequate for humans.
I leave the discussion to others.
 

Ian0

Joined Aug 7, 2020
13,097
Isn’t the whole point of Boolean algebra that there are only two possible outcomes - true or false? George Boole was trying to prove or disprove using logic the existence of pure evil, and the answer “maybe” wouldn’t have been satisfactory!
 

WBahn

Joined Mar 31, 2012
32,703
Isn’t the whole point of Boolean algebra that there are only two possible outcomes - true or false? George Boole was trying to prove or disprove using logic the existence of pure evil, and the answer “maybe” wouldn’t have been satisfactory!
For classic Boolean logic, that's correct. But almost immediately, people began trying to generalize the concepts of Boolean logic to multi-valued logic systems. Lots of cans of worms get opened up in the process.
 

Thread Starter

Futurist

Joined Apr 8, 2025
721
Isn’t the whole point of Boolean algebra that there are only two possible outcomes - true or false? George Boole was trying to prove or disprove using logic the existence of pure evil, and the answer “maybe” wouldn’t have been satisfactory!
Well we're really talking about a base 3 number system, and how one might build digital systems with such a thing. An adder for example would need to be made out of some kind of gates so we'd need appropriate gates. The thing just caught my imagination but that "manifesto" I posted is interesting, some Prof worked out a whole scheme (somewhat tongue in cheek, but he still did a serious job).

He argued that there might be a benefit in terms of the number of connections and wires, that could be reduced, albeit with an increased transistor count.

8 (binary) wires can represent 256 states, but "trinary" means 6 wires could represent 729 states.
 

MisterBill2

Joined Jan 23, 2018
27,164
I have returned.
I suggest trying to create one of the early digital modules with the base-3 logic. That would be a two digit adder. OR, much more challenging, a FOUR digit adder. An adder was the first example in the first logic training book I ever studied. And if a system can't produce an adder then it probably probably has a serious limitation.
 

Thread Starter

Futurist

Joined Apr 8, 2025
721
I have returned.
I suggest trying to create one of the early digital modules with the base-3 logic. That would be a two digit adder. OR, much more challenging, a FOUR digit adder. An adder was the first example in the first logic training book I ever studied. And if a system can't produce an adder then it probably probably has a serious limitation.
What's a "digit"? not being facetious, just getting clarity.
 

MisterBill2

Joined Jan 23, 2018
27,164
In the original textbook that i read to understand basic digital logic, a "digit" was a single numerical character, such as our numbers commonly used in the decimal number system. It would be one of the standard "hex" characters showing the value in the base 16 number system. (Example) A "two digit adder" would produce the binary representation of 2+3=5 in a binary format: 0100 + 0010 =1010


I am assumed that it was obvious. I used the word in it's classically recognized dictionary meaning..
 
Last edited:
Top