Wednesday, 20 November 2013

Boolean Functions

Boolean Functions
Boolean algebra gives a concise way to state the operation of a logic circuit that is produced by a combination of logic gates in order to determine the output based on the combination of various input.
All Boolean expressions can be stated in either two standard forms:
Sum of product OR Product of sum

Sum of product(SOP)
A SOP expression is formed based on the output with the value of 1

Convert each binary value for each product term by replacing each value of 1 with the equivalent variable and each 0 with the equivalent variable complement.
Example:

Product of sum(POS)
A sum term is defined as a term with Boolean additions of variables or their complements.
These sum terms are multiplied to produce a POS expression.
POS expression is formed based on the output with the value of 0.
Convert each binary value to the equivalent sum by substitute each 1 with the equivalent variable complement and each 0 with the equivalent variable.

Example:

Simplification of Combinational Circuits
Examples:
Output =AB+A(B+C)+B(B+C)
            =AB+AB+AC+BB+BC
            =AB+AC+B+BC
            =AB+AC+B(1+C)
            =AB+AC+B
            =AB+B+AC
            =B(A+1)+AC
            =B+AC
Output =(AB+AC)’+A’B’C
            =(AB)’(AC)’+A’B’C
            =(A’+B’)(A’+C’)+A’B’C
            =A’A’+A’B’+A’C’+B’C’+ A’B’C
            =A’+ A’B’+A’C’+B’C’+ A’B’C
            =A’+A’C’+B’C’+ A’B’+ A’B’C
=A’+A’C’+B’C’+ A’B’(1+C)
=A’+A’C’+B’C’+ A’B’
=A’(1+C’)+ B’C’+ A’B’
=A’+B’C’+ A’B’
=A’+A’B’+B’C’
=A’(1+B’)+ B’C’
A’+B’C’

DeMorgan’s Theorems

DeMorgan’s first Theorems
• The complement of a product of variables is equal to the sum of the complements of the variables
• The formula for expressing this theorem for two variables is:

(XY)’ = X’ + Y’
DeMorgan’s second theorem
• The complement of a sum of variables is equal to the product of the complements of the variables
• The formula for expressing this theorem for two variables is:
(X+Y)’ = X’Y’

Rules of Boolean Algebra

AND Operations (·)
0·0 = 0 A·0 = 0
1·0 = 0 A·1 = A
0·1 = 0 A·A = A
1·1 = 1 A·A' = 0

OR Operations (+)
0+0 = 0 A+0 = A
1+0 = 1 A+1 = 1
0+1 = 1 A+A = A
1+1 = 1 A+A' = 1

NOT Operations (')
0' = 1 A'' = A
1' = 0

•Associative Law
–(A·B)·C = A·(B·C) = A·B·C
–(A+B)+C = A+(B+C) = A+B+C

•Distributive Law
–A·(B+C) = (A·B) + (A·C)
–A+(B·C) = (A+B) · (A+C)

•Commutative Law
–A·B = B·A
–A+B = B+A

•Precedence
–AB = A·B
–A·B+C = (A·B) + C
– A+B·C = A + (B·C)

•De Morgan's Theorem
–(A·B)' = A' + B' (NAND)
–(A+B)' = A' · B' (NOR)

•Redundance Law
–A + AB = A
–A (A + B) = A
–0 + A = A
–0 A = 0
–1 + A = 1
–1 A = A
A' A=0–A+A=1
–
A+A'B=A+B–
A(A'+B)=AB–

–A + A = A
–A A = A
– AB+AB'=A
–(A+B)(A+B')=A

How to use Boolean algebra to simplify a sum of products expression

1. Try to find variables that can be factored out in such a way as to leave
terms that will simplify to zero or one. For example AB’ + AB =
A(B’+B) = A(1)=A.
2. If it helps you recognize patterns, rearrange the order of the terms in
the expression to group terms that have common variables together.
3. Keep the second distributive law in mind. It is used a great deal and
situations where it would help are often missed by people new to
Boolean expression simplification.
                                    A+BC = (A+B)(A+C)

The derivation of A+AB
A+AB     = A(1+B)
                = A(1)
                = A
The derivation of A+A’B
A+A’B    = (A+AB)+A’B
                = (AA+AB)+A’B
                = AA+AB+AA’+A’B
                = AA+AB+A’B
                = (A+A’)(A+B)
    = 1× (A+B)
                = (A+B)

The derivation of (A+B)(A+C)
(A+B)(A+C) = A+AC+AB+BC
                      = A(1+C)+AB+BC
                      = A×1+AB+BC
                      = A×1+ BC

                      = A+BC

Basic Logic Gate

Digital system is constructed by using logic gates. These gates are AND, OR, NOT,NAND, NOR,  XOR gates. The basic operation below are described and aid with truth table.

AND gate
The AND gate is an electronic circuit that give a output (1) only if it have all its inputs are 1. A dot (.) is used to show AND operation i.e A.B or sometimes written as AB.
The Boolean expression for AND operation is

                                X = AŸB



OR gate
 The OR gate is an electronic circuit that give output (1) if one or more of its input is 1. A plus (+) is used to show this operation.The Boolean expression for the OR operation is
X = A + B




Not gate
The NOT gate is an electronic circuit that produces an inverted version of the input as its output. It also known as an inverter. If the input variable is A, the inverted output is A’.




NAND gate
The NAND gate is combination of NOT-AND which is equal to an AND gate followed by a NOT gate. The output of all NAND gate are 1 if any of the inputs are 0.
The Boolean expression for the output of a 2-input NAND gate is
                                X = (AŸB)’


NOR gate






The NOR gate is the combination of NOT-OR which is equal to an OR gate followed by a NOT gate. The output of NOR gate are 0 if any inputs are 1.
The Boolean expression for the output of 2-input NOR gate is
                                X = (A+B)’


 XOR gate
The Exclusive-OR gate is a circuit which will give output 1 if either, but not both, of its two inputs are 1. An circled plus sign (Description: http://www.ee.surrey.ac.uk/Projects/Labview/gatesfunc/graphics/enplus.gif) is used to show the XOR operation.
The Boolean expression for XOR gate is
X=AŸB’+A’ŸB

   =AÃ…B

Introduction of Logic Gates and True Tables

Logic Gates 
A logic gate is physical device implementing a Boolean function that perform a logical operation on one or more logical inputs, and produces a single logical output.  Logic gates are primarily implemented by using diodes or transistors acting as electronic switches. With amplification, logic gates can be cascaded in same way that Boolean functions can be composed and allowing the construction of a physical model of all Boolean logic. Therefore, all of the algorithms and mathematics can be described with Boolean logic.

Truth Tables
Truth tables help understand the behavior of logic gates.
They show how the inputs of a logic gate relate to its outputs.
The gate inputs are shown in the left columns of the table with all possible inputs combination. This is done by making the inputs count up in binary.
The gate outputs are shown in right hand side column.

Example:
Consider a logic function with three inputs, A, B, and C, and three outputs D, E, and F. The function is defined as follows: D is true if at least one input is true, E is true if exactly two inputs are true, and F is true only if all three inputs are true. 
Truth table with n(3), contain 23 = 8 entries

N= 2n             N = number of possible input combination
n = the number of input variables

2 inputs -> 22 = 4 combinational
3 inputs -> 23 = 8 combinational
4 inputs -> 24 = 16 combinational 

Number Operation

Number Operation

Binary Number Operation Rules (Addition)

Binary Rules

Sum

Carry

0 + 0 = 0

0

0

0 + 1 = 1

1

0

1 + 0 = 1

1

0

1 + 1 = 1

0

1

Binary Number Operation Rules (Subtraction)

Binary Rules

Different

Borrow

0 – 0 = 0

0

0

0 – 1 = 1

1

10

1 – 0 = 1

1

0

1 – 1 = 1

0

1

Binary Number Operation Rules (Multiplication)

Binary Rules

Multiply

0 x 0 = 0

0

0 x 1 = 0

0

1 x 0 = 0

0

1 x 1 = 1

1


Example:

  1. 3 + 2
3+2 = 01012 = 5

   2.   20 – 15
20 – 15 = 01012 = 5

   3.   11102 ÷ 102

11102 ÷ 102 = 1112

Hexadecimal Number Operation
  1. 5916 + 3216


   2.   1B16 + 2C16


   3.   3016 - 2216





2’s Complement Number

2’s Complement Number
Property
Two's complement representation allows the use of binary arithmetic operations on signed integers, yielding the correct 2's complement results.
Positive Numbers
Positive 2's complement numbers are represented as the simple binary.
Negative Numbers
Negative 2's complement numbers are represented as the binary number that when added to a positive number of the same magnitude equals zero.

How to Calculate 2's Complement?

For example: -2010

Separate the sign and magnitude number of -1. The sign will be 1 if the number is negative and will be 0 if the number is positive.

Sign

Magnitude

Note

0

  0010100

Now is 20

 

  1101011

Each 0 is changed to a 1 and each 1 is changed to a 0

 

  1101100

Add + 1

1

  1101100

Now is -20

2's Complement Addition

1)    3010 – 2010

3010 = 000111102


-2010 = 111011002

Therefore, 000111102 + 111011002 = 000010102 = 1010