22C:19 Discrete Math

advertisement

MA251 Computer Organization and

Architecture [3-0-0-6]

Lecture 1:

Introduction,

Logic gates,

Boolean algebra, Canonical Forms

Spring 2011

Partha Sarathi Mandal

Time Table

Syllabus

Number Systems: representations of numbers (binary, octal, decimal, and hexadecimal), arithmetic of signed and unsigned numbers;

Boolean algebra and logic gates: gate level minimization of Boolean functions;

Combinational logic circuits: design and analysis, some standard combinational circuits (encoders, decoders, multiplexers); Sample and hold Circuits, analog-todigital converter, digital-to-analog converter.

Synchronous sequential logic circuits: design and analysis; flip-flops, registers, counters;

Finite state model: state tables and state diagram, state minimization;

Memory organization: hierarchical memory systems, cache memories, cache coherence, virtual memory;

System buses: interconnection structures and bus interconnection, Arithmetic

Logic Unit.

Study of an existing CPU: architecture, instruction set and the addressing modes supported; assembly language programming;

Control unit design: instruction interpretation, hardwired and microprogrammed methods of design; RISC and CISC paradigms. I/O transfer techniques: programmed, interrupt-driven and DMA; I/O processors and channels, mapping of

I/O addresses.

Tests and Marks distribution

Marks distribution:

Quizzes + Assignments:

Mid Semester:

End Semester:

30%

30%

40%

There may be pop quizzes (without prior warning or announcement) in the classes.

If any one fails to write any of the quizzes or the mid-semester examination then NO make-up examination will be conducted .

The portion (syllabus) for Mid-semester examination will be in general from the first lecture to the last lecture just before the mid semester examination.

The end-semester examination will cover all topics.

Reference Books

M. Morris Mano, “Digital Logic and Computer Design”,

10th impression ,Pearson Education, Inc., 2008.

M. M. Mano, “Digital Design”, 3rd Edition, Pearson

Education Asia, 2002.

D.A. Pattersonand J.L. Hennessey, "Computer

Organization and Design: The Hardware/Software

Interface", Morgan Kaufman

J.L. Hennesseyand D.A. Patterson, "Computer

Architecture: A Quantitative Approach ", Morgan

Kaufman

Road Map

Oper. Sys

Computer Organization and Architecture

Logic Design

Boolean Algebra & Digital Logic

Boolean Algebra

In 1938,

Shannon

showed how the basic rules of logic first given by

George Boole

in his 1854 publication

The Laws of Thought

, can be used to design circuits that enables computer hardware to perform various arithmetic and logical operation. These rules form the basis of Boolean Algebra. These rules involve two

Symbols 1 and 0 (synonymous with true the operators AND, OR, NOT.

and false ) and

Boolean Algebra

Electric Switches and Logical Networks

Electric Switches and Logical Networks

Boolean Algebra

Developed mid-1800’s by George Boole to formalize human thought

Ex: “I’ll go to lunch if Mary goes OR John goes, AND Sally does not go.”

Let F represent my going to lunch (1 means I go, 0 I don’t go)

Likewise, m for Mary going, j for John, and s for Sally

Then

F = (m OR j) AND NOT(s)

Nice features

Formally evaluate

– m=1, j=0, s=1 --> F = (1 OR 0) AND NOT(1) = 1 AND 0 = 0

Formally transform

F = (m and NOT(s)) OR (j and NOT(s))

Looks different, but same function

Evaluate the Boolean equation:

F = (a AND b) OR (c AND d)

What is the value of F ?

1. when a=1, b=1, c=1, d=0.

2. when a=0, b=1, c=0, d=1.

NOT/OR/AND

Logic Gate Timing Diagrams

Building Circuits Using Gates

Motion-in-dark Detector

Turn on lamp (F=1) when motion sensed (a=1) and no light (b=0)

F = a AND NOT(b)

Build using logic gates, AND and NOT, as shown

Which circuit corresponds to the Boolean

Equation: F = a AND NOT( b OR NOT(c) )

Example: Seat Belt Warning Light System

Basic Logic Gates

Circuits to Equations

Circuits to Equations

Equations to Circuits

Implementing XOR

Boolean function

An n-variable Boolean function f : {0.1} n

{0,1}

It can be expressed as a truth table.

Boolean Algebra Properties

Commutative

A+B = B+A

A.B=B.A

Distributive

A.(B+C)=A.B+A.C

A+(B.C)=(A+B).(A+C)

Associative

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

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

Identity

0+A=A+0=A

1.A=A.1=A

Complement

A+A’ = 1

A.A’=0

Ex 1: Show x+x’.z

equivalent to x+z.

x+x’.z = (x+x’).(x+z)

= 1.(x+z)

= x+z

Ex 2: Can xx’+xy(x’+y’) ever evaluate to 1?

xx’+xy(x’+y’)

=xx’+xyx’+xyy’

=xx’+yxx’+xyy’

=0+y.0+x.0

=0+0+0

=0

Boolean Algebra Properties

Null elements

A+1= 1

A.0=0

Idempotent Law

A+A=A

A.A=A

Involution

(A’)’=A

DeMorgan’s Law

(A+B)’=A’.B’

(A.B)’=A’+B’

Complement

A+A’ = 1

A.A’=0

Ex 1: Show x+x.z equivalent to x.

x+x.z

= x.1+x.z as x=x.1

= x.(1+z) distributive law

= x.1 as A+1=1

= x Identity

Dual of the above equation

: x.(x+z)=x

-

Every

Boolean eq

. has a dual, which is found by interchanging AND and OR operators and replacing 0's by 1's and 1's by 0's.

x.(x+z)

= x.x+x.z = x+ x.z =x

Note that the brackets are added to maintain the evaluation order.

The principle of Duality

Any algebraic equality derived from the axioms of Boolean algebra remains true when the operators (.) and (+) are interchanged and the identity elements 0 and 1 are interchanged.

For example: x +1=1 --> x.0 = 0 (Dual)

Examples

The dual of (x . 1 ).(0 + x') = 0 is

(x + 0)+(1 . x') = 1 dual of (x + y).(y + z) = x.z + y is x.y + y.z = (x + z).y

Representation of Boolean Functions

A function can be represented in different ways

Here are seven representations of the same function using four different methods:

English, Equation, Circuit

, and

Truth Table

Truth Table Representation of Boolean

Functions

Define value of F for each possible combination of input values

2-input function: 4 rows

3-input function: 8 rows

4-input function: 16 rows

Converting among Representations

Can convert from any representation to any other

Common conversions

Equation to circuit (we did this earlier)

Truth table to equation (which we can convert to circuit)

Easy -- just OR each input term that should output 1

Equation to truth table

Easy -- just evaluate equation for each input combination(row)

Creating intermediate columns helps

Q: Convert to equation

ab’c abc’ abc

Standard Representation: Truth Table

How can we determine if two functions are the same ?

Is f = c’(hp + hp’ + h’) the same as g = hc’ + h’pc’?

Use algebraic methods

But if we failed, does that prove not equal?

No.

Solution: Convert to truth tables

Only ONE truth table representation of a given function

Standard

representation – for given function, only one version in standard form exists.

But, truth tables too big for numerous inputs f = c’(hp + hp’ + h’) f = c’( h(p + p’) + h’ ) f = c’( h + h’ ) f = c’

So…are they equal ?

Q: Determine if F=ab+a’ is same function as F=a’b’+a’b+ab, by converting each to truth table first

Canonical Forms

Canonical Forms

A

canonical form

is a standard way of writing an equation—a shape or form of equation.

Canonical forms are useful for example in algorithms for logic gates such as logic minimization and checking if boolean expressions are equal.

Canonical Forms-Minterms

One common canonical form is a sum of

minterms

.

Minterms: A minterm is simply a product term

(i.e., a conjunction) containing each input variable appearing

exactly once

, in true or complemented form: eg (for 3 variables A, B,

C): ABC, AB’C’, A’BC, ABC’ but not B’C’

Canonical Form - Sum of Minterms

Q: Determine if F(a,b)=ab+a’ is same function as

F(a,b)=a’b’+a’b+ab, by converting first equation to canonical form (second already in canonical form)

F = ab+a’ (already sum of products)

F = ab + a’(b+b’) (expanding term)

F = ab + a’b + a’b’ (SAME -- same three terms as other equation)

The canonical form derived from truth table

One advantage of the canonical form is that it directly represents the truth table.

Consider the minterm: A’BC

This has value 1 iff A=0, B=1 and C=1.

So a minterm in the canonical form corresponds to a row in the truth table which has an output of 1

Example: The majority voter

(Returns 1 iff the majority of the inputs is 1)

So X = A’BC + AB’C + ABC’ + ABC

The canonical form derived from eqs.

The canonical form can also be found from equations by a process known as augmentation .

Consider X = BC + A’BC’

We know that (A+A') = 1 and so we can write

X = (A+A’)BC + A’BC’

X = ABC+A’BC + A’BC’

derived from eqs. Contd..

The canonical form is simply a sum of minterms

(ie a disjunction of conjuncts) also known as sum of products (SOP) :

X

1

= ABC + AB’C’ + A’BC

Note that, for example

X

2

= BC + B’ + A’BC is a valid Boolean equation, but is not in canonical form.

Convert R

2 to a canonical form

Canonical Forms-Maxterms

Any boolean expression may be expressed in terms maxterms .

A maxterm is the sum of N distinct literals where each literal occurs

exactly once

(where a minterm is the product of N distinct literals where each literal occurs

exactly once

)

Also known as products of sum (POS)

Example:

F= (x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)

Note: sum of mintrems also known as sum of products (SOP)

Canonical Forms-Minterm/Maxterms

For a three-variable expression, the minterms and maxterms are as follows

0

0

1

1

1

Y

0

0

1

1

1

0

0

1

X

0

0

1

0

1

0

1

0

Z

0

1

1

Minterm

X'.Y'.Z'

X'.Y'.Z

X'.Y.Z'

X'.Y.Z

X.Y'.Z'

X.Y'.Z

X.Y.Z'

X.Y.Z

Designation m

0 m

1 m

2 m

3 m

4 m

5 m

6 m

7

Maxterm

X+Y+Z

X+Y+Z'

X+Y'+Z

X+Y'+Z'

X'+Y+Z

X'+Y+Z'

X'+Y'+Z

X'+Y'+Z'

Designation

M

0

M

1

M

2

M

3

M

4

M

5

M

6

M

7

Short Notation

Mintrem

F = A’BC’ + A’BC + ABC

F(A,B,C)=

(2,3,7)

Maxterm

F= (x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)

F(x,y,z)=

(0,1,2,4)

Product of maxterms from truth table

Now consider complement of a Boolean function i.e., products a 0 in the function and then ORing those terms

F’

1

=x’y’z’+x’y’z+x’yz’+xy’z’=m

0

+m

1

+m

2

+m

4

Now take complement of F’

F

1

1

=(x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)

=M

0

M

1

M

2

M

4

Any Boolean function can be expressed as a product of maxterms (

i

) directly or

(

ii

) complementing SOP.

Try for F

2 function 1

1

1

1

0

0

x

0

0

0

1

0

1

1

0

z

0

1

1

1

0

0

0

1

y

0

1

0

0

1

0

1

0

F

2

1

0

1

1

0

1

0

0

F

1

0

1

Exercises

1. Express Boolean function F=x+y’z in a sum of mintrms (SOP).

Ans:f=x(y+y’)+y’z(x+x’)=….

=x’y’z+xy’z’+xy’z+xyz’+xyz

2. Express F=xy+x’z in a product of maxterms

(POS).

Ans: xy+x’z=(xy+x’)(xy+z)=()(x+z)(y+z)=()()(y+z+xx’)

=()()(x+y+z)(x’+y+z)

16 possible Boolean algebraic functions for 2 variables

Download