3.1 Logical Operations


1. Binary logic deals with variables that have two discrete values: 1 for TRUE and 0 for FALSE.
2. This is in contrast to an algebraic variable which can have any number as its value.
3. True and False are the "numerical constants" of logic. And instead of the usual arithmetic operators (addition, subtraction, etc.), the logical operators are "AND", "OR", "NOT", and "XOR" ("Exclusive OR").
4. Logical operations involve two Boolean variables or data bits (except for NOT) which can only have binary values i.e., either 0 or 1.
5. Such operations are essential to performing digital math operations.
6. Let s be a Boolean variables.
a) If we represent the state of a light switch with s,
b) A value of 0 will be assigned to s when the switch is OFF.
c) s will have value 1 when the switch is ON.
7. The 0 and 1 states of a Boolean variable can be described using a number of terms as follows:
0 = Off = Low = False
1 = On = High = True
8. The following logic operations or functions shown in Table 3.1 can be applied to boolean variables x, y and z.

3.1 Logical Operations



Table 3.1: Logical Operations.


9. The AND and OR operators are the mostly used.
10. The AND operation
a) The output of AND will be ‘on’ (1) if and only if its two inputs are on.
b) The output will be ‘off’ if any of the inputs are ‘off’.

3.1 Logical Operations


11. The OR operation
a) The OR output is ‘on’ if any input is ‘on’.
b) There is a variation on the OR logic called Exclusive OR or XOR.
12. The Exclusive OR
a) The output of Exclusive OR is ‘on’ if the inputs are different.
13. The inverter or NOT operation
a) Has only one input and one output.
b) The output will be opposite in state to the input.
c) It simply changes 1s to 0s and 0s to 1s.
14. The NAND operation
a) Can be considered as an inverted AND.
b) Thus, the output of a NAND gate is ‘off´ if and only if all of the inputs are ‘on’.
15. The NOR operation
a) Is an inverted OR.
b) Thus, if any input is ‘on’, the OR gate output will be ‘off’.