Four valued logic
Encyclopedia
In logic
, a four-valued logic is used to model signal values in digital circuits: the four values are Z, X and the boolean
values 1 and 0. Z stands for high impedance
or open circuit
, while X stands for "unknown". There is also a 9-valued logic standard by the IEEE called IEEE 1164
.
There are other types of four value logic, such as Belnap's
four-valued relevance logic
: the possible values are 1) true, 2) false, 3) both true and false, and 4) neither true nor false. Belnap's logic is designed to cope with multiple information sources such that if only true is found then true is assigned, if only false is found then false is assigned, if some sources say true and others say false then both is assigned, and if no information is given by any information source then neither is assigned.
The "X" value does not exist in real-world circuits, it is merely a placeholder used in simulators and for design purposes. Some simulators support representation of the "Z" value, others do not. The "Z" value does exist in real-world circuits but only as an output state.
(HDL) simulation tools, such as Verilog
and VHDL, support an unknown value like that shown above during simulation of digital electronics. The unknown value may be the result of a design error, which the designer can correct before synthesis into an actual circuit. The unknown also represents uninitialised memory values and circuit inputs before the simulation has asserted what the real input value should be.
HDL synthesis tools usually produce circuits that operate only on binary logic.
In these situations, it is traditional to use "X" as a placeholder to indicate "Don't Care
" when building truth tables. This is especially common in state machine design and Karnaugh map
simplification. The "X" values provide additional degrees of freedom
to the final circuit design, generally resulting in a simplified and smaller circuit.
Once the circuit design is complete and a real circuit is constructed, the "X" values will no longer exist. They will become some tangible "0" or "1" value but could be either depending on the final design optimisation.
on their outputs only. The three states are "0", "1", and "Z".
Commonly referred to as tristate logic (a trademark of National Semiconductor
), it comprises the usual true and false states, with a third transparent high impedance
state (or 'off-state') which effectively disconnects the logic output. This provides an effective way to connect several logic outputs to a single input, where all but one are put into the high impedance state, allowing the remaining output to operate in the normal binary sense. This is commonly used to connect banks of computer memory and other similar devices to a common data bus; a large number of devices can communicate over the same channel simply by ensuring only one is enabled at a time.
It is important to note that while outputs can have one of three states, inputs can only recognise two. Hence the kind of relations shown in the table above do not occur. Although it could be argued that the high-impedance state is effectively an "unknown", there is absolutely no provision in the vast majority of normal electronics to interpret a high-impedance state as a state in itself. Inputs can only detect "0" and "1".
When a digital input is left disconnected (i.e., when it is given a high impedance signal), the digital value interpreted by the input depends on the type of technology used. TTL technology will reliably default to a "1" state. On the other hand CMOS
technology will temporarily hold the previous state seen on that input (due to the capacitance
of the gate input). Over time, leakage current causes the CMOS input to drift in a random direction, possibly causing the input state to flip. Disconnected inputs on CMOS devices can pick up noise
, they can cause oscillation
, the supply current may dramatically increase (crowbar power) or the device may completely destroy itself.
and error correction, and several true ternary logic devices have been manufactured (see external links).
Logic
In philosophy, Logic is the formal systematic study of the principles of valid inference and correct reasoning. Logic is used in most intellectual activities, but is studied primarily in the disciplines of philosophy, mathematics, semantics, and computer science...
, a four-valued logic is used to model signal values in digital circuits: the four values are Z, X and the boolean
Boolean logic
Boolean algebra is a logical calculus of truth values, developed by George Boole in the 1840s. It resembles the algebra of real numbers, but with the numeric operations of multiplication xy, addition x + y, and negation −x replaced by the respective logical operations of...
values 1 and 0. Z stands for 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:...
or open circuit
Open circuit
The term Open circuit may refer to:*Open-circuit scuba, a type of SCUBA-diving equipment where the user breathes from the set and then exhales to the surroundings without recycling the exhaled air...
, while X stands for "unknown". There is also a 9-valued logic standard by the IEEE called IEEE 1164
IEEE 1164
The IEEE 1164 standard defines a package design unit that contains declarations that support a uniform representation of a logic value in a VHDL hardware description....
.
There are other types of four value logic, such as Belnap's
Nuel Belnap
Nuel D. Belnap, Jr. is an American logician and philosopher who has made many important contributions to the philosophy of logic, temporal logic, and structural proof theory. He has taught at the University of Pittsburgh since 1961; before that he was at Yale University. His best known work is...
four-valued relevance logic
Relevance logic
Relevance logic, also called relevant logic, is a kind of non-classical logic requiring the antecedent and consequent of implications be relevantly related. They may be viewed as a family of substructural or modal logics...
: the possible values are 1) true, 2) false, 3) both true and false, and 4) neither true nor false. Belnap's logic is designed to cope with multiple information sources such that if only true is found then true is assigned, if only false is found then false is assigned, if some sources say true and others say false then both is assigned, and if no information is given by any information source then neither is assigned.
Electronics
Digital electronics theory supports four distinct logic values (as defined in VHDL's std_logic):- 1 or High, usually representing TRUE.
- 0 or Low, usually representing FALSE.
- X representing a "Conflict".
- U representing "Unassigned" or "Unknown".
- - representing "Don't CareDon't-care (logic)In digital logic, a don't-care term is an input-sequence to a function that the designer does not care about, usually because that input would never happen, or because differences in that input would not result in any changes to the output...
". - Z representing "high impedanceHigh impedanceIn electronics, high impedance means that a point in a circuit has a relatively high impedance to other points in the circuit.-Digital electronics:...
", undriven line. - H, L and W are other high-impedance values, the weak pull to "High", "Low" and "Don't Know" correspondingly.
The "X" value does not exist in real-world circuits, it is merely a placeholder used in simulators and for design purposes. Some simulators support representation of the "Z" value, others do not. The "Z" value does exist in real-world circuits but only as an output state.
Use of "X" value in simulation
Many hardware description languageHardware description language
In electronics, a hardware description language or HDL is any language from a class of computer languages, specification languages, or modeling languages for formal description and design of electronic circuits, and most-commonly, digital logic...
(HDL) simulation tools, such as Verilog
Verilog
In the semiconductor and electronic design industry, Verilog is a hardware description language used to model electronic systems. Verilog HDL, not to be confused with VHDL , is most commonly used in the design, verification, and implementation of digital logic chips at the register-transfer level...
and VHDL, support an unknown value like that shown above during simulation of digital electronics. The unknown value may be the result of a design error, which the designer can correct before synthesis into an actual circuit. The unknown also represents uninitialised memory values and circuit inputs before the simulation has asserted what the real input value should be.
HDL synthesis tools usually produce circuits that operate only on binary logic.
Use of "X" value in digital design
When designing a digital circuit, some conditions may be outside the scope of the purpose that the circuit will perform. Thus, the designer does not care what happens under those conditions. In addition, the situation occurs that inputs to a circuit are masked by other signals so the value of that input has no effect on circuit behaviour.In these situations, it is traditional to use "X" as a placeholder to indicate "Don't Care
Don't-care (logic)
In digital logic, a don't-care term is an input-sequence to a function that the designer does not care about, usually because that input would never happen, or because differences in that input would not result in any changes to the output...
" when building truth tables. This is especially common in state machine design and Karnaugh map
Karnaugh map
The Karnaugh map , Maurice Karnaugh's 1953 refinement of Edward Veitch's 1952 Veitch diagram, is a method to simplify Boolean algebra expressions...
simplification. The "X" values provide additional degrees of freedom
Degrees of freedom (statistics)
In statistics, the number of degrees of freedom is the number of values in the final calculation of a statistic that are free to vary.Estimates of statistical parameters can be based upon different amounts of information or data. The number of independent pieces of information that go into the...
to the final circuit design, generally resulting in a simplified and smaller circuit.
Once the circuit design is complete and a real circuit is constructed, the "X" values will no longer exist. They will become some tangible "0" or "1" value but could be either depending on the final design optimisation.
Use of "Z" value for high impedance
Some digital devices support a form of three-state logicThree-state logic
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 levels, effectively removing the output from the circuit...
on their outputs only. The three states are "0", "1", and "Z".
Commonly referred to as tristate logic (a trademark of National Semiconductor
National Semiconductor
National Semiconductor was an American semiconductor manufacturer, that specialized in analog devices and subsystems,formerly headquartered in Santa Clara, California, USA. The products of National Semiconductor included power management circuits, display drivers, audio and operational amplifiers,...
), it comprises the usual true and false states, with a third transparent 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 (or 'off-state') which effectively disconnects the logic output. This provides an effective way to connect several logic outputs to a single input, where all but one are put into the high impedance state, allowing the remaining output to operate in the normal binary sense. This is commonly used to connect banks of computer memory and other similar devices to a common data bus; a large number of devices can communicate over the same channel simply by ensuring only one is enabled at a time.
It is important to note that while outputs can have one of three states, inputs can only recognise two. Hence the kind of relations shown in the table above do not occur. Although it could be argued that the high-impedance state is effectively an "unknown", there is absolutely no provision in the vast majority of normal electronics to interpret a high-impedance state as a state in itself. Inputs can only detect "0" and "1".
When a digital input is left disconnected (i.e., when it is given a high impedance signal), the digital value interpreted by the input depends on the type of technology used. TTL technology will reliably default to a "1" state. On the other hand CMOS
CMOS
Complementary metal–oxide–semiconductor is a technology for constructing integrated circuits. CMOS technology is used in microprocessors, microcontrollers, static RAM, and other digital logic circuits...
technology will temporarily hold the previous state seen on that input (due to the 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...
of the gate input). Over time, leakage current causes the CMOS input to drift in a random direction, possibly causing the input state to flip. Disconnected inputs on CMOS devices can pick up noise
Electronic noise
Electronic noise is a random fluctuation in an electrical signal, a characteristic of all electronic circuits. Noise generated by electronic devices varies greatly, as it can be produced by several different effects...
, they can cause oscillation
Oscillation
Oscillation is the repetitive variation, typically in time, of some measure about a central value or between two or more different states. Familiar examples include a swinging pendulum and AC power. The term vibration is sometimes used more narrowly to mean a mechanical oscillation but sometimes...
, the supply current may dramatically increase (crowbar power) or the device may completely destroy itself.
Exotic ternary-logic devices
True ternary logic can be implemented in electronics, although the complexity of design has thus far made it uneconomical to pursue commercially and interest has been primarily confined to research, since 'normal' binary logic is much cheaper to implement and in most cases can easily be configured to emulate ternary systems. However, there are useful applications in fuzzy logicFuzzy logic
Fuzzy logic is a form of many-valued logic; it deals with reasoning that is approximate rather than fixed and exact. In contrast with traditional logic theory, where binary sets have two-valued logic: true or false, fuzzy logic variables may have a truth value that ranges in degree between 0 and 1...
and error correction, and several true ternary logic devices have been manufactured (see external links).