Three-state logic
Encyclopedia
In digital electronics
three-state, tri-state, or 3-state logic
allows an output port to assume a high impedance
state in addition to the 0 and 1 logic level
s, effectively removing the output from the circuit. This allows multiple circuits to share the same output line or lines (such as a bus
).
Three-state outputs are implemented in many registers
, bus drivers, and flip-flop
s in the 7400
and 4000
series as well as in other types, but also internally in many integrated circuit
s. Other typical uses are internal and external buses in microprocessor
s, memories, and peripheral
s. Many devices are controlled by an active-low input called (Output Enable) which dictates whether the outputs should be held in a high-impedance state or drive their respective loads (to either 0- or 1-level).
The term tri-state should not be confused with ternary logic
(3-value logic).
Three-state buffers can also be used to implement efficient multiplexer
s, especially those with large numbers of inputs. In particular, they are essential to the operation of a shared electronic bus.
Three-state logic can reduce the number of wires needed to drive a set of LEDs (tristate multiplexing or Charlieplexing
).
The difference lies in the time needed to output the signal. When chip select is deasserted, the chip does not operate internally, and there will be a significant delay between providing an address and receiving the data. (An advantage of course, is that the chip consumes minimal power in this case.)
When chip select is asserted, the chip internally performs the access, and only the final output drivers are disabled by deasserting output enable. This can be done while the bus is in use for other purposes, and when output enable is finally asserted, the data will appear with minimal delay. A ROM or static RAM chip with an output enable line will typically list two access times: one from chip select asserted and address valid, and a second, shorter time beginning when output enable is asserted.
(usually with in the range of 1–100 kΩ) to influence the circuit when the output is tri-stated. For example, the I2C bus protocol (a bi-directional communication bus protocol often used between devices) specifies the use of pull-up resistors on the two communication lines. When devices are inactive, they "release" the communication lines and tri-state their outputs, thus removing their influence on the circuit. When all the devices on the bus have "released" the communication lines, the only influence on the circuit is the pull-up resistors, which pull the lines high. When a device wants to communicate, it comes out of the Hi-Z state and drives the line low. Devices communicating using this protocol either let the line float high, or drive it low – thus preventing any bus contention situation where one device drives a line high and another low.
The PCI local bus provides pull-up resistors, but they would require several clock cycles to pull a signal high given the bus's large distributed capacitance
. To enable high-speed operation, the protocol requires that every device connecting to the bus drive the important control signals high for at least one clock cycle before going to the Hi-Z state. This way, the pull-up resistors are only responsible for maintaining the bus signals in the face of leakage current.
(PCB), or sometimes between PCBs plugged into a common backplane
.
An open-collector bus is often used between PCBs plugged into a common backplane, or connected over longer cables.
Usage of three-state logic is not recommended for on-chip connections but rather for inter-chip connections. Basic multiplexers can be used on chip because they are implemented in silicon, unlike the large equivalent off-chip components.
Electronics
Electronics is the branch of science, engineering and technology that deals with electrical circuits involving active electrical components such as vacuum tubes, transistors, diodes and integrated circuits, and associated passive interconnection technologies...
three-state, tri-state, or 3-state logic
Logic gate
A logic gate is an idealized or physical device implementing a Boolean function, that is, it performs a logical operation on one or more logic inputs and produces a single logic output. Depending on the context, the term may refer to an ideal logic gate, one that has for instance zero rise time and...
allows an output port to assume a high impedance
High impedance
In electronics, high impedance means that a point in a circuit has a relatively high impedance to other points in the circuit.-Digital electronics:...
state in addition to the 0 and 1 logic level
Logic level
In digital circuits, a logic level is one of a finite number of states that a signal can have. Logic levels are usually represented by the voltage difference between the signal and ground , although other standards exist...
s, effectively removing the output from the circuit. This allows multiple circuits to share the same output line or lines (such as a bus
Computer bus
In computer architecture, a bus is a subsystem that transfers data between components inside a computer, or between computers.Early computer buses were literally parallel electrical wires with multiple connections, but the term is now used for any physical arrangement that provides the same...
).
Three-state outputs are implemented in many registers
Processor register
In computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...
, bus drivers, and flip-flop
Flip-flop (electronics)
In electronics, a flip-flop or latch is a circuit that has two stable states and can be used to store state information. The circuit can be made to change state by signals applied to one or more control inputs and will have one or two outputs. It is the basic storage element in sequential logic...
s in the 7400
7400 series
The 7400 series of transistor-transistor logic integrated circuits are historically important as the first widespread family of TTL integrated circuit logic. It was used to build the mini and mainframe computers of the 1960s and 1970s...
and 4000
4000 series
The 4000 series is a family of industry standard integrated circuits which implement a variety of logic functions using Complementary Metal–Oxide–Semiconductor technology, and are still in use today. They were introduced by RCA as CD4000 COS/MOS series in 1968, as a lower power and more versatile...
series as well as in other types, but also internally in many integrated circuit
Integrated circuit
An integrated circuit or monolithic integrated circuit is an electronic circuit manufactured by the patterned diffusion of trace elements into the surface of a thin substrate of semiconductor material...
s. Other typical uses are internal and external buses in microprocessor
Microprocessor
A microprocessor incorporates the functions of a computer's central processing unit on a single integrated circuit, or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and...
s, memories, and peripheral
Peripheral
A peripheral is a device attached to a host computer, but not part of it, and is more or less dependent on the host. It expands the host's capabilities, but does not form part of the core computer architecture....
s. Many devices are controlled by an active-low input called (Output Enable) which dictates whether the outputs should be held in a high-impedance state or drive their respective loads (to either 0- or 1-level).
The term tri-state should not be confused with ternary logic
Ternary logic
In logic, a three-valued logic is any of several many-valued logic systems in which there are three truth values indicating true, false and some indeterminate third value...
(3-value logic).
INPUT | OUTPUT | |
A | B | C |
0 | 1 | 0 |
1 | 1 | |
X | 0 | Z |
Uses
The whole concept of the third state (Hi-Z) is to effectively remove the device's influence from the rest of the circuit. If more than one device is electrically connected, putting an output into the Hi-Z state is often used to prevent short circuits, or one device driving high (logical 1) against another device driving low (logical 0).Three-state buffers can also be used to implement efficient multiplexer
Multiplexer
In electronics, a multiplexer is a device that selects one of several analog or digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the output...
s, especially those with large numbers of inputs. In particular, they are essential to the operation of a shared electronic bus.
Three-state logic can reduce the number of wires needed to drive a set of LEDs (tristate multiplexing or Charlieplexing
Charlieplexing
Charlieplexing is a technique proposed in early 1995 by Charlie Allen at Maxim Integrated Products for driving a multiplexed display in which relatively few I/O pins on a microcontroller are used to drive an array of LEDs. The method utilizes the tri-state logic capabilities of microcontrollers in...
).
Output enable vs. chip select
Many memory devices designed to connect to a bus (such as RAM and ROM chips) have both (chip select) and (output enable) pins, which superficially appear to do the same thing. If is not asserted, the outputs are high impedance.The difference lies in the time needed to output the signal. When chip select is deasserted, the chip does not operate internally, and there will be a significant delay between providing an address and receiving the data. (An advantage of course, is that the chip consumes minimal power in this case.)
When chip select is asserted, the chip internally performs the access, and only the final output drivers are disabled by deasserting output enable. This can be done while the bus is in use for other purposes, and when output enable is finally asserted, the data will appear with minimal delay. A ROM or static RAM chip with an output enable line will typically list two access times: one from chip select asserted and address valid, and a second, shorter time beginning when output enable is asserted.
Use of pull-ups and pull-downs
When outputs are tri-stated (in the Hi-Z state) their influence on the rest of the circuit is removed, and the circuit node will be "floating" if no other circuit element determines its state. Circuit designers will often use pull-up or pull-down resistorsPull-up resistor
Pull-up resistors are used in electronic logic circuits to ensure that inputs to logic systems settle at expected logic levels if external devices are disconnected or high-impedance...
(usually with in the range of 1–100 kΩ) to influence the circuit when the output is tri-stated. For example, the I2C bus protocol (a bi-directional communication bus protocol often used between devices) specifies the use of pull-up resistors on the two communication lines. When devices are inactive, they "release" the communication lines and tri-state their outputs, thus removing their influence on the circuit. When all the devices on the bus have "released" the communication lines, the only influence on the circuit is the pull-up resistors, which pull the lines high. When a device wants to communicate, it comes out of the Hi-Z state and drives the line low. Devices communicating using this protocol either let the line float high, or drive it low – thus preventing any bus contention situation where one device drives a line high and another low.
The PCI local bus provides pull-up resistors, but they would require several clock cycles to pull a signal high given the bus's large distributed capacitance
Capacitance
In electromagnetism and electronics, capacitance is the ability of a capacitor to store energy in an electric field. Capacitance is also a measure of the amount of electric potential energy stored for a given electric potential. A common form of energy storage device is a parallel-plate capacitor...
. To enable high-speed operation, the protocol requires that every device connecting to the bus drive the important control signals high for at least one clock cycle before going to the Hi-Z state. This way, the pull-up resistors are only responsible for maintaining the bus signals in the face of leakage current.
Alternatives to three-state bus
A three-state bus is typically used between chips on a single printed circuit boardPrinted circuit board
A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, tracks or signal traces etched from copper sheets laminated onto a non-conductive substrate. It is also referred to as printed wiring board or etched wiring...
(PCB), or sometimes between PCBs plugged into a common backplane
Backplane
A backplane is a group of connectors connected in parallel with each other, so that each pin of each connector is linked to the same relative pin of all the other connectors forming a computer bus. It is used as a backbone to connect several printed circuit boards together to make up a complete...
.
An open-collector bus is often used between PCBs plugged into a common backplane, or connected over longer cables.
Usage of three-state logic is not recommended for on-chip connections but rather for inter-chip connections. Basic multiplexers can be used on chip because they are implemented in silicon, unlike the large equivalent off-chip components.