ArticleslgStudy

computer science

Three-state logic

Three-state logic is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Three-state logic rather than just read about it. In short: In digital electronics, a tri-state or three-state buffer is a type of digital buffer that has three stable states: a high voltage output state (logical 1), a low output state (logical 0), and a high-impedance (Hi-Z) state. In the Hi-Z state, the output of the buffer is effectively disconnected from the subsequent circuit.

Three-state logic — main illustration
Three-state logic — illustration

Key takeaways

  • Three-state logic belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Three-state logic to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Three-state logic from memory before moving on to harder problems.

Reference excerpt

In digital electronics, a tri-state or three-state buffer is a type of digital buffer that has three stable states: a high voltage output state (logical 1), a low output state (logical 0), and a high-impedance (Hi-Z) state. In the Hi-Z state, the output of the buffer is effectively disconnected from the subsequent circuit. Tri-state buffers are commonly used in bus-based systems where multiple devices are connected to the same shared bus, because the Hi-Z state allows other devices to drive the bus without interference from the tri-state buffer. For example, in a computer system, multiple devices such as the CPU, memory, and peripherals may be connected to the same data bus. To ensure that only one device can transmit data on the bus at a time, each device is equipped with a tri-state buffer. When a device wants to transmit data, it activates its tri-state buffer, which connects its output to the bus and allows it to transmit data. When the transmission is complete, the device deactivates its tri-state buffer, which disconnects its output from the bus and allows another device to access the bus. Tri-state buffers are also useful for reducing crosstalk and noise on a bus. Tri-state output can be incorporated into various logic gates, flip-flops, microcontrollers, or other digital logic circuits.

Operation A tri-state buffer behaves either like an open switch (i.e. presenting a Hi-Z output) when the enable signal B is off or as a regular non-inverting buffer (which duplicates and boosts the input onto the output) when the enable signal is on:

Unlike a simple transmission gate, a tri-state buffer when enabled additionally provides voltage level restoration to boost the input to be well within its valid logic voltage range. A tri-state buffer's behavior is given by the following truth table:

Alternatively, inverting tri-state buffers when enabled will invert the input A.

Uses The Hi-Z state's purpose is to effectively remove a device's influence from the rest of the circuit. If multiple devices output to a shared wire, no device should drive the shared wire to one logical voltage level when another device drives the shared wire to another logical voltage level, since that competition would result in excessive current draw through the short circuit and an uncertain voltage level. Three-state devices on many shared electronic buses present a Hi-Z output when not actively communicating, so that shared wires are available to be driven. For example, in a Serial Peripheral Interface bus in multidrop configuration, only a single peripheral chip at a time may be selected using its CS (chip select), while all other peripheral chips present a Hi-Z output to avoid corrupting the data sent by the one selected chip. Three-state buses are typically used between chips on a single printed circuit board (PCB), or sometimes between PCBs plugged into a common backplane. Three-state buffers can also be used to implement efficient multiplexers, especially those with large numbers of inputs. Tri-state multiplexing, also known as Charlieplexing, is used to reduce the number of wires needed to drive a set of light-emitting diodes.

Output enable vs. chip select Many memory devices designed to connect to a bus (such as RAM and ROM chips) have both CS and OE (output enable) pins, which superficially appear to do the same thing. If CS is not asserted, the outputs are Hi-Z. 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 resistors (usually within the range of 1–100 kΩ) to influence the circuit when the output is tri-stated. 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. Intel refers to this convention as "sustained tri-state", and also uses it in the Low Pin Count bus.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Three-state logic

Start with the simplest possible case. Write down what Three-state logic claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Three-state logic before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Three-state logic ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Three-state logic

In research
Three-state logic appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Three-state logic in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Three-state logic is common in secondary-school and first-year university syllabi. It links to neighbouring topics Digital electronics, Ternary computers, so understanding it makes those chapters shorter.
In everyday life
Look for Three-state logic outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Three-state logic in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Three-state logic means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Three-state logic out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Three-state logic in simple terms?

In digital electronics, a tri-state or three-state buffer is a type of digital buffer that has three stable states: a high voltage output state (logical 1), a low output state (logical 0), and a high-impedance (Hi-Z) state. In the Hi-Z state, the output of the buffer is effectively disconnected fro…

Why does Three-state logic matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Three-state logic?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Three-state logic.

Tags

  • Digital electronics
  • Ternary computers

Keep exploring