Sei sulla pagina 1di 45

2009 Spring CS211 Digital Systems & Lab

CHAPTER 2: INTRODUCTION TO LOGIC CIRCUITS

What will we learn?


2

Logic functions and circuits Boolean Algebra g Logic gates and Synthesis CAD t tools l and d VHDL
Read

Section 2.9 and 2.10

2009 Spring CS211 Digital Systems & Lab

Terminology
3

Di it l circuits Digital i it
Signal values restricted to a few discrete values Binary logic circuit two values, values 0 and 1

Why do we use the binary circuit?

Multi valued logic Multi-valued


More than two values Some flash devices use multi-valued data storage

Multi-level cell(MLC) capable of storing 2 bits of data per cell

Not covered in this class

Analog circuits
2009 Spring CS211 Digital Systems & Lab

Example of Binary logic


4

Binary switch
open open closed closed

x = 0
Input variable

x = 1 (a) Two states of a switch

S x (b) Symbol for a switch


2009 Spring CS211 Digital Systems & Lab

Application of a switch
5

S Battery x Light

(a) Simple connection to a battery

Output
State S

of f the h light li h : L =1 1 if the h light li h i is on, L=0 L 0 (off) ( ff) The state of the light can be described as a function of the h input variable bl x L(x) = x : logic function
2009 Spring CS211 Digital Systems & Lab

Basic two functions


6

S Power supply l x1

S x2 Light

L(x1,x2) = x1 x2 or (x1 x x2 ) where L=1 if x1 = 1 and x2=1, L=0 otherwise

(a) The logical AND function (series connection) S x1 Power supply S x2 (b) The logical OR function (parallel connection)
2009 Spring CS211 Digital Systems & Lab

Light

L(x1,x2) = x1 + x2 where L=0 if x1 = x2=0, L=1 otherwise

Series-Parallel Series Parallel Connection


7

S
X1

S
X3

Power supply

S
X2

Light

Logic function ?
2009 Spring CS211 Digital Systems & Lab

Inversion
8

R Power supply

Light

Inverse of a value

Complement of a value The NOT operation

Several commonly used notations x = x = !x = NOT x = ~x The complement operation can be applied to more complex operations f(x1,x x2) = x1+x2
2009 Spring CS211 Digital Systems & Lab

Truth Tables: AND and OR


9

Useful aid for depicting information involving logic functions Grow exponentially p y in size with the number of variables
2009 Spring CS211 Digital Systems & Lab

Three input AND and OR


10

Table size : n inputs ? = 2n


2009 Spring CS211 Digital Systems & Lab

Possible logic functions of two variables


11

16 possible functions f nctions of 2 input inp t variables ariables N inputs : 2**(2**n)


X Y 0 0 1 1 0 1 0 1 0 X and Y 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 X 0 1 0 0 0 1 0 1 Y 0 1 1 0 0 1 1 1 1 0 0 0

X Y

1 0 0 1

1 0 1 0

1 0 1 1

1 1 0 0

1 1 0 1

1 1 1 0

1 1 1 1 1 X nand Y

X or Y

X=Y

not X not Y

X xor Y

X nor Y

Complete Set : a set of function is complete iff every Boolean function can be generated by a combination of the functions

{NAND}, {NOR}, {AND, NOT} {AND, OR} ?


2009 Spring CS211 Digital Systems & Lab

Basic Gates
12

x1 x2

x1 x2 x1 x2 xn (a) AND gates

x1 x2 xn

x1 x2

x1 x2 x1+ x2 xn (b) OR gates

x1+ x2+ + xn

x ( ) NOT gate (c) t

2009 Spring CS211 Digital Systems & Lab

An AND AND-OR OR Function


13

S
X1

S
X3

Power supply

S
X2

Light

x 1 x 2 x 3
x x x 1 2 3 1

f = (x + x ) x 1 2 3

f = ( x + x ) x3 1 1 2

2009 Spring CS211 Digital Systems & Lab

Analysis of a Logic Network


14

Analysis and Synthesis


x1 0 0 1 1 1 1 0 0 A 00 01 B f = x1 + x1x2 1 1 0 1 f 0 1 0 1

x2

(a) Network that implements

f (x , x )
1 2

A 1 1 0 0

B 0 0 0 1

0 0 1 1

0 1 0 1

1 1 0 1

(b) ( ) Truth table 2009 Spring CS211 Digital Systems & Lab

Timing Diagram
15

Ti i Di Timing Diagram

Changes in signals at various points are presented in graphical form Also useful method for indicating the functional behavior
x1 0 0 1 1 0 1 0 1 1 1 0 0 A 0 0 01 B 1 1 0 1 f

x x1 1 0 x2 1 0 1 A 0 B 1 0 1 f 0

waveform
Time (c) Timing diagram 2009 Spring CS211 Digital Systems & Lab

Functionally Equivalent Networks


16

x1 + x1 x2 = x1 + x2
x1 0 0 1 1 1 1 0 0 A 0 0 01 B f = x1 + x1x2 1 1 0 1 f

x2

0 1 0 1

(a) Network that implements x 1 x 2 0011 0101 1100

1 1 0 1

(d) Network that implements

g = x +x 1 2

2009 Spring CS211 Digital Systems & Lab

Functionally Equivalent Networks(cont Networks(contd) d)


17

A logic l i function f ti can be b implemented i l t d

with a variety of different networks, probably having different costs How do we find the best implementation for a given function?

This raises an important question


What is the best implementation?

Many techniques for synthesizing logic functions


Discussed in Chapter 4 Through the Truth Table Algebraic(Boolean) manipulation of logic expressions

One more question


Why we call them functionally equivalent?
2009 Spring CS211 Digital Systems & Lab

What will we learn?


18

Logic functions and circuits Boolean Algebra g Logic gates and Synthesis CAD t tools l and d VHDL
Read

Section 2.9 and 2.10

2009 Spring CS211 Digital Systems & Lab

Boolean Algebra
19

I 1849 George In G B Boole l

A scheme for the algebraic description of processes involved in logical thought and reasoning Boolean algebra provides an effective means of describing circuits built with switches A set of element B = {0, 1} Binary operation { +(OR), (AND) } And a unary operation { (NOT)} Such that the following axioms hold :

In the late 1930 Claude Shannon showed

A Boolean algebraic structure consists of


2009 Spring CS211 Digital Systems & Lab

Axioms and theorems of Boolean Algebra g


20

Axioms A i Single-variable theorems Two-and Three-variable properties p p Duality


A dual of a Boolean expression is derived by replacing by +, + by , 0 by 1, 1 and 1 by 0, 0 and leaving variables unchanged Dual of any true statement is also true X+Y+XY XY=X+Y X+Y=XY

DeMorgans theorem

Boolean algebra read section 2.5


2009 Spring CS211 Digital Systems & Lab

Proof of DeMorgans DeMorgan s Theorem


21

2009 Spring CS211 Digital Systems & Lab

Notation and Precedence of Operations


22

Logical sum and logical product operations


The

OR and AND operations Say simply sum and product Product terms and Sum terms
xy

: product term (xy) x+y : sum term

Precedence
In

the order: NOT, NOT AND AND, and then OR

2009 Spring CS211 Digital Systems & Lab

From Boolean expressions to logic gates


23

NOT AND OR

notation t ti X X ~X XY XY X^Y X+Y XY

gate t

truth t th table t bl

NAND XY NOR XOR X+Y XY (XY+XY)

XNOR X = Y ( (XY+XY) )
2009 Spring CS211 Digital Systems & Lab

What will we learn?


24

Logic functions and circuits Boolean Algebra g Logic gates and Synthesis CAD t tools l and d VHDL
Read

Section 2.9 and 2.10

2009 Spring CS211 Digital Systems & Lab

Logic functions and Boolean Algebra


25

Any logic function that can be expressed as a truth table written as an expression in Boolean algebra Implementing an arbitrary logic function
Derive

the truth table sum of these product terms

C Create the h product d term for f which hi h output has h a value l of f1

Logical

2009 Spring CS211 Digital Systems & Lab

Example
26

f = x1x2 + x1x2 + x1x2

Logic function

x1 x2
Af function ti to t be b synthesized. th i d

(a) Canonical sum-of-products x1 x2

f (b) Minimal-cost realization

2009 Spring CS211 Digital Systems & Lab

What is the best realization?


27

Reduce number of inputs

Literal : input variables (complemented or not)


Can approximate cost of logic gate as 2 transistors per literal Fewer literals means less transistors Fewer F inputs i implies i li f faster gates Fan-ins (# of gate inputs) are limited in some technologies

R d Reduce number b of f gates t

Fewer gates means smaller circuits Propagation delays


2009 Spring CS211 Digital Systems & Lab

Reduce number of levels of gates

Tradeoffs between circuit delay and size?


28

How do H d we explore l tradeoffs t d ff between b t circuit i it delay d l and d size?


Tools to g generate different solutions Logic minimization: reduce number of gates and complexity Logic optimization: reduction of complexity while trading off against delay (or power consumption)

Are all realizations equivalent?


Static and dynamic behavior Number of gate levels and structure D l Delays are diff different t Glitches (hazards) may arise Cost
2009 Spring CS211 Digital Systems & Lab

29

Implementing Boolean functions (Synthesis)

Technology independent
Canonical

forms Two-level forms Multi-level forms

Technology choices (or Mapping)


Packages

of a few gates Two-level programmable logic Multi-level programmable logic


2009 Spring CS211 Digital Systems & Lab

Canonical forms
30

Truth table
A

unique signature of a Boolean function Many alternative gate realizations Many alternative Boolean expressions drawback?

Canonical forms
Standard

forms for a Boolean expression p A unique algebraic signature Using g Truth table
2009 Spring CS211 Digital Systems & Lab

Canonical Forms (cont (contd) d)


31

Mi t Minterm

ANDed product of literals Product term in which each of input variables or its complement appears once ORed sum of literals Sum term in which each of input variables or its complement appears once

Maxterm

2009 Spring CS211 Digital Systems & Lab

Sum-of-Products Sum of Products Form


32

A function f ti can be b represented t d by b


Sum of Product form Product of Sum form

Disjunctive normal form (minterm expansion)

f = m0 1 + m1 1 +m2 0 +m3 1 = m0 + m1 + m3 = m(0,1,3) ( ) = x 1x 2 + x 1x 2 + x 1x 2

Sum of Products (SOP) form Sum-of-Products

Canonical sum-of-products

If each product term is a minterm


2009 Spring CS211 Digital Systems & Lab

Canonical SOP example


33

f = x1x2 + x1x2 + x1x2

Logic function

x1 x2
A function to be synthesized.

( )C (a) Canonical i l sum-of-products f d t

2009 Spring CS211 Digital Systems & Lab

Example
34

Canonical SOP (simplest form??) f(x1,x2,x3) = m1+m4+m5+m6 = x2x3 + x1x3

SOP

x2 f x3 x1 (a) A minimal sum-of-products realization


2009 Spring CS211 Digital Systems & Lab

Product-of-Sums Product of Sums (POS) Form


35

Conjunctive C j ti normal l form f (M (Maxterm t expansion) i ) f(x1,x2) = m2 = x1x2 f(x1,x x2) = f = x1x2 = x1+x2 = M2 In the previous example
f(x1,x2,x3) = M0 M2 M3 M7 = (x1+x3)(x2+x3)

x1 x3 f x2 (b) A minimal product-of-sums realization

2009 Spring CS211 Digital Systems & Lab

NAND and NOR Logic networks


36

NAND and NOR functions are attractive


Why?
x1 x2 x1 x2 xn
(a) NAND gates

x1 x2 x1 x2 xn

x1 x1 x2 x2 x1 + x2 xn
(b) NOR gates

x1 + x2 + + xn

2009 Spring CS211 Digital Systems & Lab

DeMorgans DeMorgan s theorem in terms of logic gates


37

Its logic gate interpretation


x1 x2 (a) x1 x2

x1 x2

x1x2 = x1 + x2

x1 x2

x1 x2 (b)

x1 x2

x1 + x2 = x1x2

2009 Spring CS211 Digital Systems & Lab

NAND-NAND NAND NAND Network


38

x1 x2 x3 x4 x5

x1 x2 x3 x4 x5

x1 x2 x3 x4 x5
2009 Spring CS211 Digital Systems & Lab

NOR-NOR NOR NOR Network


39

x1 x2 x3 x4 x5

x1 x2 x3 x4 x5

x1 x2 x3 x4 x5

2009 Spring CS211 Digital Systems & Lab

40

Design Example : Three-way light controller

Assume that A th t a large l room has h three th doors d and d that th t a switch it h near the th door controls a light in the room

Turn the light on or off by changing the state of any one Turn this word statement into a formal specification using a truth table

Design

Let x1, x2, and x3 be the input p variables that denote the state of each switch The light is off if all switches are open The light is on if any one of the switches is closed The light is off if two (or no) switches are closed The light is on if all switches are closed

In which case the light is on?


The required functional behavior can be specified in the truth table

2009 Spring CS211 Digital Systems & Lab

Design g Example p : Three-way y light g controller


41

x1 x2 x3
(a) Sum-of-products realization

x3 x2 x1
f

(b) Product-of-sums realization

2009 Spring CS211 Digital Systems & Lab

Design Example: Multiplexer Circuit


42

M lti l Multiplexer

A circuit that generates an output that exactly reflects the state of one of a number of data inputs, based on the value of one or more selection control inputs Two sources of data(x1 , x2)and one output(f) A selection control signal s Assume

Suppose

If s=0, f=x1 If s=1, f=x2

These requirements can be specified in the form of a truth table in the next slide
2009 Spring CS211 Digital Systems & Lab

Design Example: Multiplexer Circuit


43

s x1 x2 000 001 010 011 100 101 110 111

f (s, x1, x2) 0 0 1 1 0 1 0 1 s f (s, x1, x2) 0 x1 1 x2 s x2 (b) Circuit x1 f s x1 x2 0 1

(c) Graphical symbol

(a)Truth table

d) More compact truth-table representation

Can we implement it using NAND gate?


2009 Spring CS211 Digital Systems & Lab

What will we learn?


44

Logic functions and circuits Boolean Algebra g Logic gates and Synthesis CAD t tools l and d VHDL
Read

Section 2.9 and 2.10

2009 Spring CS211 Digital Systems & Lab

CAD Tools and VHDL


45

TA will teach you these topics next week Experiment p on several circuits using g CAD tools and VHDL

2009 Spring CS211 Digital Systems & Lab

Potrebbero piacerti anche