28
EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Embed Size (px)

Citation preview

Page 1: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

EE2420 – Digital LogicSummer II 2013

Hassan Salamy

Ingram School of Engineering

Texas State University

Set 2: Boolean Logic

Page 2: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Boolean Algebra2

The basis for much of what we will do in this class is grounded in Boolean algebra, named for George Boole.

In the early chapters of the textbook we will study the Theorems and Laws of Boolean Algebra and techniques for implementing Boolean functions using electronic circuits.

In later chapters we will study how Boolean functions can be used to implement arithmetic and other useful functions.

Later still we will adapt these techniques to create components critical to modern computing such as memory elements and sequence logic.

Page 3: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Electrical Circuits (Over)simplified For those of you who have had no experience with

electrical circuits, the following is a vastly oversimplified primer.

The simple model of matter is that it is made up of atoms which have positively-charged nuclei orbited by negatively-charged electrons. Given sufficient energy, an electron can be dislodged from its atom.

Think of electricity as the flow of energy carried by the movement of electrons dislodged from atoms.

An electrical circuit is formed when there is a closed path around which the electrons flow.

3

Page 4: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Circuits Primer part 2 In electrical circuits, we are interested in the movement of

energy from one location to another. Some elements in a circuit provide energy. These are

sources. Some elements in a circuit expend energy. These are

sinks. The total energy sourced must equal the total energy

expended. We typically measure energy somewhat indirectly.

Energy is measured in Joules (J). Power is energy per unit time. Power is measured in Watts (W). A Watt is one Joule per second.

1W = 1J/s A 100W light bulb expends 100 Joules each second.

4

Page 5: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Circuits Primer part 3

We said a 100W light bulb expends 100 Joules each second.

We also said to think of electricity as the flow of energy carried by the movement of electrons dislodged from atoms.

To get energy to the light bulb, we make a circuit from the power producing plant to the light bulb.

In that circuit each moving electron is charged with energy at the source. When an electron passes through the sink (light) that energy is expended.

The amount of power that can be supplied depends on two factors: The number of electrons that can move through the wires The amount of energy carried with each electron

5

Page 6: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Circuits Primer part 4 The number of electrons flowing in a circuit is called current.

Current is measured in Amperes (A). An Ampere is one Coulomb of electrons per second. A Coulomb is 6,241,507,648,655,549,400 (approx 6.24 x 1018) electrons.

The amount of energy per electron is called voltage. Voltage is measured in Volts (V). One Volt is one Joule per Coulomb.

So to determine power we take the product of the number of electrons flowing (current) and the energy per electron (voltage) and we should get a measure of power (wattage)

Voltage * Current = Power In units V*A=W or (J/C)*(C/s) = (J/s)

6

Page 7: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Circuits Primer part 5

Most of the devices that we will be dealing with in this class will operate using relatively low power circuits.

However, this does not make them 100% safe. It also does not make it impossible to damage the equipment if used incorrectly.

Electricity flows very easily through most metals, including jewelry. It would be wise when you are dealing with any circuitry to remove any jewelry from your hands (rings, watches, etc. ) or long necklaces that could contact the circuitry.

Be careful how you wire the power supply to your circuits. If you reverse the polarity and try to drive current “backward” through the circuit, you are likely to cause damage.

Ask your lab monitor if you are not sure.

7

Page 8: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

The Scope of Boolean Algebra

8

In common arithmetic, we are often concerned with the range of values that a variable may take. This is generally determined by the nature of the problem: The integers 1-12 – the month of the year A 7-digit decimal integer – local telephone number A real number in the interval from 0 to 100 – a test grade Imaginary numbers.

For Boolean algebra, every variable is constrained to one of two values: True or False

Any convenient two-valued pair can be used to represent the True/False pair: on/off, high/low, clockwise/counter-clockwise, closed/open, loud/soft, 1/0

We will commonly use the 1/0 notation with 1=True and 0=False

Page 9: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Switches9

A very early electronic implementation of Boolean algebra recognized that the state of a switch (open or closed) could be used to represent a Boolean variable (True or False) and that switches could be wired in combination to represent complex Boolean algebra equations.

Open Switch Closed Switch

Page 10: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Electrically-controlled Switches

10

A simple mechanical switch (like a light switch on a wall) requires physical effort to manually open or close the contact.

An electrically-controlled switch is opened or closed based on the state of an input.

For a normally-open switch, when the input is inactive, the switch is open and when the input is active, the switch closes.

For a normally-closed switch, when the input is inactive, the switch is closed and when the input is active, the switch opens.

Normally-open Normally-closed

Page 11: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Types of Switches11

The earliest devices used for electrically-controlled switching for Boolean algebra purposes were relays.

A relay uses an input to generate an electromagnetic field that physically moves the switch contacts into position.

Because relays depend on physical movement of the contacts, they are too slow for modern digital computing purposes.

Modern systems use transistors to perform the function of switches without requiring mechanical movement.

While transistors are complex devices capable of much more than digital switching, when used for switching they may be modeled as very simple electrically-controlled switches.

Page 12: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Active-high Input Switching Devices

12 BJT – Bipolar Junction Transistor MOSFET – Metal-Oxide Semiconductor Field Effect Transistor

Normally-open

SwitchNPN BJT

N-channel

MOSFET

inputinput input

Condu

cting

path

Condu

cting

path

Condu

cting

path

NMOS: +V=On 0V=Off

Lecture 2: Boolean Logic 12/28

Page 13: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Active-low Input Switching Devices

13

BJT – Bipolar Junction Transistor MOSFET – Metal-Oxide Semiconductor Field Effect Transistor

Normally-closed

SwitchPNP BJT P-channel

MOSFET

inputinputinput

Condu

cting

path

Condu

cting

path

Condu

cting

path

PMOS: +V=Off 0V =On13/28

Page 14: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Switch Logic14

In the following circuit, the battery is connected to the lamp if switch A is closed and switch B is closed. If either switch is open, there is not a complete circuit.

This is the Boolean function AND

BatteryLamp

Switch A Switch B

Page 15: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Switch Logic15

In the following circuit, the battery is connected to the lamp if switch A is closed or switch B is closed. If either switch is closed, there is a complete circuit.

This is the Boolean function OR

BatteryLamp

Switch A

Switch B

Page 16: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Switch Logic16

In the following circuit, the battery is connected to the lamp and the output voltage is high if the input to the normally-closed switch is low.

Conversely, when the input is high, the lamp is disconnected and the output drops to 0.

Therefore, the output is the opposite of the input. This is the Boolean function NOT

BatteryLamp

Input

Output

Page 17: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Logic Gates17

Special circuit symbols are used for the Boolean logic functions regardless of the type of switches used to implement the functions.

AND OR NOT

Page 18: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Logic circuits18

Logic circuits perform operations on digital signals Implemented as electronic

circuits where signal values are restricted to a few discrete values

In binary logic circuits there are only two values, 0 and 1

The general form of a logic circuit is a switching network

In the figure to the right, the inputs are labeled Xn and the outputs are labeled Yn

Not shown in the figure are the required connections for providing power to the circuit.

SwitchingNetwork

X1

X2

X3

Xm

Y1

Y2

Y3

Yn

discrete values

Page 19: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Boolean algebra19

Direct application to switching networks Work with 2-state devices 2-valued Boolean

algebra (switching algebra) Use a Boolean variable (X, Y, etc.) to represent an

input or output of a switching network Boolean variable may take on only two values

(True, False) We will use a notation of 0 for False and 1 for True So the possibilities for a variable are: X=0, X=1 These symbols are not binary numbers, they

simply represent the 2 states of a Boolean variable They are not voltage levels, although they

commonly refer to the low or high voltage input/output of some circuit element

Page 20: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Notation Conventions20

Boolean AND The raised dot “· ” x· y The intersection symbol “” x y No symbol xy

Boolean OR Plus sign “+” x + y The union symbol “” x y

Boolean NOT Single quotation “ ’ ” following x’ Bar over letter Exclamation point preceding !x Tilde preceding ~x

x

Page 21: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Inversion of a function21

If a function is defined as f(x1, x2)= x1+ x2

Then the complement of f is f(x1, x2)= x1+ x2 = (x1+ x2)’

Similarly, if f(x1, x2)= x1 · x2

Then the complement of f is f(x1, x2)= x1 · x2= (x1 · x2)’

Page 22: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Truth tables22

Tabular listing that fully describes a logic function Output value for all input combinations

(valuations)x1 x2 x1· x2

0 0 0

0 1 0

1 0 0

1 1 1

x1 x2 x1 + x2

0 0 0

0 1 1

1 0 1

1 1 1

x1 x1’

0 1

1 0

AND OR

NOT

Page 23: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Truth tables23

Truth table for AND and OR functions of three variables

Page 24: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Truth tables of functions24

If L(x,y,z)=x+yz, then the truth table for L is:

x y z yz x+yz0 0 0 0 00 0 1 0 00 1 0 0 00 1 1 1 11 0 0 0 11 0 1 0 11 1 0 0 11 1 1 1 1

+

Page 25: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Logic gates and networks25

A larger circuit is implemented by a network of gates Called a logic network or logic circuit

x 1 x 2 x 3

f x 1 x 2 + x 3 =

Page 26: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Logic gates and networks26

Draw the truth table and the logic circuit for the following function F(a,b,c) = ac+bc’

a b c ac bc' ac+bc'0 0 0 0 0 00 0 1 0 0 00 1 0 0 1 10 1 1 0 0 01 0 0 0 0 01 0 1 1 0 11 1 0 0 1 11 1 1 1 0 1

ac

b

Page 27: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Analysis of a logic network27

To determine the functional behavior of a logic network, we can apply all possible input signals to it

x 1

x 2

1 1 0 0

f

0 0 0 1

1 1 0 1

0 0 1 1

0 1 0 1

Network that implementsf x 1 x 1 x 2 + =

A

B

Page 28: EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 2: Boolean Logic

Analysis of a logic network28

The function of a logic network can also be described by a timing diagram (gives dynamic behavior of the network)

1 0

1 0

1 0

1 0

1 0

x 1

x 2

A

B

f Time

Timing diagram