Monday 16 December 2013

Binary Logic


Binary logic consists of binary variables and a set of logical operations. The variables are designated by letters of the alphabet, such as A, B, C, x, y, z, etc., with each variable having two and only two distinct possible values: 1 and 0. There are three basic logical operations: AND, OR, and NOT. Each operation produces a binary result, denoted by z.


  • AND: This operation is represented by a dot or by the absence of an operator. For example, x # y = z or xy = z is read “x AND y is equal to z.” The logical operation AND is interpreted to mean that z = 1 if and only if x = 1 and y = 1; otherwise z = 0. (Remember that x, y, and z are binary variables and can be equal either to 1 or 0, and nothing else.) The result of the operation x # y is z.

  • OR: This operation is represented by a plus sign. For example, x + y = z is read “x OR y is equal to z,” meaning that z = 1 if x = 1 or if y = 1 or if both x = 1 and y = 1. If both x = 0 and y = 0, then z = 0. 

  • NOT: This operation is represented by a prime (sometimes by an overbar). For example, x[1] = z (or x = z ) is read “not x is equal to z,” meaning that z is what x is not. In other words, if x = 1, then z = 0, but if x = 0, then z = 1. The NOT operation is also referred to as the complement operation, since it changes a 1 to 0 and a 0 to 1, i.e., the result of complementing 1 is 0, and vice versa.
Truth Tables of Logical Operations


AND                                  OR                           NOT

x    y    x . y              x    y    x + y                     x   x`

0    0      0                 0    0      0                         0    1
0    1      0                 0    1      1                         1    0
1    0      0                 1    0      1
1    1      1                 1    1      1


                     
/WhatIs/images/and.gif (220 bytes)                /WhatIs/images/or.gif (224 bytes)           /WhatIs/images/not.gif (240 bytes)

AND gate                                 OR gate                       Inverter or NOT gate

No comments:

Post a Comment