Tri-state input to three logic states

I'm looking for an IC or small circuit that implements the following truth table:

Input Output 1 Output 2
H H L
L L H
Z H H

Is this possible?

The purpose is to keep an SPI SS signal pulled high for two devices when the input is high-Z, and to otherwise select one of two devices. It would be possible to simply use an inverter but then one of the SS signals would always be active.

• High-Z is a state of an output. An output is high-Z when both the output transistor to GND as well as the transistor to VCC are not conducting. You have to add a voltage divider of two resistors to set a certain voltage for the high-Z state. If the L-voltage is about 0 V and H-voltage about 3 V, the Z-voltage should be about 1.5 V using two equal resistors for the voltage divider.
– Uwe
Commented Jan 22 at 9:17
• It should be possible. However, I believe you have an X-Y problem, and are trying to solve problem X with Y but are asking how to implement Y. If you would ask what is the best way to solve your original problem X, there might be better solutions than trying to do it via Y. Please define your original problem of using SPI chips in your system. Commented Jan 22 at 10:43
• What propagation delay is allowed? 5 V logic or 3.3 V logic?
– Jens
Commented Jan 22 at 21:52

If there's nothing else connected to the line, a circuit like this will do:

simulate this circuit – Schematic created using CircuitLab

Run simulation to see how it behaves.

Note that comparators are required, because the logic levels are non-standard. A simpler transistor-based version could be used, but probably takes as many or more components, even if resistor packs are considered.

If IN is not allowed to float (something else is pulling on it), or must meet valid logic threshold voltage otherwise (because other CMOS/TTL inputs are connected), another solution is required, or no solution may be possible.

I am assuming the tristate pin is available in isolation by itself.

• Compared to the truth table in the question, I believe the OUT1 and OUT2 labels are reversed. Commented Jan 22 at 19:33