Top Banner
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering
33

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS

DESIGN

Lecture 3

Dr. Shi

Dept. of Electrical and Computer Engineering

Page 2: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Understanding Decimal Numbers

Decimal numbers are made of decimal digits: (0,1,2,3,4,5,6,7,8,9)

Number representation: 8653 = 8x103 + 6x102 + 5x101 + 3x100

What about fractions? 97654.35 = 9x104 + 7x103 + 6x102 + 5x101 +

4x100 + 3x10-1 + 5x10-2

Informal notation (97654.35)10

Page 3: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Understanding Binary Numbers

Binary numbers are made of binary digits (bits): 0 and 1

Number representation: (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10

What about fractions? (110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2

Groups of eight bits are called a byte (B) (11001001) 2

Page 4: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Convert an Integer from Decimal to Another Base

1. Divide decimal number by the base (e.g. 2)

2. The remainder is the lowest-order digit

3. Repeat first two steps until no divisor remains.

For each digit position:

Example for (13)10:

IntegerQuotient

13/2 = 6 1 a0 = 1 6/2 = 3 0 a1 = 0 3/2 = 1 1 a2 = 1 1/2 = 0 1 a3 = 1

Remainder Coefficient

Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2

Page 5: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Convert a Fraction from Decimal to Another Base

1. Multiply decimal number by the base (e.g. 2)

2. The integer is the highest-order digit

3. Repeat first two steps until fraction becomes zero.

For each digit position:

Example for (0.625)10:

Integer

0.625 x 2 = 1 + 0.25 a-1 = 10.250 x 2 = 0 + 0.50 a-2 = 00.500 x 2 = 1 + 0 a-3 = 1

Fraction Coefficient

Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2

Page 6: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The Growth of Binary Numbersn 2n

0 20=1

1 21=2

2 22=4

3 23=8

4 24=16

5 25=32

6 26=64

7 27=128

n 2n

8 28=256

9 29=512

10 210=1024

11 211=2048

12 212=4096

20 220=1M

30 230=1G

40 240=1T

Mega

Giga

Tera

Kilo

250=Peta

Page 7: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Binary Addition

Binary addition is very simple. This is best shown in an example of adding two binary

numbers… Procedure easy to implement by circuits

1 1 1 1 0 1+ 1 0 1 1 1---------------------

0

1

0

1

1

1111

1 1 00

carries

Page 8: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Binary Subtraction

° We can also perform subtraction (with borrows in place of carries).

° Let’s subtract (10111)2 from (1001101)2…

° Procedure hard to implement by circuit

1 100 10 10 0 0 10

1 0 0 1 1 0 1- 1 0 1 1 1------------------------ 1 1 0 1 1 0

borrows

Page 9: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Binary Multiplication

Binary multiplication is much the same as decimal multiplication, except that the multiplication operations are much simpler…

1 0 1 1 1X 1 0 1 0----------------------- 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1 1----------------------- 1 1 1 0 0 1 1 0

Page 10: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Binary Data Storage & Representation

• Binary cells store individual bits of data

• Multiple cells form a register.

• Data in registers can indicate different values

• Hexadecimal: (41)16=(65)10

• BCD (Binary Coded Decimal): (41)10

• ASCII (American Standard Code for Information Interchange): letter “A”

Binary Cell

0 1 0 0 0 0 0 1

Page 11: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Register Transfer

Data can move from register to register. Digital logic used to process data. We will learn to design this logic.

Register A Register B

Register C

Digital Logic Circuits

Page 12: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Digital Systems

Analysis problem:

Determine binary outputs for each combination of inputs

Design problem: given a task, develop a circuit that accomplishes the task Many possible implementations. Try to develop “best” circuit based on some criterion

(size, power, performance, etc.)

··

··

LogicCircuitInputs Outputs

Page 13: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Boolean Algebra

George Boole 1815-1864 English mathematician Boolean algebra or Boolean logic

Sound and complete system Everything is either true or false, and can proven Nothing is unknown Case closed

In contrast, mathematics about integers are incomplete

Many things can NOT be proven true nor false Godel’s incomplete theorem Endless effort …

Page 14: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Boolean Algebra

A Boolean algebra is defined as a closed algebraic system containing a set of elements Every variable can take only two values 0 or 1 Only two operators, * and +

Identity elements a + 0 = a a * 1 = a

0 is the identity element for the + operation·

1 is the identity element for the * operation·

Page 15: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Commutativity and Associativity of the Operators

The Commutative Property: For every a and b a + b = b + a a * b = b * a

The Associative Property: For every a, b, and c a + (b + c) = (a + b) + c a * (b * c) = (a * b) * c

Page 16: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The Distributive Property

The Distributive Property:For every a, b, and c, a + ( b * c ) = ( a + b ) * ( a + c ) a * ( b + c ) = ( a * b ) + ( a * c )

Page 17: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Distributivity of the Operators and Complements

The Existence of the Complement:For every a there exists a unique element called a’ (complement of a) such that, a + a’ = 1 a * a’ = 0

To simplify notation, the * operator is frequently omitted. When two elements are written next to each other, the AND (*) operator is implied… a + b * c = ( a + b ) * ( a + c ) a + bc = ( a + b )( a + c )

Page 18: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Claude Shannon 1916-2001

American mathematician Father of information theory and

cryptography In 1937, at age 21, he was a

master student at MIT Noticed engineers were messing

around with logic circuits without a sound foundation

Wrote the “most important master’s thesis of all time” to demonstrate Boolean algebra could be used to resolve any logical relationship

Since then, Boolean algebra becomes widely used

Page 19: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Describing Circuit Functionality: Inverter

Basic logic functions have symbols. The same functionality can be represented

with truth tables· Truth table completely specifies outputs for all

input combinations. The above circuit is an inverter.

An input of 0 is inverted to a 1. An input of 1 is inverted to a 0.

A Y

0 1

1 0

Input Output

A Y

Symbol

Truth Table

Page 20: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The AND Gate

This is an AND gate Logic operation Y= A* B So, if the two inputs signals

are asserted (high) the output will also be asserted.Otherwise, the output willbe deasserted (low).

A B Y

0 0 0

0 1 0

1 0 0

1 1 1

A

BY

Truth Table

Page 21: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The OR Gate

This is an OR gate. Logic operation Y = A+B So, if either of the two

input signals are asserted, or both of them are, the output will be asserted.

Note: If there are n inputs, then the truth table will have 2n rows. Since we can fill any of the entries on output with 0 or 1, there are 2^2^n ways to fill a truth table of n input. Therefore, there are 2^2^n gates of n input

A B Y

0 0 0

0 1 1

1 0 1

1 1 1

AB

Y

Page 22: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The NAND Gate

This is a NAND gate. It is a combination of an AND gate followed by an inverter. Its truth table shows this.

A B Y

0 0 1

0 1 1

1 0 1

1 1 0

AB

Y

Page 23: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The NOR Gate

This is a NOR gate. It is a combination of an OR gate followed by an inverter. It’s truth table shows this A B Y

0 0 1

0 1 0

1 0 0

1 1 0

AB

Y

Page 24: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

The XOR Gate (Exclusive-OR)

This is a XOR gate. XOR gates assert their output

when exactly one of the inputsis asserted, hence the name.

The switching algebra symbolfor this operation is , i.e.1 1 = 0 and 1 0 = 1.

A B Y

0 0 0

0 1 1

1 0 1

1 1 0

AB

Y

Page 25: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Describing Circuit Functionality: Waveforms

Waveforms provide another approach for representing functionality.

Values are either high (logic 1) or low (logic 0). Can you create a truth table from the waveforms?

A B Y

0 0 0

0 1 0

1 0 0

1 1 1

AND Gate

Page 26: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Consider three-input gates

3 Input OR Gate

Page 27: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Ordering Boolean Functions

How to interpret A · B+C? Is it A · B ORed with C ? Is it A ANDed with B+C ?

Order of precedence for Boolean algebra: AND before OR.

Note that parentheses are needed here :

Page 28: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Toll Booth Controller

Consider the design of a toll booth controller. Inputs: quarter, car sensor. Outputs: gate lift signal, gate close signal

If driver pitches in quarter, raise gate. When car has cleared gate, close gate. Call quarter detector signal Q, car detector C Call raise gate signal R=Q*C, and lower gate

signal L=C’

LogicCircuit

$0.25?

Car?

Raise gate

Close gate

Page 29: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Boolean Algebra

Page 30: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Boolean Algebra

A Boolean algebra is defined with: A set of elements S={0,1} A set of operators A number of unproved axioms or

postulates

Page 31: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Boolean Algebra (cont.)

A binary operator: Defined on a set S of elements A rule that assigns to each pair of

elements from S a unique element from S Example a*b=c aS and bS it must hold that a*bS

A set S is closed with respect to a binary operator if for every two elements of S, the binary operator specifies a unique element of S

Page 32: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Definition of Boolean Algebra Boolean algebra is an algebraic

structure, defined by a set of elements S and two binary operators, +, and ·, with the following postulates:1. The structure is closed with respect to +

and *2. Element 0 is an identity element for +

Element 1 is an identify element for * x+0=0+x=x x · 1=1 · x=x

Page 33: ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering.

Definition of Boolean Algebra (cont.)

3. The structure is commutative with respect to + and · :

a + b = b + a a · b = b · a

4. The operator · is distributive over +The operation + is distributive over ·

a · ( b + c ) = ( a · b ) + ( a · c ) a + ( b · c ) = ( a + b ) · ( a + c )