1 Binary storage & registers. CS 151 Binary Variables Recall that the two binary values have...

50
1 inary storage & registers

Transcript of 1 Binary storage & registers. CS 151 Binary Variables Recall that the two binary values have...

1

Binary storage & registers

CS 151

Binary Variables• Recall that the two binary values

have different names:– True/False– On/Off– Yes/No– 1/0

• We use 1 and 0 to denote the two values.

• Variable identifier examples:– A, B, y, z, or X1 for now– RESET, START_IT, or ADD1 later

CS 151

Logical Operations• The three basic logical operations

are:– AND – OR– NOT

• AND is denoted by a dot (·). • OR is denoted by a plus (+).• NOT is denoted by an overbar ( ¯ ), a

single quote mark (') after, or (~) before the variable.

CS 151

• Examples:– is read “Y is equal to A AND B.”– is read “z is equal to x OR y.”

Notation Examples

Note: The statement: 1 + 1 = 2 (read “one plus one equals two”)

is not the same as1 + 1 = 1 (read “1 or 1 equals 1”).

= BAY ×yxz +=

AX = is read “X is equal to NOT A.”

CS 151

Operator Definitions

Operations are defined on the values "0" and "1" for each operator:

AND 

0 · 0 = 00 · 1 = 01 · 0 = 01 · 1 = 1

OR

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 1

NOT

10=01=

منطق دو دويي

CS 151

01

10

X

NOT

XZ=

Truth Tables• Truth table - a tabular listing of the values of a function for all

possible combinations of values on its arguments• Example: Truth tables for the basic logic operations:

111

001

010

000

Z = X·YYX

AND OR

X Y Z = X+Y

0 0 0

0 1 1

1 0 1

1 1 1

گيتهاي منطقي معادل

CS 151

• Using Switches– For inputs:

• logic 1 is switch closed • logic 0 is switch open

– For outputs:• logic 1 is light on • logic 0 is light off.

• NOT uses a switch such that:

• logic 1 is switch open• logic 0 is switch closed

Logic Function Implementation

Switches in series => AND

Switches in parallel => OR

CNormally-closed switch => NOT

بول جبر اصول

If a & b K a.b K

a+b K

:اصول اساسی

1اصل :

تعریف:برای هر و که متعلق به مجموعه ی هستند، و نیز به مجموعه ی

.تعلق دارند

.(و ، نامیده می شود ، )

aba.b

a+b

And a.bOr a+b

kk

x + 0 = x

اصول جبر بول:2اصل

:1و 0 موجودیت عناصر

x . 1 = x

x x + 0 x . 1

0 0 0

1 1 1

(3)اصول جبر بول

:3اصل

:. و +خاصیت عناصر x + y = y + x

x . y = y . xx y x.y y.x x+y y+x

0 0 0 0 0 0

0 1 0 0 1 1

1 0 0 0 1 1

1 1 1 1 1 1

x .(y + z) = x . y + x . z

:+ خاصیت توزیع پذیری + بر . و . بر

x +(y . z) = (x + y) . (x + z)

اصول جبر بول

x y z y.z x+y.z x+y x+z (x+y)(x+z)

0 0 0 0 0 0 0 00 0 1 0 0 0 1 0

0 1 0 0 0 1 0 0

0 1 1 1 1 1 1 11 0 0 0 1 1 1 1

1 0 1 0 1 1 1 11 1 0 0 1 1 1 11 1 1 1 1 1 1 1

آزمون درستی توزیع پذیری + بر . (2 )و . بر +

=

Postulates and Theorems of Boolean Algebra

Postulate 2 (a) x+0= x (b) x . 1 = xPostulate 5 (a) x + x = 1 (b) x . x = 0Theorem 1 (a) x + x = x (b) x . x = xTheorem 2 (a) x + 1 = 1 (b) x . 0 = 0Theorem 3, involution (x) = xPostulate 3, commutative (a) x+y = y+x (b) xy =yxTheorem 4, associative (a) x +(y+z) = (x+y)+z (b) x(yz)=(xy)zPostulate 4, distributive (a) x(y+z) = xy+xz (b) x+yz =(x+y)(x+z)Theorem 5, DeMorgen (a) (x +y) = xy (b) (xy)=x+yTheorem 6, absorption (a) x+xy =x (b) x(x+y)=x

نحوه نمايش توابع بوليبصورت تركيبي از عبارات و متغيرهاي بولي. •جدول صحت•مداري متشكل از گيتهاي منطقي•

CS 151 20

Logic Diagrams and Expressions

• Boolean equations, truth tables and logic diagrams describe the same function!

• Truth tables are unique; expressions and logic diagrams are not. This gives flexibility in implementing functions.

X

Y F

Z

Logic Diagram

Equation

ZY X F +=

Truth Table

11 1 1

11 1 0

11 0 1

11 0 0

00 1 1

00 1 0

10 0 1

00 0 0

X Y Z Z Y X F ×+=

YY Z

X + Y Z

CS 151 21

Boolean Operator Precedence

The order of evaluation in a Boolean expression is:1. Parentheses2. NOT3. AND4. OR

Consequence: Parentheses appear around OR expressions

Example: F = A(B + C)(C + D)

BME 231 DIGITAL DESIGN 22

BME 231 DIGITAL DESIGN 23

BME 231 DIGITAL DESIGN 24

BME 231 DIGITAL DESIGN 25

BME 231 DIGITAL DESIGN 26

BME 231 DIGITAL DESIGN 27

BME 231 DIGITAL DESIGN 28

BME 231 DIGITAL DESIGN 29

CS 151 30

Boolean Function Evaluationx y z F1 F2 F3 F4

0 0 0 0 0

0 0 1 0 1

0 1 0 0 0

0 1 1 0 0

1 0 0 0 1

1 0 1 0 1

1 1 0 1 1

1 1 1 0 1

z x yx F4x z yx zyx F3

x F2xy F1

+=+=

== z

yz+y+

Kindly view notes page for answer

BME 231 DIGITAL DESIGN 31

Boolean Functions

• Boolean algebra deals with binary variables and logic operations.

• Function results in binary 0 or 1

x00001111

y00110011

z01010101

F00001011 F = x(y+z’)

xy

zz’

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

BME 231 DIGITAL DESIGN 32

Boolean Functions

• Boolean algebra deals with binary variables and logic operations.

• Function results in binary 0 or 1

x00001111

y00110011

z01010101

xy00000011

x

y

z

G = xy +yz

yz

xy

We will learn how to transition between equation, symbols, and truth table.

yz00010001

G00010011

CS 151 33

Which Design is simpler?

Expression Simplification

F = XYZ + XYZ + XZ

= XY(Z + Z) + XZ = XY . 1 + XZ = XY + XZ

CS 151 34

Algebraic Manipulation

X Y Z X Z XYZ XYZ XZ XY XYZ+XYZ+XZ XY+XZ0 0 0 1 1 0 0 0 0 0 00 0 1 1 0 0 0 0 0 0 00 1 0 1 1 0 1 0 1 1 10 1 1 1 0 1 0 0 1 1 11 0 0 0 1 0 0 0 0 0 01 0 1 0 0 0 0 1 0 1 11 1 0 0 1 0 0 0 0 0 01 1 1 0 0 0 0 1 0 1 1

All possible combinations of 3 variables

Intermediate Results

(Terms in Function) F1 F2

CS 151 35

Algebraic Manipulation• How can we reduce Boolean expression in order to

simplify circuits?– Computer programs– Manual method (cut-and-try procedures)

• Examples:1. X + XY = X(1 + Y) = X2. XY + XY = X(Y + Y) = X3. X + XY = (X+X)(X+Y) = X+Y4. X(X+Y) = X + XY = X5. (X+Y)(X+Y) = X + YY = X6. X (X+Y) = XX + XY = XY

Dual of equations 1,2,3

(1)قوانین دمرگان

(x.y)’=x’+y’

(x+y)’=x’.y’

:این قانون می تواند به صورت زیر تعمیم پیدا کند

(x.y.....t)’=x’+y’+...+t’

(x+y+...+t)’=x’.y’.....t’

(duality) دوگان

0 1

duality

duality

And Or

duality

duality

:مثال

x+y’z x.(y’+z)دوگان

نحوه نمايش توابع بوليتوابع بولي را مي توان به چند طريق نمايش داد:•بصورت تركيبي نامرتب از عبارات و متغيرهاي بولي. •بصورت مجموع جمالت مي نيمم•بصورت حاصلضرب جمالت ماكزيمم•

يك عبارت حاصلضرب است كه همة : چند جمله اي مي نيمم•Y وجود دارد .متغيرها يا مكمل آنها حتما

+ f(A,B,C) = AB + A΄C جدول درستي را براي تابع: مثال ACبدست آوريد ΄.

ABC f(A,B,C) ABC f(A,B,C)

000 0 FFF F

001 1 FFT T

010 0 FTF F

011 1 FTT T

100 1 TFF T

101 0 TFT F

110 1 TTF T

111 1 TTT T

BME 231 DIGITAL DESIGN 40

Minterms , Maxterms and Canonical Forms

• Each variable in a Boolean expression is a literal• Boolean variables can appear in normal (x) or

complement form (x’)• Each AND combination of terms is a minterm• Each OR combination of terms is a maxterm

Minterms

x y z Minterm0 0 0 x’y’z’ m0

0 0 1 x’y’z m1

…1 0 0 xy’z’ m4

…1 1 1 xyz m7

Maxterms

x y z Maxterm0 0 0 x+y+z M0

0 0 1 x+y+z’ M1

…1 0 0 x’+y+z M4

…1 1 1 x’+y’+z’ M7

)(1) POS)) و ماکسترم ها SOP) مینترم

x y z x+y+z Minterm Maxterm

0 0 0 0 x’.y’.z’ m0 x+y+z M0

0 0 1 1 x’.y’.z m1 x+y+z’ M1

0 1 0 1 x’.y.z’ m2 x+y’+z M2

0 1 1 1 x’.y.z m3 x+y’+z’ M3

1 0 0 1 x.y’.z’ m4 x’+y+z M4

1 0 1 1 x.y’.z m5 x’+y+z’ M5

1 1 0 1 x.y.z’ m6 x’+y’+z M6

1 1 1 1 x.y.z m7 x’+y’+z’ M7

)(2) POS)) و ماکسترم ها SOP) مینترم

مینترمی بنویسید.تابع زیر را به صورتمثال:

x y F0 0 00 1 01 0 01 1 1

F (x , y) = x . y

. رسم جدول درستی1

. تعیین مینترم ها2

F (x , y) = F(2)

BME 231 DIGITAL DESIGN 43

Representing Functions with Minterms• Minterm number same as row position in truth table

(starting from top from 0)• Shorthand way to represent functions

x00001111

y00110011

z01010101

F00010011

F = xyz + xyz’ + x’yz

F = m7 + m6 + m3 = Σ(3, 6, 7)

BME 231 DIGITAL DESIGN 44

Truth Table to Expression

• Converting a truth table to an expression– Each row with output of 1 becomes a product term– Sum product terms together.

x00001111

y00110011

z01010101

F00010011

xyz + xyz’ + x’yz

Any Boolean Expression can be represented in sum of products form!

BME 231 DIGITAL DESIGN 45

Equivalent Representations of Circuits• All three formats are equivalent

• Number of 1’s in truth table output column equals AND terms for Sum-of-Products (SOP)

x y z

x00001111

y00110011

z01010101

F00010011

F = xyz + xyz’ + x’yz

F

x x x

x xx

xx x

BME 231 DIGITAL DESIGN 46

Reduced Hardware Implementation• Reduced equation requires less hardware!

• Same function implemented!

x y z

x00001111

y00110011

z01010101

F00010011

F = xyz + xyz’ + x’yz = xy + yz

F

x x

x x

BME 231 DIGITAL DESIGN 47

Conversion Between Canonical Forms

• Easy to convert between minterm and maxterm representations

• For maxterm representation, select rows with 0’sx00001111

y00110011

z01010101

F00010011

F = xyz + xyz’ + x’yz

F = m7 + m6 + m3 = Σ(3, 6, 7)

F = M0M1M2M4M5 = Π(0,1,2,4,5)

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

نحوه نمايش توابع بوليتوابع بولي را مي توان به چند طريق نمايش داد:•بصورت تركيبي نامرتب از عبارات و متغيرهاي بولي. •بصورت مجموع جمالت مي نيمم•بصورت حاصلضرب جمالت ماكزيمم•

يك عبارت حاصلضرب است كه همة : چند جمله اي مي نيمم•Y وجود دارد .متغيرها يا مكمل آنها حتما

تبديل بين شكلهاي متعارف

هرگاه يك تابع بولي بر حسب مجموع جمالت مي نيمم نوشته شده باشد ، مكمل آن برابر است با حاصلجمع جمالت

مينيممي كه از تابع اصلي حذف شده اند.بطور مشابه مي توان هر تابع بصورت مجموع جمالت مي نيمم را بصورت حاصلضرب جمالت ماكزيممي نوشت كه شماره هاي

متناظر آن از جمالت مينيمم، از تابع اصلي حذف شده اند.

مثال:

f1(A,B,C) = S m (2,3,6,7)

= f2(A,B,C)

= PM(0,1,4,5)

روش ديگرمي توان براي يافتن حاصلضرب جمالت ماكزيمم از مجموع •

جمالت مي نيمم نيز استفاده كرد. زير را بصورت حاصلضرب جمالت ماكزيمم نمايش تابعمثال: دهيد:

• f(A,B,C) = AB + AC΄ + A΄C

حل:

در مثال قبل اين تابع بولي را به صورت مجموع جمالت •:مي نيمم نمايش داديم

• f(A,B,C )=m(1, 3, 4, 6, 7)

بنابراين مي توان نوشت:f(A,B,C ) )=m(1, 3, 4, 6, 7)==П(0,2,4)