boolean algebra and digital logic - · pdf file · 2015-02-21boolean algebra and...

128
1 © 2009, University of Colombo School of Computing IT 1204 Section 3.0 Boolean Algebra and Digital Logic

Upload: phamcong

Post on 15-Mar-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

1© 2009, University of Colombo School of Computing

IT 1204Section 3.0

Boolean Algebra and Digital Logic

Page 2: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

2© 2009, University of Colombo School of Computing

Boolean Algebra

Page 3: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

3© 2009, University of Colombo School of Computing

A B X

0 0

0 1

1 0

1 1

Logic Equations to Truth Tables

ABBABAX ++= ..

Page 4: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

4© 2009, University of Colombo School of Computing

The OR operation performed on the products of the ANDoperation

Fill the corresponding cells with 1 for each product, the other cells with 0

A B X

0 0 1

0 1 1

1 0 0

1 1 1

Sum of Products

0,1

0,1

).().().(

==

==

++=

BB

AA

BABABAX

Page 5: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

5© 2009, University of Colombo School of Computing

The AND operation performed on the sums of the ORoperation

Fill the corresponding cells with 0 for each sum, the other cells with 1

A B X

0 0 1

0 1 1

1 0 0

1 1 0

Product of Sums

1,0

1,0

)).((

==

==

++=

BB

AA

BABAY

Page 6: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

6© 2009, University of Colombo School of Computing

A B X

0 0 1

0 1 1

1 0 0

1 1 0

• Sum of Products - consider 1s– Consider A=1,B=1

• Product of sums – consider 0s– Consider A=0,B=0

Truth Tables to Logic Equations

).().( BABAX +=

)).(( BABAX ++=

Page 7: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

7© 2009, University of Colombo School of Computing

Convert the following equation which is in the form of Product-of-sums into the form of Sum-of-products

Your Turn: Exercise1

))()()(()( CADBADCBACBAABCDf ++++++++=

Page 8: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

8© 2009, University of Colombo School of Computing

Answer: Exercise1

).()..()...()..()(

).()..()...()..()(

)()()()()(

))()()(()(

))()()(()(

CADBADCBACBAABCDf

CADBADCBACBAABCDf

CADBADCBACBAABCDf

CADBADCBACBAABCDf

CADBADCBACBAABCDf

+++=

+++=

+++++++++++=

++++++++=

++++++++=

Page 9: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

9© 2009, University of Colombo School of Computing

0 . 0 = 0

1 + 1 = 1

0 + 0 = 0

1 . 1 = 1

1 . 0 = 0 . 1 = 0

1 + 0 = 0 + 1 = 1

Boolean Postulates

Page 10: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

10© 2009, University of Colombo School of Computing

Commutative LawA + B = B + A

A B = B A

Associate Law(A + B) + C = A + (B + C)

(A B) C = A (B C)

Laws of Boolean Algebra

Page 11: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

11© 2009, University of Colombo School of Computing

Distributive LawA (B + C) = A B + A C

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

Identity LawA + A = A

A . A = A

Laws of Boolean Algebra

Page 12: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

12© 2009, University of Colombo School of Computing

Redundancy LawA + AB = A

A (A + B) = A

Demorgan’s Theorem

.

Laws of Boolean Algebra

BABA

BABA

+=

=+

).(

.)(

Page 13: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

13© 2009, University of Colombo School of Computing

.

.

Laws of Boolean Algebra

ABABA

ABABA

=++

=+

))((

..

00.0==+

AAA

Page 14: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

14© 2009, University of Colombo School of Computing

.

.

Laws of Boolean Algebra

AAA==+

.111

0.

1

=

=+

AA

AA

Page 15: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

15© 2009, University of Colombo School of Computing

.

Laws of Boolean Algebra

ABBAA

BABAA

=+

+=+

)(

.

Page 16: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

16© 2009, University of Colombo School of Computing

A Boolean function can be realised in either SOP or POS form

At this point, it would seem that the choice would depend on whether the truth table contains more 1s and 0s for the output function

The SOP has one term for each 1, and the POS has one term for each 0

Implementation of Boolean Functions

Page 17: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

17© 2009, University of Colombo School of Computing

However, there are other considerations:

It is generally possible to derive a simpler Boolean expression from truth table than either SOP or POS

It may be preferable to implement the function with a single gate type (NAND or NOR)

Implementation of Boolean Functions

Page 18: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

18© 2009, University of Colombo School of Computing

The significance of this is that, with a simpler Boolean expression, fewer gates will be needed to implement the function

Methods that can be used to achieve simplification are:

Algebraic Simplification

Karnaugh Maps

Implementation of Boolean Functions

Page 19: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

19© 2009, University of Colombo School of Computing

Simplify the following equation using Boolean algebra laws

Your Turn: Algebraic Simplification

))(()( CBACBAABCf +++=

Page 20: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

20© 2009, University of Colombo School of Computing

Answer: Algebraic Simplification

CBAABCf

CCBCBCBCBAABCf

CCBCACBBBACBAAAABCf

CBACBAABCf

+=

+++++=

+++++=

+++=

)(

)1()(

)(

))(()(

Page 21: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

21© 2009, University of Colombo School of Computing

For purposes of simplification, the Karnaugh map is a convenient way of representing a Boolean function of a small number (up to 4 to 6) of variables

The map is an array of 2n squares, representing the possible combinations of values of n binary variables

Karnaugh Maps

Page 22: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

22© 2009, University of Colombo School of Computing

The map can be used to represent any Boolean function in the following way:

Each square corresponds to a unique product in the sum-of-products form.

With a 1 value corresponding to the variable and a 0value corresponding to the NOT of that variable

Karnaugh Maps

Page 23: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

23© 2009, University of Colombo School of Computing

0 1

0 0 1

1 1 1

AB

Karnaugh Maps: 2 Values

ABBABAX ++= ..

Page 24: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

24© 2009, University of Colombo School of Computing

The AB corresponds to the fourth square in the Figure

For each such production in the function, 1 is placed in the corresponding square

1100 01 11 10

AB

F = AB + AB

Karnaugh Maps: 2 Values

Page 25: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

25© 2009, University of Colombo School of Computing

00 01 11 10

0 1 1 0 0

1 0 0 1 1

ABC

Karnaugh Maps: 3 Values

CBACBACBACBAX ........ +++=

Page 26: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

26© 2009, University of Colombo School of Computing

00 01 11 10

00 1 0 1 1

01 0 1 1 0

11 0 1 1 0

10 0 1 0 1

ABCD

Karnaugh Maps: 4 Values

DCBADCBADCBADCBADCBADCBADCBADCBAX ........................ +++++++=

Page 27: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

27© 2009, University of Colombo School of Computing

Simplify the following Karnaugh Map using Boolean equations (Write your answers in both SOPSOP and POS)

00 01 11 10

0 0 1 0 0

1 1 1 0 1

ABABCC

Karnaugh Maps: Exercise 1

Page 28: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

28© 2009, University of Colombo School of Computing

00 01 11 10

0 0 1 0 0

1 1 1 0 1

ABABCC

Karnaugh Maps: Answer

)..()..()..()..( CBACBACBACBA +++ CBBA +

)).().().(( CBACBACBACBA ++++++++ )).(( BACB ++

Page 29: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

29© 2009, University of Colombo School of Computing

Simplify the following Karnaugh Map using Boolean equations (Write your answers in both SOPSOP and POSPOS)

00 01 11 10

00 1 0 0 1

01 0 1 1 0

11 0 0 1 0

10 1 0 0 1

ABABCDCD

Karnaugh Maps: Exercise 2

Page 30: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

30© 2009, University of Colombo School of Computing

00 01 11 10

00 1 0 0 1

01 0 1 1 0

11 0 0 1 0

10 1 0 0 1

ABABCDCD

Karnaugh Maps: Answer

)()()()()()()( DCBADCBAABCDDCABDCBADCBADCBA ++++++

ABDDCBDB ++

Page 31: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

31© 2009, University of Colombo School of Computing

00 01 11 10

00 1 0 0 1

01 0 1 1 0

11 0 0 1 0

10 1 0 0 1

ABABCDCD

Karnaugh Maps: Answer

)(

).).().().((

).).().().((

DCBA

DCBADCBADCBADCBA

DCBADCBADCBADCBA

+++

++++++++++++

++++++++++++

)).().(( DCADBDB ++++

Page 32: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

32© 2009, University of Colombo School of Computing

C

A

D

B

The labeling used in figure emphasizes the relationship between variables and the rows and columns of the map

The two rows embraced by the symbol A are those in which the variable A has the value 1; the rows not embraced by the symbol Aare those in which A is 0

Simplified Labeling of Karnaugh Maps

Page 33: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

33© 2009, University of Colombo School of Computing

Once the map of a function is created, we can often write a simple algebraic expression for it by noting the arrangement of the 1s on the map

The principle is as follows:

Any two squares that are adjacent differ in only one of the variables

If two adjacent squares both have an entry of 1, then the corresponding product terms differ in only one variableIn such a case, the two terms can be merged by eliminating that variable

Simplified Labeling of Karnaugh Maps

Page 34: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

34© 2009, University of Colombo School of Computing

1 1

CD

AB

For example, in following FIGURE, the two adjacent squares correspond to the two terms ABCD and ABCD

The function expressed is ABCD + ABCD = ABD

Simplified Labeling of Karnaugh Maps

Page 35: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

35© 2009, University of Colombo School of Computing

This process can be extended in several ways:First, the concept of adjacent can be extended to include wrapping around the edge of the map

Thus, the top square of a column is adjacent to the bottom square, and the leftmost square of a row is adjacent to the rightmost square

Second, we can group not just 2 squares but 2n

adjacent squares, that is, 4, 8, etc

Simplified Labeling of Karnaugh Maps

Page 36: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

36© 2009, University of Colombo School of Computing

1

1

CD

AB

Your turn: Karnaugh Maps

Page 37: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

37© 2009, University of Colombo School of Computing

1

1

CD

AB BCD

Answer: Karnaugh Maps

Page 38: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

38© 2009, University of Colombo School of Computing

11

CD

AB

Your turn: Karnaugh Maps

Page 39: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

39© 2009, University of Colombo School of Computing

11

CD

AB ABD

Answer: Karnaugh Maps

Page 40: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

40© 2009, University of Colombo School of Computing

11 1 1

CD

AB

Your turn: Karnaugh Maps

Page 41: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

41© 2009, University of Colombo School of Computing

11 1 1

CD

AB AB

Answer: Karnaugh Maps

Page 42: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

42© 2009, University of Colombo School of Computing

11

1 1

CD

AB

Your turn: Karnaugh Maps

Page 43: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

43© 2009, University of Colombo School of Computing

11

1 1

CD

AB BC

Answer: Karnaugh Maps

Page 44: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

44© 2009, University of Colombo School of Computing

1

11 1 1

1 1 1

CD

AB

Your turn: Karnaugh Maps

Page 45: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

45© 2009, University of Colombo School of Computing

1

11 1 1

1 1 1

CD

AB A

Answer: Karnaugh Maps

Page 46: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

46© 2009, University of Colombo School of Computing

11

11

1

11

1

CD

AB

Your turn: Karnaugh Maps

Page 47: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

47© 2009, University of Colombo School of Computing

11

11

1

11

1

CD

AB C

Answer: Karnaugh Maps

Page 48: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

48© 2009, University of Colombo School of Computing

In attempting to simplify, first look for the largest grouping possible:

When you are circling groups, you are allowed to use the same 1 more than onceIf any isolated 1s remain after the groupings, then each of these is circled as a group of 1s

Finally, before going from the map to a simplified Boolean expression, any group of 1s that is completely overlapped by other groups can be eliminated

Simplified Labeling of Karnaugh Maps

Page 49: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

49© 2009, University of Colombo School of Computing

1

1100 01 11 10

BC

0

1A

F = AB + BC 1

11

1

00 01 11 10

CD

00

01

11

10

AB

F = BCD +ACD

Karnaugh Maps: Overlapping Groups

Page 50: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

50© 2009, University of Colombo School of Computing

1111

1011

1

00 0 0

0 0 0

CD

AB

Your turn: Karnaugh Maps

Page 51: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

51© 2009, University of Colombo School of Computing

1111

1011

1

00 0 0

0 0 0

CD

AB

F = AC + AB + BCD

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

Answer: Karnaugh Maps

Page 52: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

52© 2009, University of Colombo School of Computing

Drawing a Circuit

Page 53: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

53© 2009, University of Colombo School of Computing

B+AC

Drawing a Circuit

Page 54: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

54© 2009, University of Colombo School of Computing

B+AC

Drawing a Circuit

Page 55: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

55© 2009, University of Colombo School of Computing

Logic Operators

Page 56: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

56© 2009, University of Colombo School of Computing

Logic Operations

Basic logic operators and logic gates

Boolean algebra

Combinational Circuits

Basic circuit design

Page 57: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

57© 2009, University of Colombo School of Computing

Basic Logic Operators and Logic Gates

AND

OR

NOT

XOR (Exclusive OR)

NOR

NAND

XNOR

Page 58: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

A B

0 0

1 1

Buffer

Page 59: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

. Operator^ OperatorA . B = A ^ B

A B A . B

0 0 0

0 1 0

1 0 0

1 1 1

AND Operation

Page 60: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

+ Operatorv OperatorA + B = A v B

A B A + B

0 0 0

0 1 1

1 0 1

1 1 1

OR Operation

Page 61: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

~ Operator¬ Operator A A’

0 1

1 0

NOT Operation

'~ AAAA ==¬=

Page 62: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

Operator

A B

0 0 0

0 1 1

1 0 1

1 1 0

XOR Operation

BA⊕BA⊕

Page 63: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

A B

0 0 1

0 1 1

1 0 1

1 1 0

NAND Operation

)'.().( BABA = ).( BA

Page 64: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

A B

0 0 1

0 1 0

1 0 0

1 1 0

NOR Operation

)'()( BABA +=+ )( BA+

Page 65: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

A B

0 0 1

0 1 0

1 0 0

1 1 1

XNOR Operation

)( BA⊕ )( BA⊕

Page 66: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

66© 2009, University of Colombo School of Computing

In addition to the basic gates, gates with 3,4, or more inputs can be used

E.g. x + y + z can be implemented with a single OR gate with 3 inputs

Drawing Logic Gates

Page 67: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

Drawing Logic Gates

CBAX )( +=

Page 68: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

Drawing Logic Gates

DCBAX ++= ).(

Page 69: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

Drawing Logic Gates

).().( CABAX +=

Page 70: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

© 2009, University of Colombo School of Computing

Drawing Logic Gates

CDCBAX ).).(( ++=

Page 71: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

71© 2009, University of Colombo School of Computing

Reducing the number of inputs

The number of inputs to a gate can be reduced by connecting two (or more) inputs together

The diagram shows a 3-input AND gate operating as a 2-input AND gate

Reducing Logic Gates

Page 72: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

72© 2009, University of Colombo School of Computing

Reducing the number of inputs

Reducing a NOT gate from a NAND or NOR gate

The diagram shows this for a 2-input NAND gate

Reducing Logic Gates

Page 73: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

73© 2009, University of Colombo School of Computing

Typically, not all gate types are used in implementation

Design and fabrication are simpler if only one or two types of gates are used

Therefore, it is important to identify functionally complete sets of gates

This means that any Boolean function can be implemented using only the gates in the set

Logic Gates

Page 74: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

74© 2009, University of Colombo School of Computing

The following are functionally complete sets:

AND, OR, NOT

AND, NOT

OR, NOT

NAND

NOR

Logic Gates

Page 75: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

75© 2009, University of Colombo School of Computing

AND, OR, and NOT gates constitute a functionally complete set, since they represent the 3 operations of Boolean algebra

For the AND and NOT gates to form a functionally complete set, there must be a way to synthesize the ORoperation from the AND and NOT operations

A + B = A . BA OR B = NOT( ( NOT A) AND ( NOT B) )

Logic Gates

Page 76: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

76© 2009, University of Colombo School of Computing

Similarly, the OR and NOT operations are functionally complete because they can be synthesize the ANDoperation

A . B = A + BA AND B = NOT( ( NOT A) OR ( NOT B) )

Logic Gates

Page 77: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

77© 2009, University of Colombo School of Computing

The AND, OR and NOT functions can be implemented solely with NAND gates, and the same thing for NOR gates.

For this reason, digital circuits can be, and frequently are, implemented solely with NAND gates or solely with NOR gates

Logic Gates

Page 78: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

78© 2009, University of Colombo School of Computing

The diagram shows how the NOT function can be implemented solely with NAND gate

AA AA

Logic Gates

Page 79: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

79© 2009, University of Colombo School of Computing

The diagram shows how the AND function can be implemented solely with NAND gate

AA A A .. BB

BBA

A . BA . B

Logic Gates

Page 80: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

80© 2009, University of Colombo School of Computing

The diagram shows how the OR function can be implemented solely with NAND gate

AAAA

BBBB

A + BA + B

Logic Gates

Page 81: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

81© 2009, University of Colombo School of Computing

Gate Equivalent in NAND gates

NOT

AND

OR

NOR

Logic Gates

Page 82: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

82© 2009, University of Colombo School of Computing

Draw a diagram that shows how the NOT function can be implemented solely with NOR gate

Your turn

Page 83: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

83© 2009, University of Colombo School of Computing

The diagram shows how the NOT function can be implemented solely with NOR gate

AA AA

Logic Gates

Page 84: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

84© 2009, University of Colombo School of Computing

Draw a diagram that shows how the OR function can be implemented solely with NOR gate

Your turn

Page 85: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

85© 2009, University of Colombo School of Computing

The diagram shows how the OR function can be implemented solely with NOR gate

AA A + BA + B

BB

A + BA + B

Logic Gates

Page 86: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

86© 2009, University of Colombo School of Computing

Draw a diagram that shows how the AND function can be implemented solely with NOR gate

Your turn

Page 87: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

87© 2009, University of Colombo School of Computing

The diagram shows how the AND function can be implemented solely with NOR gate

AAAA

BBBB

A A . . BB

Logic Gates

Page 88: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

88© 2009, University of Colombo School of Computing

Substituting Gates in an Logic System

Page 89: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

89© 2009, University of Colombo School of Computing

Substituting Gates in an Logic System

Page 90: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

90© 2009, University of Colombo School of Computing

Substituting Gates in an Logic System

Page 91: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

91© 2009, University of Colombo School of Computing

Combinational Circuits

Page 92: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

92© 2009, University of Colombo School of Computing

Combinational Logic

Also called combinatorial logic

A type of logic circuit whose output is a function of the present input only

Page 93: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

93© 2009, University of Colombo School of Computing

Half Adder

Finds the sum of two bitsFinds the sum of two bits

The sum can be found The sum can be found using the XOR operation using the XOR operation and the carry using the and the carry using the AND operationAND operation

Page 94: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

94© 2009, University of Colombo School of Computing

Full AdderWe can change our half adder into to a full adder by including gates for processing the carry bitThe truth table for a full adder is:

Page 95: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

95© 2009, University of Colombo School of Computing

Converting a Half Adder into a Full AdderConverting a Half Adder into a Full Adder

Page 96: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

96© 2009, University of Colombo School of Computing

Ripple-carry Adder (I)

Just as we combined half adders to make a full adder, Just as we combined half adders to make a full adder, full adders can be connected in seriesfull adders can be connected in series

The carry bit “ripples” from one adder to the next; hence, this configuration is called a ripple-carry adder

O0O1O15

Page 97: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

97© 2009, University of Colombo School of Computing

Ripple-carry Adder (II)

1/2

Digits offirst number

Digits ofsecond number

1/2

1/2

1/2

1/2

1/2

1/2

Carry

Sum

Page 98: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

98© 2009, University of Colombo School of Computing

Adder

++

Adders (and other Adders (and other arithmetic circuits) arithmetic circuits) are usually drawn are usually drawn like this in block like this in block

diagramsdiagrams

A3A3--A0A0 B3B3--B0B0

out3out3--out0out0

inputsinputs

outputoutputcollections of parallel, collections of parallel,

related wires like this are related wires like this are known as known as busesbuses; they carry ; they carry multimulti--bit values between bit values between

componentscomponents

Page 99: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

99© 2009, University of Colombo School of Computing

Decoder

Selects a memory location according a binary value placed on the address lines of a memory bus

Decoders with n inputs can select any of 2n locations

Page 100: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

100© 2009, University of Colombo School of Computing

2-to-4 Decoder

If x = 0 and y = 1, which output line is enabled?

Page 101: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

101© 2009, University of Colombo School of Computing

MultiplexerA multiplexer does the opposite of a decoder

Selects a single output from several inputsThe particular input chosen for output is determined by the value of the multiplexer’s control lines

To select among n inputs, log2n control lines are needed

Page 102: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

102© 2009, University of Colombo School of Computing

4-to-1 Multiplexer

If S0 = 1 and S1 = 0, which input is selected as output?

Page 103: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

103© 2009, University of Colombo School of Computing

Arithmetic

• Computers need to do more than just addition– arithmetic: + – * / %

– logic: & | ~ << >>

• Need a circuit that can select operation to perform

Page 104: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

104© 2009, University of Colombo School of Computing

Arithmetic Logic Unit (ALU)

++ ** && <<<< . . .. . .

MUXMUX

op op 00

op op 11

op op 22

op op 33

opop

outout

AA BB

MultiplexerMultiplexer: a : a combinatorial combinatorial circuit which circuit which

selects exactly selects exactly one inputone input

op selects operation:op selects operation:0 = add, 1 = multiply, ...0 = add, 1 = multiply, ...

more more operations operations

herehere

00 11 22 33 ....

Page 105: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

105© 2009, University of Colombo School of Computing

Arithmetic Logic Unit (ALU)

++ ** && <<<< . . .. . .

MUXMUX

op op 00

op op 11

op op 22

op op 33

op = 3op = 3

out = 60out = 60

A = 15A = 15 B = 2B = 2

other results also other results also computed but computed but

ignored by ignored by multiplexermultiplexer

more more operations operations

herehere

for for example: example: compute compute 15 << 215 << 2

00 11 22 33 ....

Page 106: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

106© 2009, University of Colombo School of Computing

Sequential Logic Sequential Logic –– MemoryMemory

Page 107: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

107© 2009, University of Colombo School of Computing

Sequential Logic CircuitsCombinational logic circuits are perfect for situations which require the immediate application of a Boolean function to a set of inputs

But, here are times when we need a circuit to change its value with consideration to its current state as well as its inputs

These circuits have to “remember” their current state

Sequential logic circuits provide this functionality

Page 108: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

108© 2009, University of Colombo School of Computing

Sequencing EventsSequential logic circuits require a means by which events can be sequenced

State changes are controlled by clocks• A “clock” is a special circuit that sends electrical

pulses through a circuit

Clocks produce electrical waveforms such as this one

State changes occur in sequential circuits only when the clock ticks

Page 109: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

109© 2009, University of Colombo School of Computing

Feedback in Sequential Logic CircuitsSequential circuits rely on feedback to retain their state valuesFeedback in digital circuits occurs when an output is looped back to the input

Example,

If Q is 0 it will always be 0, if it is 1, it will always be 1

Page 110: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

110© 2009, University of Colombo School of Computing

SR Flip-flop (Set-Reset) (I)

• The behavior of an SR flip-flop is described by a characteristic table– Q(t) output at time t

– Q(t+1) output after the next clock pulse

Page 111: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

111© 2009, University of Colombo School of Computing

SR Flip-flop: Block Diagram

SS QQ

RR

FlipFlip--flops are often flops are often drawn like this in drawn like this in block diagramsblock diagrams

S and R S and R inputinput

CK is read/write (CK is read/write (““clockclock””because this input is because this input is

connected to the computerconnected to the computer’’s s processor clock)processor clock)

CKCK

QQ

Q and = Q and = outputoutput

Q Q

Page 112: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

112© 2009, University of Colombo School of Computing

SR Flip-flop (II)

The SR flip-flop has three inputs: S, R and Q(t)When both S and R are 1, the SR flip-flop is unstable

Page 113: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

113© 2009, University of Colombo School of Computing

JK Flip-flop (Jack Kilby)Modified version of the SR flip-flop to provide a stable state when both inputs are 1

Page 114: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

114© 2009, University of Colombo School of Computing

JK Flip-flop: Binary CounterThe low-order bit is complemented at each clock pulseWhenever it changes from 1 to 0, the next bit is complemented, and so on through the other flip-flops

Page 115: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

115© 2009, University of Colombo School of Computing

D Flip-flop (Data)

Fundamental circuit of computer memory

Used to store 1 bit

Can be implemented with gates

Not combinatorial logic

because current output may depend on previous state

Example of sequential logic

current output depends on inputs and prior output

Page 116: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

116© 2009, University of Colombo School of Computing

D Flip-flop

read/writeread/write

data indata in

data outdata out

read/write control: read/write control: 0 = read, 1 = write0 = read, 1 = write

NOR gate: OR gate NOR gate: OR gate followed by NOT gatefollowed by NOT gate

Page 117: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

117© 2009, University of Colombo School of Computing

D Flip-flop: Writing

read/write = 1 read/write = 1 (write)(write)

data in = 1data in = 1

data out = 1data out = 1

11

1111

0000

11

1100

1100

11

when read/write = 1, when read/write = 1, data out = data indata out = data in

Try changing data in to 0 Try changing data in to 0 and watch data outand watch data out

Page 118: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

118© 2009, University of Colombo School of Computing

D Flip-flop: Reading

read/write = 0 read/write = 0 (read)(read)

data in = ?data in = ?

data out = 1data out = 1

??

??00

??00

00

00

00

1100

11

when read/write = 0, no signals when read/write = 0, no signals in box can change in box can change ––-- data out data out

holds value regardless of data inholds value regardless of data in

Page 119: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

119© 2009, University of Colombo School of Computing

D Flip-flop: Block Diagram

DD QQ

CKCK

Q = data Q = data outout

D = data D = data inin

CK is read/write (CK is read/write (““clockclock””because this input is often because this input is often

connected to the computerconnected to the computer’’s s processor clock)processor clock)

Page 120: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

120© 2009, University of Colombo School of Computing

D Flip-flop: 4-bit Register

A register stores data inside the CPU

Page 121: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

121© 2009, University of Colombo School of Computing

Memory

• Memory can store many bits independently

– register banks contain many flip-flops

• Need to identify which bit (flip-flop) to read or write

• Give each flip-flop a unique number (address)

Page 122: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

122© 2009, University of Colombo School of Computing

Memory: Circuit Diagram

DD

CKCK

QQ

DD

CKCK

QQ

DD

CKCK

QQ

DD

CKCK

QQ

00

11

22

33

......

00

11

22

33

......

. . . millions more flip. . . millions more flip--flops . . flops . . ..

MUX

MUX

DEC

DEC

address 0address 0

address 1address 1

address 2address 2

address 3address 3

data indata in

addressaddress

rd/rd/wrwr

data data outout

Decoder: feeds input to selected output, 0 to all othersDecoder: feeds input to selected output, 0 to all others

Page 123: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

123© 2009, University of Colombo School of Computing

Memory: Writing

DD

CKCK

QQ

DD

CKCK

QQ

DD

CKCK

QQ

DD

CKCK

QQ

00

11

22

33

......

00

11

22

33

......

. . . millions more flip. . . millions more flip--flops . . flops . . ..

MUX

MUX

DEC

DEC

address 0address 0

address 1address 1

address 2address 2

address 3address 3

data indata in

addressaddress

data data outout

00

22

11

Writing value Writing value 1 to flip1 to flip--flop flop at address 2at address 2

1111

00

00

11

11

11

11

11

rd/rd/wrwr

Page 124: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

124© 2009, University of Colombo School of Computing

Memory: Reading

DD

CKCK

QQ

DD

CKCK

QQ

DD

CKCK

QQ

DD

CKCK

QQ

00

11

22

33

......

00

11

22

33

......

. . . millions more flip. . . millions more flip--flops . . flops . . ..

MUX

MUX

DEC

DEC

address 0address 0

address 1address 1

address 2address 2

address 3address 3

data indata in

addressaddress

rd/rd/wrwr

data data outout

00

22

Reading Reading value from value from flipflip--flop at flop at address 2address 2

1111

00

00

00

11 1100

We just wrote We just wrote this valuethis value

Page 125: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

125© 2009, University of Colombo School of Computing

Memory: 4-words, 3 bits/word

Page 126: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

126© 2009, University of Colombo School of Computing

Summary (I)Computers are implementations of Boolean logic

Boolean functions are completely described by Truth Tables

Logic gates are small circuits that implement Boolean operators

The basic gates are AND, OR and NOT

The “universal gates” are NOR and NAND

Page 127: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

127© 2009, University of Colombo School of Computing

Summary (II)Computer circuits consist of combinational logic circuits and sequential logic circuits

Combinational circuits produce outputs (almost) immediately when their inputs change

Sequential circuits have internal states as well as combinations of input and output logic

The outputs may also depend on the states left behind by previous inputs

Sequential circuits require clocks to control their changes of state

The basic sequential circuit unit is the flip-flop

Page 128: Boolean Algebra and Digital Logic - · PDF file · 2015-02-21Boolean Algebra and Digital Logic ... Truth Tables to Logic Equations X = ... A Boolean function can be realised in either

128© 2009, University of Colombo School of Computing

Thank You