Canterbury Christ Church University

Week-7: Boolean Algebra - 1

Course Code: U19952

Course Name: Fundamentals of Computer Systems

Credits: 20

Module Leader: Ali Jaddoa
Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Intended Learning Outcomes

  1. Calculate simple Boolean equations​

  2. Explain the difference between Sum of Products and Standard Sum of Products.

  3. Recall Boolean Algebra Laws

  4. Recall how to minimise the terms.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Logic

In Boolean algebra, a variable is a symbol is used to represent an action, a condition, or data. A single variable can only have a value of 1 or 0. ​

The complement represents the inverse of a variable and is indicated with an overbar. Thus, the complement of is .​


A literal is a variable or its complement.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Addition

There can only be or .​

A B S
0 0 0
Truth Table 0 1 1
1 0 1
1 1 1

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Addition/Sum

Parallel Switch

center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Vs Binary Addition

It does not matter how many or few terms we add together, either. ​

​Consider the following sums:​

But in binary addition:

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Sum Term

  • In Boolean algebra, a sum term is a sum of literals. ​

  • In logic circuits, a sum term is produced by an OR operation with no AND operations involved. ​

Some examples of sum terms are:​

  • A sum term is equal to when one or more of the literals in the term are . ​

  • A sum term is equal to only if each of the literals is .​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Sum Example

A sum term is a sum of literals. The sum term is 1 if one or more of the literals are 1. ​

The sum term is zero only if each literal is 0.​

​Determine the values of ‘A’, ‘ B’, and ‘C’ that make the sum term of the expression:​

Answer

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Multiplication

Series Switch

center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Product Term "MINTERM"

In Boolean algebra, a product term or “minterm” is the product of literals. ​

In logic circuits, a product term is produced by an AND operation with no OR operations involved. Some examples of product terms are ​

A product term is equal to 1 only if each of the literals in the term is 1. A product term is equal to 0 when one or more of the literals are 0.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Product Term Example

A product term is the product of literals.​

Determine the values of ‘A’, ‘ B’, and ‘C’ that make the sum Product term of the expression:​

Answer

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Sum-of-Products (SOP) Terms

When two or more product terms are summed by Boolean addition, the resulting expression is a sum-of-products (SOP). Some examples are:​

Legal SOP Expression:

ILegal SOP Expression:

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

AND / OR Implementation of an SOP Expression

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Liteals SOP

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Standard SOP (SSOP)

When all input variables appear in each product term, the expression is known as a standard Sum of Product (SOP) expression:

Following expression has input variables A, B, C and D , complete set of variables is not present in the first two expression ​

Following is a standard SOP (SSOP) expression​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Output of a digital circuit written as SSOP

A B C S Terms
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
0 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Standard Sum of Product Example

XOR Function

A B Terms S(output)
0 0 0
0 1 1
1 0 1
1 1 0

Only the product terms where circuit produces 1 (values of S) are added in the equation

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Boolean Analysis of Logic Circuits

Combinational logic circuits can be analyzed by writing the expression for each gate and combining the expressions according to the rules for Boolean algebra.​

Apply Boolean algebra to derive the expression for X.​

Write the expression for each gate:​

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University
Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Grouping in AND

Simpler AND gates in Groups produce the same output of a big complex AND gate.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Grouping in AND

Simpler AND gates in Groups produce the same output of a big complex OR gate.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

End of Morning Session

  • See you at 13:00 VH2.04 (a,b,c)
Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

1- Basic Rules (Annulment (Null) Law)

width:1OO% center


width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

2- Basic Rules (Identity Law)

width:1OO% center


width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

3- Basic Rules (Idempotent Law)


width:1OO% center


width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

4- Basic Rules (Complement Law)


width:1OO% center


width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

5- Double Negation

Note we see that a double inversion, cancel each other out!

Boolean Equation :

A S
Truth Table 0 1
1 0

center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

6- Associative Law

The associative laws are also applied to addition and multiplication. For addition, the associative law states​

When OR’ing more than two variables, the result is the same regardless of the grouping of the variables.​

For multiplication, the associative law states​

When ANDing more than two variables, the result is the same regardless of the grouping of the variables.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Example:

Z= (A.B).C == A.(B.C)

width:1OO% center

Z= (A+B)+C == A+(B+C)

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

7- Commutative Law

The commutative laws are applied to addition and multiplication. For addition, the commutative law states:​

In terms of the result, the order in which variables are ORed makes no difference.​

width:1OO% center

For multiplication, the commutative law states:​

In terms of the result, the order in which variables are ANDed makes no difference.​

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

8- Distributive Law

The distributive law is the factoring law. A common variable can be factored from an expression just as in ordinary algebra. That is​

The distributive law can be illustrated with equivalent circuits:​
width:1OO% center

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

9- Absotptive (Redundancy ) Law


width:1OO% center


width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

10- De Morgan's Laws

1- The complement of the product of two variables equals the sum of their complements.

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

10- De Morgan's Laws (Cont'd)

2- The complement of the sum of two variables equals the product of their complements.

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Q: How to get True?

  1. F= AB+1+CD =?

  2. F=A.B.0.C.D =?

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Reduction of Gates

  • If we can reduce the number of gate and yet produce the
    same functionality we gain the benefits of:

    • Economy
    • Speed
    • Increased ability
Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Minimise using laws

A literal by itself cancels out any term that contains it: (Absorption)

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Minimise using laws

A literal by itself knocks out its not’ed opposite that appears in any minterm (Absorption)

width:1OO% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Minimise using laws

width:10O% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

width:10O% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

width:10O% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Soluting

Step 1: Apply Distributive Law

Step 2: Apply Complement Identity)

= 1 . (A + B)

Step 3: Apply Identity Law
Z = 1 . (A + B)
= A + B

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

width:10O% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Soluting

Step 1: Apply Complement Law

Step 2: Apply Annulment Law

Step 3: Apply identity Law

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

width:10O% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Soluting

  • Apply Distributive Law

  • Use Idempotent Law (Twice)

  • Again use Idempotent and Associative Law

  • Use Distributive Law

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

width:10O% center

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Soluting

  • Z = A + (A . B) // Brackets for clarity

  • Use Identity Law : A + 1 = A
    Z = (A + 1) + (A . B)

  • Distributive law - factorise
    Z = A + (1 . B)

  • Annulment law: A + 1 = 1
    Z = A + 1

  • Identity law: A . 1 = A
    Z = A

Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Summary

  • A literal is a boolean variable or its complement.
  • A product term (also known as minterm) is the product of literals.
  • Two or more product terms are summed by Boolean addition; the resulting expression is a sum-of-products (SOP).
  • A truth table is simply a list of the possible combinations of input variable values and the corresponding output values.
  • Output of a logic circuit is written as a Boolean sum of product of only those cases where a circuit produces a 1.
  • To reduce cost and increase speed of computing device, we need to minimize the circuit.
  • Apply basic rules of Boolean Algebra for circuit minimization.
Fundamental of Computer Systems: U19952-2023-2024
Canterbury Christ Church University

Lab

  • Link to the lab
  • You can also review the following:
    • This book (from Page 147)
    • And this book too, (from page B-6)
Fundamental of Computer Systems: U19952-2023-2024

## NOT Gate ![bg right:43% 95%](../../figures/NOT.png) Note: NOT is represented by a Bar on top!​ >> Boolean Equation : $\ \ \ S = \bar{A}$ ||A|S| |--|--|--| |**Truth Table**| 0 | 1| ||1|0| >> A' or ¬A both are the same as $\bar{A}$. Code symbol is the explanation mark `!` --- ## Inversion or Complement Note we see that a double inversion, cancel each other out! Boolean Equation : $\ \ \ S = \overline{\overline{A}} == A$ ||A|S| |--|--|--| |**Truth Table**| 0 | 1| ||1|0| ![center 100%](../../figures/NOT_INV.png) ---

## Applications **Beyond computer hardware design...** - Machine learning - Neural Networks - Categorical ![bg right:50% 100%](../../figures/ML_BL.png) --- ## Applications **Programming...** The obvious reason is that you are going to write a lot of `if()` statements and you want to get them right, but also because you are going to have to fix the `if`’s of other people who’ve made logical mistakes. ![bg right:40% 90%](../../figures/boolean_Flow.png)