CS 250 Lab 1

Pre-lab Introduction


Boolean Algebra

Boolean algebra is a type of algebra commonly used when dealing with digital logic.[1]

Recall that regular algebra has variables, which can hold any real number, and that operations such as addition, multiplication, subtraction and division can be performed on these variables. In the same way, Boolean algebra has variables, but these variables can only be set to the logical constants true and false.

Suppose we have two variables called X and Y. The three fundamental operations which can act on these variables in Boolean algebra are:


Representation of Boolean values in circuits

Naturally, computers and other pieces of electronics don't understand the notion of "true" or "false". However, digital circuits can be controlled by sending voltage through parts of the circuit, turning those parts of the circuit on and off. When a digital circuit component receives a high-voltage input (typically 3.3 or 5 volts[2]), it treats the input as a logical true value. Likewise, when the component receives a low-voltage (0 volt) input, it treats it as a logical false.


Truth tables

A truth table is a table which contains the results of applying a given logical expression to a set of logical variables. Truth tables are useful because they allow people to both prove that a given logical expression is mathematically correct, and to simplify complicated Boolean expressions.

Here are the truth tables for the fundamental operators in Boolean algebra:

AND

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

OR

A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1

NOT

A NOT A
0 1
1 0

Properties of Boolean expressions

Below are some common laws that can be used to simplify and manipulate Boolean expressions. Remember that:

Commutative Law: AB = BA
A + B = B + A
Associative Law: ( A + B ) + C = A + ( B + C )
Distributive Law: A( B + C ) = AB + AC
De Morgan's Laws: ( A + B )’ = A’B’
( AB )’ = A’ + B’
Double Negation: A = (A')'

Karnaugh maps

A Karnaugh map, or K-map, is a technique used to quickly simplify Boolean algebra into a form that minimizes the amount of logical gates used when the algebraic expression is implemented.[3]

In order to generate a K-map, start with the truth table for the given Boolean expression. Suppose we have a truth table as follows:

A B C D Output
0 0 0 0 0
0 0 0 1 0
0 0 1 0 1
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 0
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0

To convert this table into a K-map, we first want to split the variables into roughly equal halves. Each half is going to comprise the axis of a new table, on which we will draw a K-map. Let's take AB as one axis of our new table, and CD as the other axis.

Write out every possible combination of the variables on each axis as follows. (Note that we reverse the order of 11 and 10 - this is a notation known as Gray code, which allows us to use K-maps.) Then write the output of the combination of the variables inside the K-map - reference the image below.

After drawing the table in this format, begin circling groups of 1s according to the following guidelines:

  1. Make each circle group regularly shaped.
  2. Make each circle group as large as possible.
  3. Make sure every 1 belongs to at least one circle group.
  4. Draw as few circle groups as possible (so the 1s are all covered by the least amount of circles).
  5. Treat the K-map as though it wraps around on itself - thus, you are allowed to have a circle that connects the four corners of the K-map.

Then, by looking at the circles you have made, you can quickly see that (in this case) the expression returns a logical true only when C is true and D is false, or when A is true and B is false. Thus a simplified Boolean expression for the given truth table would be Z = AB' + CD'.


References and footnotes

[1]: Wikipedia
[2]: Heat emission and energy efficiency are two of the most challenging design problems that electrical engineers are currently facing. Recall that after some algebra, Ohm’s Law states that P = V2/R, where P is power, V is voltage and R is resistance. This equation tells us that reducing the amount of voltage we use in a digital component reduces the amount of power needed to power it. Because of this, many components are now using 3.3 V as a logical high instead of 5 V.
[3]: Wikipedia