| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Boolean Logic and Logical Functions (Page 1 of 3) Every bit in a computer system can hold a value of either one or zero, which represent the basic on or off states inherent in a binary digital system. In the preceding topics in this section, I demonstrated how groups of these bits can be collected into sets to represent larger binary numbers, and then how those can be used for performing various mathematical operations. However, as I mentioned when I introduced the concept of binary information, we can also interpret the on and off' values of a binary digit as true or false respectively. These can represent various logical conditions within a computer or other system. Furthermore, there are various logical operations that can be used to manipulate and combine these true or false values to represent more complex logical states. One of the pioneers of using binary values in logical thought was British mathematician George Boole (1815-1864), and in recognition of his contribution to this field, this system of binary values and conditions is commonly called boolean logic. Boolean logic defines a number of boolean logical functions, which are also sometimes called operators. Each of these uses a logical algorithm to compute an output value based on the value of one or more inputs. The algorithm determines when the output is a true value, based on what combination of true and false values the inputs take. For this reason, the table that shows the inputs and outputs for a logical function is called a truth table. Each of the logical functions is analogous to a real world logical operation that we use to define various logical situations, as we will see. It is much easier to see how boolean logic works by looking at examples, rather than reading these types of formal descriptions. So, let's just jump right in and see it in action, by looking at the different functions and how they work. Let's start with the simplest, the NOT function. As you might expect, this is a just a negation; the output is the opposite of the input. The NOT function takes only one input, so it is called a unary function or operator. The truth table for NOT is shown in Table 9. As you can see, the output is true when the input is false, and vice-versa.
The NOT function logically represents the opposite of a condition. For example, suppose we have a bit called B1 whose logical meaning is that when the bit is true, a particular pixel on a screen is lit up. Then the boolean expression NOT B1 would be the opposite: it would be false when the pixel is lit up, and thus true only when the pixel is not lit up. Pretty straight-forward. Now, before proceeding further, I am going to play a little trick on you. J As I said above, boolean logic is based on true and false values. However, I also said that true and false are represented in computers by one or zero values. For this reason, boolean logic is often expressed in terms of ones and zeroes, instead of true and false. The circuits inside computer processors and other devices manipulate one and zero bits directly using these functions. In some (but not all) cases they interpret one and zero as true and false, but in either case the two representations are functionally equivalent. Table 10 shows the same truth table as Table 9, but using bit values: each "True" is represented as a 1 and each "False" as a 0.
Home - Table Of Contents - Contact Us The TCP/IP Guide (http://www.TCPIPGuide.com) Version 3.0 - Version Date: September 20, 2005 © Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved. Not responsible for any loss resulting from the use of this site. |