260
Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

Embed Size (px)

Citation preview

Page 1: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

Digital Logic design901220

By: Dr. Wa’el Al Qassas

Al Albayt university

Page 2: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

2قصاص AABU/وائل

Text Book : Digital Logic & Computer Design/Moris Mano

Course part• Theoretical Lectures: 3 hours weekly• Practical LAB: 1 lab ( 2 hours) weekly

Grading policy:• First Theoretical Exam: 15 points• Second Theoretical Exam: 15 points• Final Theoretical Exam : 50 points• Mid Practical Exam: 10 points• Final Practical Exam: 10 points

Page 3: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

3قصاص AABU/وائل

Web sites.

Main Site: www.aabu.edu.jo/~waelWww.geocities.com/wael_it2003

www.aabu.edu.jo/it/~wael

http://web2.aabu.edu.jo:8080http://web2.aabu.edu.jo:8080/tool/course_file/

901220_lectures.pdf

www.aabu.edu.jo/~wael

Page 4: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

4قصاص AABU/وائل

Syllabus•Syllabus review & Introduction :1 hour•Simple logic Circuits and manufacturing technology :1 hours•Truth table and symbolic representation :1 hour•Fundamental properties for Boolean algebra :1 hours•Implementing Circuits form Truth table , practice : 2 hours•XOR gate, Demorgan’s Law : 1 hour•Logical expression simplification using Fundamental properties, Demorgan , Practice : 1 hours.•Karnaugh map ( 3 input, 4 input), SOP,POS, practice: 3 hour•Tabulation method : 2 hours.•Numbering systems, Binary numbers, Hexadecimal,…, real number implementation,: 3 hours•First exam., Question solving & evaluation : 1 hour.

Page 5: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

5قصاص AABU/وائل

المنطق علم ( العامة ( القواعد يدرس الذي العلم هو المنطق علم إّن�التي األداة هو أخرى جهة ومن جهة، من الصحيح للتفكيرترشده التي و الخطأ، من العصمة على اإلنساّن بها يستعينلعلم األولى القواعد وضعت لقد أفكاره، تصحيح إلى

قبل في أرسطو، 3000المنطق قبل من تقريبا?، سنةصن�ف حين أرسطو ضم�نها التي القواعد أّن� بالذكر والجديرهي زالت ما المنطق، علم في مFصن�ف أو�لمع تFبطل، أو قيمتها تفقد لم و العلم لهذا القواعداألساسي�ة

من أكثر إلى تعود في 3000أنها ذلك على ستتعرف كما عامالمنطق لعلم التاريخية .المراحل

Page 6: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

6قصاص AABU/وائل

Transistor: Building Block of ComputersMicroprocessors contain millions of transistors

• Intel Pentium II: 7 million• Compaq Alpha 21264: 15 million• Intel Pentium III: 28 million

Logically, each transistor acts as a switch

Combined to implement logic functions • AND, OR, NOT

Combined to build higher-level structures• Adder, multiplexer, decoder, register, …

Silicon manufacturing

Page 7: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

7قصاص AABU/وائل

Simple Switch CircuitSwitch open:

• No current through circuit

• Light is off

• Vout is + 5V

Switch closed:• Short circuit across switch

• Current flows

• Light is on

• Vout is 0V

Switch-based circuits can easily represent two states:on/off, open/closed, voltage/no voltage.

Page 8: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

8قصاص AABU/وائل

LOGICAL AND:

Page 9: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

9قصاص AABU/وائل

N-type MOS TransistorMOS = Metal Oxide Semiconductor

• two types: N-type and P-type

N-type• when Gate has positive voltage,

short circuit between #1 and #2(switch closed)

• when Gate has zero voltage,open circuit between #1 and #2(switch open)

Gate = 1

Gate = 0

Terminal #2 must beconnected to GND (0V).

Page 10: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

10قصاص AABU/وائل

P-type MOS TransistorP-type is complementary to N-type

• when Gate has positive voltage,open circuit between #1 and #2(switch open)

• when Gate has zero voltage,short circuit between #1 and #2(switch closed)

Gate = 1

Gate = 0

Terminal #1 must beconnected to +2.9V.

Page 11: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

11قصاص AABU/وائل

Logic GatesUse switch behavior of MOS transistorsto implement logical functions: AND, OR, NOT.

Digital symbols:• recall that we assign a range of analog voltages to each

digital (logic) symbol

• assignment of voltage ranges depends on electrical properties of transistors being used

typical values for "1": +5V, +3.3V, +2.9V from now on we'll use +5V

Page 12: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

12قصاص AABU/وائل

Inverter (NOT Gate)

In Out

0 V 2.9 V

2.9 V 0 V

In Out

0 1

1 0

Truth table

Page 13: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

13قصاص AABU/وائل

NOR Gate

A B C

0 0 1

0 1 0

1 0 0

1 1 0

Note: Serial structure on top, parallel on bottom.

Page 14: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

14قصاص AABU/وائل

OR Gate

Add inverter to NOR.

A B C

0 0 0

0 1 1

1 0 1

1 1 1

Page 15: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

15قصاص AABU/وائل

NAND Gate (AND-NOT)

A B C

0 0 1

0 1 1

1 0 1

1 1 0

Note: Parallel structure on top, serial on bottom.

Page 16: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

16قصاص AABU/وائل

AND Gate

Add inverter to NAND.

A B C

0 0 0

0 1 0

1 0 0

1 1 1

Page 17: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

17قصاص AABU/وائل

Basic Logic Gates

Page 18: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

18قصاص AABU/وائل

Fundamental Properties of boolean algebra:Commutative: X + Y = Y + X X . Y = Y . XAssociative: ( X + Y) + Z = X + (Y + Z) ( X . Y) . Z = X . (Y . Z)Identity:X + 0 = XX . 1 = XComplement:X +(X’) = 1X . (X’) = 0Distributive: X . (Y + Z) = (X . Y) + (X . Z)X + (Y . Z) = (X + Y) . (X + Z)

AbsorptionX + X.Y = X

Page 19: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

19قصاص AABU/وائل

X.X = X

X+X = X

X + 1= 1

X . 0 = 0

Page 20: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

20قصاص AABU/وائل

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 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0

1

1

1

0

1

1

1

0

0

0

0

0

1

1

1

0

0

0

0

0

0

1

1

0

0

0

0

0

1

0

1

0

0

0

0

0

1

1

1

Page 21: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

21قصاص AABU/وائل

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 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0

0

0

1

0

0

0

1

0

0

0

1

1

1

1

1

0

0

1

1

1

1

1

1

0

1

0

1

1

1

1

1

0

0

0

1

1

1

1

1

Page 22: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

22قصاص AABU/وائل

More than 2 Inputs?AND/OR can take any number of inputs.

• AND = 1 if all inputs are 1.• OR = 1 if any input is 1.• Similar for NAND/NOR.

Can implement with multiple two-input gates,or with single CMOS circuit.

Page 23: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

23قصاص AABU/وائل

Logical CompletenessCan implement ANY truth table with AND, OR, NOT.

A B C D

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 0

1 0 0 0

1 0 1 1

1 1 0 0

1 1 1 0

1. AND combinations that yield a "1" in the truth table.

2. OR the resultsof the AND gates.

Page 24: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

24قصاص AABU/وائل

PracticeImplement the following truth table.

A B C

0 0 0

0 1 1

1 0 1

1 1 0

A

B C

Page 25: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

25قصاص AABU/وائل

Another example:

X Y Z Output

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 0

We want to build a circuit that has 3 binary inputs.

This CKT is On if the inputs are X’Y’Z or X’YZ’ .

Build the Truth table, then Draw the Ckt

XYZ

Output

Page 26: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

26قصاص AABU/وائل

XOR gate:A XOR B= A.B’+A’.B

A + B A B

0 0 0

0 1 1

1 0 1

1 1 0

A

B

A + B

A + B

A

BA.B’+A’.B

Page 27: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

27قصاص AABU/وائل

DeMorgan's LawConverting AND to OR (with some help from NOT)

Consider the following gate:

A B

0 0 1 1 1 0

0 1 1 0 0 1

1 0 0 1 0 1

1 1 0 0 0 1

BA BA BA

Same as A+B!

To convert AND to OR (or vice versa),

invert inputs and output.

Page 28: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

28قصاص AABU/وائل

DeMorgan Law:

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

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

A B A’ B’ A’.B’ (A’.B’)’

0 0 1 1 1 0

0 1 1 0 0 1

1 0 0 1 0 1

1 1 0 0 0 1

OR Truth table

A B A’ B’ A’+B’ (A’+B’)’

0 0 1 1 1 0

0 1 1 0 1 0

1 0 0 1 1 0

1 1 0 0 0 1

AND Truth table

Page 29: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

29قصاص AABU/وائل

Build the following logical expression using AND, Not Gates only:

F=X.Y+Z’

=((X.Y)’.Z’’)’

=((X.Y)’.Z)’

Another example:

F= XYZ+Y’Z+XZ’

= ( (XYZ)’.(Y’Z)’.(XZ’)’ )’

Page 30: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

30قصاص AABU/وائل

From Demorgans lawA+B= (A’.B’)’

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

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

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

Page 31: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

31قصاص AABU/وائل

Simplify the following boolean expression

F= (A’BC + C + A + D )’

= ( A’BCC’ + (A’BC)’C +A+D)’

= ( 0 + (A’BC)’C +A+D)’

= ( 0 + (A+B’+C’)C+A+D)’

= ( AC+B’C+C’C+A+D)’

= ( AC+B’C+ 0 + A +D)’

= (AC+A + B’C + D)’

= ( A + B’C + D)’

= A’ (B’C)’ D’

= A’ D’( B+C’)

= A’BD’+A’C’D’

Page 32: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

32قصاص AABU/وائل

Simplification using boolean algebra:We have the following truth table for a logical circuit and we want to implement this using the minimum number of gates:

A B C F

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 0

F=A’B’C+A’BC+AB’C’+AB’C+ABC’

= A’B’C+A’BC+AB’(C+C’)+ABC’

= A’C(B+B’) +AB’ +ABC’

= A’C+AB’+AC’(B+B’) ;we can reuse AB’C’

=A’C+AB’+AC’

SOP

Page 33: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

33قصاص AABU/وائل

Another example:

A B C F

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

F=A’B’C+A’BC+AB’C+ABC’+ABC

= A’C(B+B’)+AB’C+ABC’+ABC

= A’C + AC(B’+B) +ABC’

= A’C+AC+ AB(C+C’)

=A’C+AC+AB

= C(A+A’)+AB

= C+AB

Page 34: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

34قصاص AABU/وائل

Karnaugh MapsKarnaugh map : is a representation for the truth table in a graphical way, which makes the simplification of any boolean function easier.

For 3 input boolean function the Karnaugh map will be as follows :

00 01 11 10

0A’B’C’

000

A’B’C

001

A’BC

011

A’BC’

010

1AB’C’

100

AB’C

101

ABC

111

ABC’

110

A

BC

As we can see, each cell represent one raw of the truth table

Next step is to fill the map using the truth table output.

Page 35: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

35قصاص AABU/وائل

Simplification using Karnaugh:Let us resolve the previous examples using karnaugh map:

A B C F

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 0

00 01 11 10

0 0 1 1 0

1 1 1 0 1A

BC

F=A’C+AC’ +B’C

Page 36: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

36قصاص AABU/وائل

Resolve the same example in another way:

00 01 11 10

0 0 1 1 0

1 1 1 0 1

BC

F=A’C+AB’+AC’

Page 37: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

37قصاص AABU/وائل

Another example

00 01 11 10

00 1 1 0

11 1 1 1

A

BC

Page 38: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

38قصاص AABU/وائل

Convert from logical expression to minterms

What are the minterms that represent the following expression assuming that we have 3 inputs A,B, and C

F=A+A’C

F=

Page 39: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

39قصاص AABU/وائل

Karnaugh map for 4 input boolean function

AB

CD00 01 11 10

00 0

0000

1

0001

3

0011

2

0010

01 4

0100

5

0101

7

0111

6

0110

11 12

1100

13

1101

15

1111

14

1110

10 8

1000

9

1001

11

1011

10

1010

Page 40: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

40قصاص AABU/وائل

Page 41: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

41قصاص AABU/وائل

Assume we have the boolean function F with 4 inputs:F(A,B,C,D)= ∑ (0,1 ,4, 6, 8,11,13, 15)Make the truth table for this functionWrite the boolean equation for this function (Before simplification)Simplify this function using karnaugh map techniqueDraw the simplified equation.

00 01 11 10

00 1 1

01 1 1

11 1 1

10 1 1

Page 42: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

42قصاص AABU/وائل

Minterms & MaxtermsTo understand the relation between Minterms and Maxterms let is see the following example:

F=Σ(1,3,5,6,7)

F=A’B’C+A’BC+AB’C+ABC’+ABC

F’=A’B’C’+A’BC’+AB’C’

We know that (F’)’=F

F=(F’)’=(A’B’C’+A’BC’+AB’C’)’

F=(A’B’C’)’ .(A’BC’)’ . (AB’C’)’

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

F=Π(0,2,4)

A B C F F’

0 0 0 0 1

0 0 1 1 0

0 1 0 0 1

0 1 1 1 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 0

Page 43: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

43قصاص AABU/وائل

Minterms & MaxtermsFor a 3 binary variables

x y zMinterms Maxterms

Term Designation Term Designation

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

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

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

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

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

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

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

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

Page 44: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

44قصاص AABU/وائل

From Minterms to Maxterms2 3 5 6

F(A,B,C)=(2,3,5,6) = A’BC’ + A’BC + AB’C+ABC’

0 1 4 7

F(A,B,C)= (0,1,4,7) = (A+B+C).(A+B+C’).(A’+B+C).(A’+B’+C’)

Page 45: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

45قصاص AABU/وائل

Examples on POS

00 01 11 10

00 1 1 0

11 1 1 1

A

BC

F=(A+C)

Page 46: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

46قصاص AABU/وائل

5 variables Karnaugh map

000 001 011 010 110 111 101 100

00

01

11

10

AB

CDE

Page 47: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

47قصاص AABU/وائل

6 variables Karnaugh map

000 001 011 010 110 111 101 100

000

001

011

010ABC

DEF

110

111

101

100

Page 48: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

48قصاص AABU/وائل

Tabulation method• Last lecture we noticed the difficulty of

simplifying 5 variable equations using karnaugh Map.

• Another method is used to simplify boolean equations.

• Tabulation method (Quine-McCluskey), or prime implicants :-

• Its suitable for machine computation• Uses two phases:

i. Finding Prime implicants

ii. Selecting the needed Prime implicants

Page 49: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

49قصاص AABU/وائل

Determining Prime implicantsExample 1 : F(w,x,y,z)=Σ(0,1,2,8,10,11,14,15)

First we list the minterms in groups depending on the number of ones in each minterm

0 0000~~~~~~~~~~1 00012 00108 1000~~~~~~~~~10 1010~~~~~~~~~11 101114 1110~~~~~~~~~15 1111

Page 50: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

50قصاص AABU/وائل

Then look for any two minterms that differ on one variable only , between any adjacent groups

0 00001 00012 00108 100010 101011 101114 111015 1111

0,1 000-0,2 00-00,8 -0002,10 -0108,10 10-010,11 101-10,14 1-1011,15 1-1114,15 111-

0,2,8,10 -0-00,8,2,10 -0-0______________10,11,14,15

1-1-10,14,11,15

1-1-

The prime implicants are : w’x’y’ , x’z’ , wy

Next step is to select needed prime implicants.

Page 51: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

51قصاص AABU/وائل

0 1 2 8 10 11 14 15

W’X’Y’ V V

X’Z’ V V V V

WY V V V V

Page 52: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

52قصاص AABU/وائل

Another exampleExample 1 : F(w,x,y,z)=Σ(0,1,2,5,8,10,11,14,15)

Page 53: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

53قصاص AABU/وائل

0 1 2 5 8 10 11 14 15

W’X’Y’ V V

W’Y’Z V V

X’Z’ V V V V

WY V V V V

Page 54: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

54قصاص AABU/وائل

Example 2Simplify the following SOP using tabulation method.

F(W,X,Y,Z)=Σ(1,4,6,7,8,9,10,11,15)

Remember : first Find Prime implicants

then select the needed prime implicants.

Page 55: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

55قصاص AABU/وائل

Determining the prime implicants1 0001 1,9 -001 8,9,10,11 10- -

4 0100 4,6 01-0 8,10,9,11 10- -

8 1000 8,9 100- ~~~~~~~~~~~~

~~~~~~ 8,10 10-0

6 0110 ~~~~~~~~

9 1001 6,7 011-

10 1010 9,11 10-1

~~~~~~ 10,11 101-

7 0111 ~~~~~~~~~

11 1011 7,15 -111

~~~~~~~ 11,15 1-11

15 1111X’Y’Z, W’XZ’, W’XY, XYZ, WYZ, WX’

Page 56: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

56قصاص AABU/وائل

1 4 6 7 8 9 10 11 15

X’Y’Z V V

W’XZ’ V V

W’XY V V

XYZ V V

WYZ V V

WX’ V V V V

• Selection for the needed prime implicants

Page 57: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

57قصاص AABU/وائل

1 4 6 7 8 9 10 11 15

X’Y’Z V V

W’XZ’ V V

W’XY V V

XYZ V V

WYZ V V

WX’ V V V V

Page 58: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

58قصاص AABU/وائل

IC’s characteristics ( 2.8):Fan-out: the number of standard loads that the output of a gate can drive without impairing its normal operation ( 20 to 50 gates)

Power dissipation : the supplied power required to operate the gate ( in mW)

Propagation delay: The average transition delay time for a signal to propagate from input to output when the binary signals change in value ( in ns)

Noise margin: is the maximum noise voltage added to the input signal of a digital circuit that doesn’t cause an undesirable change in the circuit output

Page 59: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

59قصاص AABU/وائل

Different numbering systems: ( Chapter 1)

Unary numbers : 4 = 1111, very old, used by Caveman write 62123445 in unary representation Twelfth numbering system ( Dozen ) :

• dozen of glasses• The year has 12 months• The day has 24 hours ( 12 day, 12 night)• Horoscopes ( 12 ) depending on stars

Decimal numbering : Easy ?!• I don’t think so, why human invented it?

Octal: contains 8 different numbers in one digit from 0 to 7• What it we want to count more than 7 in Octal ?• 0 ,1 ,2 ,3 ,4 ,5 ,6 ,7, 10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,20

Hexadecimal: contains 16 different numbers in one digit• 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F, • What comes after F ?

Page 60: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

60قصاص AABU/وائل

Unsigned Integers

Non-positional notation• could represent a number (“5”) with a string of ones (“11111”)

• problems?

Weighted positional notation• like decimal numbers: “329”

• “3” is worth 300, because of its position, while “9” is only worth 9

329102 101 100

10122 21 20

3x100 + 2x10 + 9x1 = 329 1x4 + 0x2 + 1x1 = 5

mostsignificant

leastsignificant

Page 61: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

61قصاص AABU/وائل

Octal Example

1428 =

1x82 +4x81+2x80

= 64 + 32+ 2

= 9810

Page 62: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

62قصاص AABU/وائل

Number Base conversionTo convert from decimal to binary divide by two and collect the reminders from the last to the first

Ex:

19/2= 9 , 1

9/2 = 4 , 1

4/2 = 2 , 0

2/2 = 1 , 0

1/2 = 0 , 1 10011 binary =19 in decimal

Page 63: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

63قصاص AABU/وائل

From Binary to decimalEach digit has a weight depending on its position

1 0 0 1 1

24 23 22 21 20 =16+2+1=19

Try 10101101

Page 64: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

64قصاص AABU/وائل

Binary numbersDigital Computers use Binary system.We need to represent different numbering types use the Binary system.Remember the conversion between Binary & Decimal, this was used to represent positive integer numbers only.But , what about negative numbers. Three different methods were used to represent negative integer numbers:

Sign magnitudeOne’s ComplementTwo’s complement

Page 65: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

65قصاص AABU/وائل

Negative numbers (Sign magnitude)This technique uses additional binary digit to represent the sign, 0 to represent positive, 1 to represent negative.Ex.:

5 = 0101

-5 = 1101

Also

5 = 00000101

-5= 10000101

www.microcode.com Circuit maker

Page 66: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

66قصاص AABU/وائل

Negative numbers (1’s Complement)1’s comp is another method used to represent negative numbers.In this method we invert every bit in the positive number in order to represent its negative.Ex.:

9 = 01001-9= 10110

Again remember that we use additional digit to represent the signWe may represent 9 as 00001001 ; zeros on left have no value-9 in 1’s comp will be 11110110

Page 67: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

67قصاص AABU/وائل

Negative numbers (2’s complement)This is the method which is used in most computers to represent integer numbers nowadays.Remember always to represent a positive number using any of the previous methods is the same, all what is needed is a 0 on the left to show that the number is positiveTo represent a negative number in 2’s Comp , first we find the 1’s Comp, then add 1 to the resultEx:

How we represent -9 in 2’s comp

1- 9 in binary = 1001

2- add 0 to the left = 01001

3- invert = 10110

4- add 1 = 10111; -9 in 2’s Comp.

Page 68: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

68قصاص AABU/وائل

-22

22 = 10110

22 = 010110 put zero to the left

In 1’s= 101001

In 2’s=101010 -22 in 2’s comp

Page 69: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

69قصاص AABU/وائل

Two’s Complement ShortcutTo take the two’s complement of a number:

• copy bits from right to left until (and including) the first “1”• flip remaining bits to the left

011010000 011010000100101111 (1’s comp)

+ 1100110000 100110000

(copy)(flip)

Page 70: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

70قصاص AABU/وائل

Convert from 2’s comp to decimal

Page 71: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

71قصاص AABU/وائل

Operations: Arithmetic and LogicalRecall: a data type includes representation and operations.We now have a good representation for signed integers,so let’s look at some arithmetic operations:

• Addition• Subtraction• Sign Extension

We’ll also look at overflow conditions for addition.Multiplication, division, etc., can be built from these basic operations.Logical operations are also useful:

• AND• OR• NOT

Page 72: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

72قصاص AABU/وائل

Unsigned Binary ArithmeticBase-2 addition – just like base-10!

• add from right to left, propagating carry

10010 10010 1111+ 1001 + 1011 + 1

11011 11101 10000

10111+ 111

carry

Subtraction, multiplication, division,…

Page 73: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

73قصاص AABU/وائل

What if we assume that we are using 2’s comp numbers

10010 10010

+01001 + 01011

11011 11101

10010 Is negative number its value is

1 –

10001

01110 = 14 10010 is -14

The same way 11011 is -5

-14+9=-5

Page 74: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

74قصاص AABU/وائل

Addition

As we’ve discussed, 2’s comp. addition is just binary addition.

• assume all integers have the same number of bits• ignore carry out• for now, assume that sum fits in n-bit 2’s comp. representation

01101000 (104) 11110110 (-10)

+11110000 (-16) + (-9)

01011000 (88) (-19)

Assuming 8-bit 2’s complement numbers.

Page 75: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

75قصاص AABU/وائل

SubtractionNegate subtrahend (2nd no.) and add.

• assume all integers have the same number of bits• ignore carry out• for now, assume that difference fits in n-bit 2’s comp.

representation

01101000 (104) 11110110 (-10)

-00010000 (16) - (-9)

01101000 (104) 11110110 (-10)

+11110000 (-16) + (9)

01011000 (88) (-1)Assuming 8-bit 2’s complement numbers.

Page 76: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

76قصاص AABU/وائل

Sign ExtensionTo add two numbers, we must represent themwith the same number of bits.

If we just pad with zeroes on the left:

Instead, replicate the MS bit -- the sign bit:

4-bit 8-bit0100(4) 00000100 (still 4)

1100(-4) 00001100 (12, not -4)

4-bit 8-bit0100(4) 00000100 (still 4)

1100(-4) 11111100 (still -4)

Page 77: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

77قصاص AABU/وائل

OverflowIf operands are too big, then sum cannot be represented as an n-bit 2’s comp number.

We have overflow if:• signs of both operands are the same, and• sign of sum is different.

Another test -- easy for hardware:• carry into MS bit does not equal carry out

01000 (8) 11000 (-8)

+01001 (9) +10111 (-9)

10001 (-15) 01111 (+15)

Page 78: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

78قصاص AABU/وائل

Build a Ckt that discovers the overflowInputs Sa: Sign for the first number

Sb: Sign for the second number

Ss: Sign for the answer number

Sa Sb Ss Overflow

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

0

1

0

0

0

0

1

0

Page 79: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

79قصاص AABU/وائل

Boolean Arithmetic operationsint x=5,y=6;cout<<x&y<<endl; // bitwise ANDcout<<x|y<<endl; // bitwise ORcout<<~x<<endl; //bitwise NOT

X= 0000101Y= 0000110 And

0000100 = 4

X= 0000101Y= 0000110 OR

0000111 = 7

NOT (X)= 1111010 = -6So NOT(X) +1 = -X = -5

Page 80: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

80قصاص AABU/وائل

Real numbers ( outside the text book)Fixed point numbersAll what we discussed before was about integers.What about real numbers (ex.: 6.125)To represent real numbers we take first the integer part and convert is as we learned before, and then take the fraction part and convert it using the following algorithm

1- multiply fraction by 2 2- take the integer of the result 3- Repeat 1 and 2 until the fraction is zero, or until u reach get

enough digits.Ex. : 6.1256= 1100.125x2 = 0.250.25x2 = 0.50.5x2 = 1.0 6.125= 110.001

Page 81: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

81قصاص AABU/وائل

Another example:

Convert 9.2 to binary.

9=1001

0.2x2 = 0.4

0.4x2 = 0.8

0.8x2 = 1.6 ; take the fraction only

0.6x2 = 1.2

0.2x2 = 0.4 ; let us stop here, 5 digits after the point

The binary equivalent will be: 1001.00110

Page 82: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

82قصاص AABU/وائل

Convert from binary to decimalAgain let us take the previous results

22 21 20 2-1 2-2 2-3

1 1 0 . 0 0 1

= 4+2+.125=6.125

Ex. 2:

23 22 21 20 2-1 2-2 2-3 2-4 2-5

1 0 0 1. 0 0 1 1 0

= 8+1+ .125+.0625 = 9.1875

Why not 9.2 !??

Page 83: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

83قصاص AABU/وائل

Floating numbersNowadays numbers with decimal point are represended in the computer using IEEE 754 float number format.

This format has to subtypes :• Float: 32 bit number can represent up to 1038 .• Double: 64 bit number can represent up to 10308 with more

number of digits after the point.

We will not cover this topic here.

It will be covered in Computer architecture course.

Page 84: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

84قصاص AABU/وائل

HexadecimalAs we noticed to read a long binary number is confusingSo another numbering system was invented ( base 16)We know base 10 ,base 2, and now base 16Numbers in (base 16) are : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,FThere is a direct relation between base 2 and base 16, 24=16 , so the conversion from binary to hexadecimal is quite easy.Each 4 binary digits are converted to one hexadecimal digit.

Page 85: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

85قصاص AABU/وائل

Decimal Binary Hexadecimal

0 0000 0

1 0001 1

2 0010 2

3 0011 3

4 0100 4

5 0101 5

6 0110 6

7 0111 7

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

Page 86: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

86قصاص AABU/وائل

Converting from Binary to HexadecimalEvery four bits is a hexadecimal digit.

• start grouping from right-hand side

011101010001111010011010111

7D4F8A3

This is not a new machine representation,just a convenient way to write the number.

Convert the binary number above to Octal notation

Page 87: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

87قصاص AABU/وائل

Examples on Hexadecimal01010001=51h, 0x51,$51, 5116

1110010 =$72

10101110=$AE

From Hex to decimal

$ff= 1111 1111 =25510

7216 = ? 10

01110010= 64+32+16+2 =11410

2*160 + 7*161 =114

Page 88: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

88قصاص AABU/وائل

Binary CodesBinary coding is different from binary conversion

BCD code : Binary coded decimal, is used to represent each decimal digit to a 4 bit binary number,

Ex: 13 = 0001 0011 in BCD

Remember 13 = 1101 in binary

Ex: 49 = 0100 1001 in BCD

Remember that 49 = 0011 0001 in binary.

Excess-3 code

In Excess-3 0 = 0011, 1=0100, 2=0101 ,… , 9=1100

This means that we add 3 to the number then convert it to binary

We mainly use this to avoid having zeros in transmission lines.

Other coding methods ( See Page 17).

Page 89: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

89قصاص AABU/وائل

Error detection :Many techniques are used in order to detect if an error has occurred in the data transmitted or stored, one of these is the parity check.

The idea of the parity check is to add an extra bit to the binary number, the value of this bit depends on the number of ones in the binary number.

The parity bit is generated on transmitting end, and checked at receiving end

A parity check involves appending a bit that makes the total number of binary 1 digits in a character or word , either odd (for odd parity) or even (for even parity).Examples: Even parity 0000 0, 0001 1, 1111 0

Odd parity:0000 1, 0001 0, 1111 1

Page 90: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

90قصاص AABU/وائل

Alphanumeric CodesTo represent numbers and letters we need some coding method.

First we need to know the number of symbols (letters, numbers, or other symbols)

ASCII: American standard code for information Interchange, is one of the commonly used codings

It uses 7 bits , it can represent 127 different symbols

Ex: A = 100 0001,

a = 110 0001

0 = 011 0000

1 = 011 0001

space = 010 0000

WAEL = 101 0111 100 0001 100 0101 100 1100

Page 91: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

91قصاص AABU/وائل

Decimal Char Decimal CharDecima

l Char Decimal CharDecima

l Char Decimal Char Decimal CharDecim

al Char

0 nul 16 dle 32 sp 48 0 64 @ 80 P 96 ` 112 p

1 soh 17 dc1 33 ! 49 1 65 A 81 Q 97 a 113 q

2 stx 18 dc2 34 " 50 2 66 B 82 R 98 b 114 r

3 etx 19 dc3 35 # 51 3 67 C 83 S 99 c 115 s

4 eot 20 dc4 36 $ 52 4 68 D 84 T 100 d 116 t

5 enq 21 nak 37 % 53 5 69 E 85 U 101 e 117 u

6 ack 22 syn 38 & 54 6 70 F 86 V 102 f 118 v

7 bel 23 etb 39 ' 55 7 71 G 87 W 103 g 119 w

8 bs 24 can 40 ( 56 8 72 H 88 X 104 h 120 x

9 ht 25 em 41 ) 57 9 73 I 89 Y 105 i 121 y

10 nl 26 sub 42 * 58 : 74 J 90 Z 106 j 122 z

11 vt 27 esc 43 + 59 ; 75 K 91 [ 107 k 123 {

12 np 28 fs 44 , 60 < 76 L 92 \ 108 l 124 |

13 cr 29 gs 45 - 61 = 77 M 93 ] 109 m 125 }

14 so 30 rs 46 . 62 > 78 N 94 ^ 110 n 126 ~

15 si 31 us 47 / 63 ? 79 O 95 _ 111 o 127 del

Page 92: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

92قصاص AABU/وائل

EBCDIC: Extended BCD Interchange, is an 8 bit coding

Ex: A= 1100 0001

1= 1111 0001

space= 0100 0000

Page 93: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

93قصاص AABU/وائل

SummaryMOS transistors are used as switches to implementlogic functions.

• N-type: connect to GND, turn on (with 1) to pull down to 0• P-type: connect to +2.9V, turn on (with 0) to pull up to 1

Basic gates: NOT, NOR, NAND• Logic functions are usually expressed with AND, OR, and NOT

Properties of logic gates• Completeness

can implement any truth table with AND, OR, NOT• DeMorgan's Law

convert AND to OR by inverting inputs and output

Page 94: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

94قصاص AABU/وائل

Page 95: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

95قصاص AABU/وائل

First exam ,

Page 96: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

96قصاص AABU/وائل

Building Functions from Logic Gates

We've already seen how to implement truth tablesusing AND, OR, and NOT -- an example of combinational logic.

Combinational Logic Circuit• output depends only on the current inputs• stateless

Sequential Logic Circuit• output depends on the sequence of inputs (previous inputs and

present inputs)• stores information (state) from past inputs

Page 97: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

97قصاص AABU/وائل

Chapter 4. Combinational Circuits

A combinational circuit consists of :

1- Input variables.

2- Logic gates

3- Output variables

Logic gates accepts signals ( Binary signals) from inputs and generate signals to the outputs.

Combinational Logic Circuit

n inputs m outputs

Page 98: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

98قصاص AABU/وائل

Design ProcedureTo design a combinational circuit, the following steps are used:

1. The problems in stated

2. The number of inputs and outputs are determined

3. Assigning letter symbols to each input and output

4. Building the Truth table, which defines the relationship between inputs and outputs, ( and the don’t care conditions).

5. Simplifying the truth table.

6. Drawing the logic diagram.

Page 99: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

99قصاص AABU/وائل

AddersLet us implement what we learned in the previous slide

and build a combinational circuit that adds two binary numbers.

1. State the problem: Build a circuit that can add two binary numbers ( HALF ADDER)0+0= 00+1= 11+0= 11+1=10

2. Number of inputs is two , Number of outputs derived is also two.

3. Let us name the inputs as X, Y, and the outputs as S for Sum, and C for Carry_out.

Page 100: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

100قصاص AABU/وائل

x y C S

0 0 0 0

0 1 0 1

1 0 0 1

1 1 1 0

4. Truth table

5. Simplification:

C = x.y ( No more simplification)

S = x.y’ + x’y

= x + y

Page 101: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

101قصاص AABU/وائل

6. Draw logic diagram

X

Y

C

S

Page 102: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

102قصاص AABU/وائل

Full ADDER: Build a circuit that can Add three binary numbers.

Page 103: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

103قصاص AABU/وائل

SubtractorsHalf Subtractor

X-Y

X Y B D

0 – 0 = 0 0

0 – 1 =1 1

1 – 0 = 0 1

1 – 1= 0 0

Page 104: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

104قصاص AABU/وائل

Full Subtractor

X- Y – Z BD

0 – 0 – 0 = 0 0

0 – 0 - 1 = 1 1

0 – 1 – 1 = 1 0

1 - 1 - 0 = 0 0

1 - 1 – 1 = 1 1

Page 105: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

105قصاص AABU/وائل

Code ConversionWe studied before different coding techniques for

numbers or alphanumarics, such as BCD, Excess_3 ,…

Let us build a combinational circuit that can convert from BCD to Excess_3.

1. BCD code and Excess_3 code are used to represent a decimal digit in binary, each code represnts the decimal digit as 4 bits.

2. Let us name the BCD input variables as A,B,C,D , and the output Excess_3 variables as w,x,y,z.

Page 106: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

106قصاص AABU/وائل

Truth table

Decimal

_______

0

1

2

3

4

5

6

7

8

9

BCD

ABCD

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

Ex_3

wxyz

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100 Xxxx

Xxxx

Xxxx

Xxxx

Xxxx

Xxxx

We also have don’t care conditions in this example, 1010, 1011,1100,1101, 1110,1111 are not accepted codes in BCD, which so can be considers as don’t care.

d(A,B,C,D)=Σ(10,11,12,13,14,15) for all outputs.

Page 107: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

107قصاص AABU/وائل

Simplify the function for each output.

0 0 0 0

0 1 1 1

x x x x

1 1 X x

0 1 1 1

1 0 0 0

x x x X

0 1 x X

w x

y z

Page 108: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

108قصاص AABU/وائل

Ex-3 to BCD

decimal Ex-3

ABCD

BCD

WXYZ

0000 XXXX

0001 XXXX

0010 XXXX

0 0011 0000

1 0100 0001

2

3

4

5

6

7

8

9

XXXX

XXXX

1111 XXXX

Page 109: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

109قصاص AABU/وائل

QuestionsQ1. Build a circuit that has an input of 3-bit binary number

and the output is the number multiplied by 3

Q2. Build a circuit that has an input of 4-bit binary number and the output is the number divided by 3

1) What is the max output

2) How many bits do we need to represent this output

3) Design the circuit

Page 110: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

110قصاص AABU/وائل

ProjectDesign using (a 7-seg. Display) english characters

display:

1. The circuit should have 5 inputs ,since the english characters are 26 only,

2. The letter A has the code 1 =“00001”, and the Z has the code 26

3. Try to represent the characters as small letter, if conflict occurs , use the shape of the Capital letter.

4. What are the characters that cant be represented?

Page 111: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

111قصاص AABU/وائل

4.6 Analysis procedure ( Reverse Engineering)Analysis of combinational circuit to find the boolean

function from the logic diagram.

1. Label the output of all gates , that are connected to input variables

2. Label other gates, and find the function of the these gates

3. Repeat the process until you reach the output

Page 112: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

112قصاص AABU/وائل

Example

Page 113: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

113قصاص AABU/وائل

Derivation of truth tableTo derive the truth table for a given logical diagram

•First label the output of each gate •Write the function of each label, using the labels of the previous gates•Then after putting all possible input combinations , start to find the output of each level going from input side.•Repeat the for the next levels until you reach the output.

Page 114: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

114قصاص AABU/وائل

Page 115: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

115قصاص AABU/وائل

Solution for Fig 4.9 Page130

ABC T1 T2 T3 T4

000

001

010

011

100

101

110

111

Page 116: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

116قصاص AABU/وائل

NAND representation

Page 117: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

117قصاص AABU/وائل

Page 118: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

118قصاص AABU/وائل

Page 119: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

119قصاص AABU/وائل

Page 120: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

120قصاص AABU/وائل

Q 4.14 P151BCD to 7 segment display.

1. Build the truth table for each segment

2. Minimize the function of each segment, ( use the don’t care conditions)

Page 121: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

121قصاص AABU/وائل

Page 122: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

122قصاص AABU/وائل

Chapter 5: VLSI, MSI & LSIMSI and LSI

SSI:

MSI : Medium Scale Integrated circuit, < 50 gate in one IC

LSI : Large Scale Integrated circuit > 50 gate in one IC

VLSI : Very Large Scale Integrated circuit.

Ex. • 4 bit full adder• BCD to 7 segment decoder

Page 123: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

123قصاص AABU/وائل

Parallel Four-bit Adder

Page 124: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

124قصاص AABU/وائل

Examples using MSI circuits1. Using 4 bit full adder as a BCD to Ex-3 converter

2. Using the 4 bit full adder as an Ex_3 to BCD converter

3. Using 4 bit full adder as a 4 bit subtractor

4. Using 4 bit full adder as an adder and/or a subtractor

Page 125: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

125قصاص AABU/وائل

4. Using 4 bit full adder as an adder and/or a subtractor

B

0

To build a circuit that adds two numbers we need a full adder

To build a circuit that subtracts two numbers

A-B= A+B’+1

We need a circuit that gives B if the operation is Add “0”

And gives B’ is the Operation is subtract “1”

B B

1B’

Page 126: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

126قصاص AABU/وائل

Page 127: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

127قصاص AABU/وائل

Building a BCD ADDERThe BCD adder should have 9 inputs, and 5 outputs.

Trying to build a truth table for this is not a good idea

(number of possible states for inputs is 29 =512.

We also will have many don’t care states.

The other solution is to use 4bit full adders with a small combinational circuit

Things to take into consideration

1. If the sum of the 2 BCD numbers is <= 9 , no problem in the result

2. If the sum was greater than 9, it will not be in the BCD format, we need to correct the result

Page 128: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

128قصاص AABU/وائل

0101 0101

0100 0111

1001=9 1100 = 12 ,

but we write 12 in BCD as 0001 0010

Another case ( worst one)

1001

1001

10010 =18

Again , in BCD 18 is 0001 1000

Page 129: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

129قصاص AABU/وائل

The solution:

If the resulting sum is >9 we need to correct the sum by adding 6= 0110

We have two cases

1) The answer between 1010 and 1111 , with carry =0

2) The carry out is 1 , which means that the sum is > 15

Page 130: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

130قصاص AABU/وائل

S3S2S1S0 >9

0000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 11011 11100 11101 11110 11111 1

S>=9 : Cout+S3S2+S3S1

0 0 0 0

0 0 0 0

1 1 1 1

0 0 1 1

S3S2

S1S0

Page 131: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

131قصاص AABU/وائل

Page 132: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

132قصاص AABU/وائل

4 bit Magnitude comparatorWe need to build a combinational circuit that compares two numbers ,

The circuit will have 3 outputs

A>B

A<B

A=B

Page 133: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

133قصاص AABU/وائل

Decodern inputs, 2n outputs

• exactly one output is 1 for each possible input pattern

2-bitdecoder

Page 134: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

134قصاص AABU/وائل

Decodern inputs, 2n outputs

A

B

Y0 1

Y1

Y2

Y3

0

0

0

1

11

01

1

1

1

Page 135: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

135قصاص AABU/وائل

Build a 3x8 Decoder

Page 136: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

136قصاص AABU/وائل

3x8 Decoder

Implement combinational circuits using a decoder , OR gates

Ex.1: F = (1,3,4,5,6,7)

Ex.2 Full adder, using 3x8 decoder

Page 137: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

137قصاص AABU/وائل

Inverted output decoder

Why we build a decoder using NAND gates?

Page 138: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

138قصاص AABU/وائل

Decoder with Enable

E

If E=1 , else all outputs are zeros

Page 139: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

139قصاص AABU/وائل

Building an 3x8 decoder using 2x4 decoders with enable

2x4

A

B

Y0

Y1

Y2

Y3

2x4

A

B

Y0

Y1

Y2

Y3

X

Y

Z

3x8

Page 140: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

140قصاص AABU/وائل

4x16 Decoder using 2x4 decoders

A

B

C

D

y0

y15

Page 141: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

141قصاص AABU/وائل

Build larger decodersHow can we build a 4x16 decoder using 3x8 decoders

3x8 Y0-Y7

3x8 Y8-Y15

Y0- Y15

ABCD

Page 142: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

142قصاص AABU/وائل

Second exam12/4 Thursday

1-2

MQ 102

Page 143: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

143قصاص AABU/وائل

EncoderAn Encoder is a digital function that produces a reverse operation for that of a decoder.

2n x n encoder , has 2n inputs and n outputs

1

0

0

0

0

0

0

1

0

0

0

1

Page 144: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

144قصاص AABU/وائل

Multiplexer (MUX)n-bit selector and 2n inputs, one output

• output equals one of the inputs, depending on selector

4-to-1 MUX

Page 145: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

145قصاص AABU/وائل

Multiplexer (MUX)n-bit selector and 2n inputs, one output

S1 S0

I0

I1

I2

I3

0 0

01

0 1

1

1

0

Page 146: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

146قصاص AABU/وائل

Demultiplexer

2x4 decoderWith Enable

D0

D1

D2

D3

A

B

E

1x4 demultiplexer

D0

D1

D2

D3

input

S1 S0

A demultiplexer is a combinational circuit that sends the input to the output selected by selection lines.

A demultiplexer can be seen as a decoder with enable.

Page 147: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

147قصاص AABU/وائل

2x1 Mux

Page 148: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

148قصاص AABU/وائل

Quadruple 2x1 MuxIf we have 2 binary numbers A & B, each is 4 bit and we need to select one of the two numbers.

We need 4 (2x1) MUXs, or a Quad 2x1 mux with one selection line .

A3

Y3 Y2 Y1 Y0

A2 A1 A0 B3 B2 B1 B0

S

Page 149: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

149قصاص AABU/وائل

MUX to implement boolean functions.We saw before how to implement a boolean function using decoders.

We can also implement this using a mux

1. If we have a function with n variables we need a MUX with n-1 selection lines ( 2n-1 MUX)

2. Find the implementation table, then draw the circuit

Ex. for F(x,y,z)=Σ(1,3,5,6)

I0 I1 I2 I3

X’ 0 1 2 3

X 4 5 6 7

0 1 X X’

Page 150: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

150قصاص AABU/وائل

4x1 MUX

Output

I0

I1

I2

I3

0

1

X

X’

Y Z

S1 S0

Page 151: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

151قصاص AABU/وائل

Implement the boolean function F(w,x,y,z)=Σ(0,1,3,4,8,9,15) using Multiplexer

Page 152: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

152قصاص AABU/وائل

ROMTypes:

ROM : Read Only memory

PROM : Programmable Read Only memory

EPROM: Erasable Programmable Read Only memory

EEPROM: Electrically erasable Programmable Read Only memory

Page 153: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

153قصاص AABU/وائل

HOW ROM worksIt consists of a decoder and OR gates.

In general Memory has address and Data lines.

We call a ROM with n address lines and m data lines 2nxm memory

This memory has 2n words, each word is m bits

2nxm ROM

n inputsm outputs

Page 154: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

154قصاص AABU/وائل

Decoder3

8 x 4 bit Memory

0 0010

1 0101

2 0000

3 1111

4 0010

5 0101

6 1011

7 0011

D3 D2 D1 D0

001

Page 155: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

155قصاص AABU/وائل

From the previous discussion its clear that each output of the ROM represents a SOP

Ex.

D0= Σ(1,3,5,6,7)

D1= Σ(0,3,4,6,7)

D2=

D3=

Page 156: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

156قصاص AABU/وائل

Decoder

D3 D2 D1 D0

Page 157: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

157قصاص AABU/وائل

Page 158: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

158قصاص AABU/وائل

Another exampleAssume we want to build the Following Ckt that has two inputs and three outputs

F0 (A1,A0) =Σ(1,3)

F1 (A1,A0) = Σ(0,3)

F2 (A1,A0) = Σ(0,1,2)We can build this Ckt using a 4x3 ROM = 22 x 3 bit ROMThis ROM is built from a decoder, OR gates

2 x 4 Decoder

A1

A0

4 x 3ROM

Page 159: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

159قصاص AABU/وائل

Q. What is the Data stored in this ROM?

Page 160: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

160قصاص AABU/وائل

BCD to Ex.3 ConverterWhat is the size of the ROM needed?

What will be the data stored?

BCD to 7 segment ConverterWhat is the size of the ROM needed?

What will be the data stored?

Page 161: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

161قصاص AABU/وائل

Build a 3 by 8 decoder using a ROM:

0000 0001

0000 0010

0000 0100

0000 1000

0001 0000

0010 0000

00

Page 162: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

162قصاص AABU/وائل

Combinational vs. SequentialCombinational Circuit

• always gives the same output for a given set of inputsex: adder always generates sum and carry,

regardless of previous inputs

Sequential Circuit• stores information• output depends on stored information (state) plus input

so a given input might produce different outputs,depending on the stored information

• example: ticket counteradvances when you push the buttonoutput depends on previous state

• useful for building “memory” elements and “state machines”

Page 163: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

163قصاص AABU/وائل

Sequential LogicSynchronous sequential circuits:

A system whose behavior can be defined form the knowledge of its signals at discrete instants of time.

Asynchronous sequential circuits: a system whose behavior depends on the order which its input signals changes at any instance of time

Page 164: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

164قصاص AABU/وائل

Page 165: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

165قصاص AABU/وائل

Page 166: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

166قصاص AABU/وائل

Flip Flops

Page 167: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

167قصاص AABU/وائل

Page 168: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

168قصاص AABU/وائل

Page 169: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

169قصاص AABU/وائل

Page 170: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

170قصاص AABU/وائل

R-S Latch: Simple Storage ElementR is used to “reset” or “clear” the element – set it to zero.

S is used to “set” the element – set it to one.

If both R and S are one, out could be either zero or one.• “quiescent” state -- holds its previous value• note: if a is 1, b is 0, and vice versa

1

0

1

1

1

1

0

0

1

1

0

0

1

1

Page 171: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

171قصاص AABU/وائل

Clearing the R-S latchSuppose we start with output = 1, then change R to zero.

Output changes to zero.

Then set R=1 to “store” value in quiescent state.

1

0

1

1

1

1

0

0

1

0

1

0

0

0

1

1

Page 172: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

172قصاص AABU/وائل

Setting the R-S LatchSuppose we start with output = 0, then change S to zero.

Output changes to one.

Then set S=1 to “store” value in quiescent state.

1

1

0

0

1

1

0

1

1

1

0

0

Page 173: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

173قصاص AABU/وائل

R-S Latch Summary built by NANDR = S = 1

• hold current value in latch

S = 0, R=1• set value to 1

R = 0, S = 1• set value to 0

R = S = 0• both outputs equal one• final state determined by electrical properties of gates• Don’t do it!

Page 174: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

174قصاص AABU/وائل

Gated D-LatchTwo inputs: D (data) and WE (write enable)

• when WE = 1, latch is set to value of DS = NOT(D), R = D

• when WE = 0, latch holds previous valueS = R = 1

Page 175: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

175قصاص AABU/وائل

Characteristic equationsRemember that the output depends on the inputs and the current state.

• First find the characteristic table • Then derive the characteristic equation for the RS flip flop.

Qt S R Qt+1

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 X

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 X

0 0 X 1

1 0 X 1

Qt+1=S+R’Qt

Qt

SR

Page 176: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

176قصاص AABU/وائل

Characteristic equation for D flip flop

Qt D Qt+1

0 0 0

0 1 1

1 0 0

1 1 1

0 1

0 1

Q(t+1)=D

Page 177: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

177قصاص AABU/وائل

J K flip flopIt’s a refinement of RS flip flop , that defined the indeterminate states in RS.

In RS flip flop the state 11 is not allowed ,

In JK flip flop the state 11 makes the flip flop changes (switches) its output.

Page 178: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

178قصاص AABU/وائل

Problem in JK flip flop:

•When J=1 ,K=1 and the clock is 1 , Qt+1=Q’t

•Assume Q=1, it will flip to 0 then to 1 then to 0 and so on as long as the clock is 1.•To avoid that the clock pulse (duration) must be less than the propagation delay of the Flip flop.•But this is not a solution.•The solution is to build a Master slave or edge triggered construction.

Page 179: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

179قصاص AABU/وائل

Characteristic table and Equation

Qt J K Qt+1

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 1

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 0

0 0 1 1

1 0 0 1Q

JK

Qt+1=JQt’+K’Qt

Page 180: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

180قصاص AABU/وائل

T flip flopIt’s a single input version of the JK Flip flop

T flip Flop has the same

Problem of JK when T=1

Qt T Qt+1

0 0 0

0 1 1

1 0 1

1 1 0

0 1

1 0

Qt+1=TQ’t+T’Qt

Page 181: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

181قصاص AABU/وائل

Page 182: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

182قصاص AABU/وائل

Master Slave D flip flop

Page 183: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

183قصاص AABU/وائل

Y= D; C=1 تكون عندما

Y=Y when C=0

Q=Y when C=0Q=Q when C=1

Page 184: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

184قصاص AABU/وائل

Master Slave RS flip flop

S

Master

R

S

Slave

R

Q

Q’

S

R

CP

Page 185: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

185قصاص AABU/وائل

1

2

3

4

Page 186: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

186قصاص AABU/وائل

When CLK = 0 , gates 2,3 are not working,gate 2=1. gate3=1 R=1,S=1No change in the output.

If D=0; Gate 4=1, Gate1 =0.

If D=1; Gate 4=0, Gate1 =1.

Page 187: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

187قصاص AABU/وائل

IF D=0 Gate1=0,Gate4=1,Gate2=1,Gate3=1;

and CLK goes to 1

Gate 4=1, Gate 3=0, Gate1=0;Gate 2=1;

After the CLK being 1, if D changed to 1, this will not affect on Gate 4 , nor any other gates.

Page 188: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

188قصاص AABU/وائل

IF D=1 Gate1=1,Gate4=0,Gate2=1,Gate3=1;

and CLK goes to 1

Gate 4=0, Gate 3=1, Gate1=1;Gate 2=0;

After the CLK being 1, if D changed to 0, Gate 4 =1 , other gates will not affect by this change.

Page 189: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

189قصاص AABU/وائل

Page 190: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

190قصاص AABU/وائل

Positive edge triggered JK flip Flop from D flip flop

Page 191: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

191قصاص AABU/وائل

Positive Edge triggered T-Flip flop

Page 192: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

192قصاص AABU/وائل

Analysis of sequential circuitThe behavior of a seq. ckt is determined form

a) Inputs

b) Outputs

c) States of its flip flop

Both outputs and next state are function of input and present state.

From a seq. ckt diagram , we will find the

a) state table

b) State diagram

c) State Equation

Page 193: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

193قصاص AABU/وائل

Example: analyze the following sequential circuit

R Q’

S Q

R Q’

S Q

X

A

Y

CP

A

A’

B

B’

B

B’

A’

A

Page 194: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

194قصاص AABU/وائل

State Table

Present State

Next state Output

X=0 X=1 X=0 X=1

AB AB AB Y Y

00 00 01 0 0

01 11 01 0 0

10 10 00 0 1

11 10 11 0 0

Page 195: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

195قصاص AABU/وائل

Present State

Next state

xAB AB

000 00

001 11

010 10

011 10

100 01

101 01

110 00

111 11

Page 196: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

196قصاص AABU/وائل

State diagramThe state table can be represented graphically using the state diagram.

Transition from a state to state is shown as arrow labeled with two values (Input/output)

00

01

11

10

0

1

1

0

Page 197: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

197قصاص AABU/وائل

State equationState equation (or application equation) is an expression that shows the relation for the next state of each flip flop as a function of the present state and the inputs,

Method 1: using the characteristic equation of the flip flop

QA(t+1) =S+R’QAt

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

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

= X’B+X’.A+A.B

B(t+1) = S+R’Q

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

= X.A’+X.B+A’.B

R

S

R

S

X

A

Y

CP

A

A’

B

B’

B

B’

A’

A

Page 198: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

198قصاص AABU/وائل

State equationMethod 2:

From the state table.

A(t+1) = 00 01 11 10

0 0 1 1 1

1 0 0 1 0x

AB

Page 199: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

199قصاص AABU/وائل

6.7 Design procedure1. Build the state diagram

2. Build the state table

3. Assign binary values for each state

4. Determine the number of flip flops needed and assign a symbol for each flip flop

5. Choose the type of flip flop to be used (we will use JK)

6. From the state table derive the excitation and output tables

7. Simplify the flip flop functions

8. Draw the logic diagram

Page 200: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

200قصاص AABU/وائل

The following formulas for JK flip flop inputs will help us

Qt Qt+1

0 to 0 J=0, K=X ( don’t care)

0 to 1 J=1, K=X

1 to 0 J=X, K=1

1 to 1 J=X, K=0

Page 201: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

201قصاص AABU/وائل

Excitation tables for Flip Flops

Qt Qt+1 S R

0 0 0 X

0 1 1 0

1 0 0 1

1 1 X 0

RS

Qt Qt+1 J K

0 0 0 X

0 1 1 X

1 0 X 1

1 1 X 0

JK

Qt Qt+1 D

0 0 0

0 1 1

1 0 0

1 1 1D

Qt Qt+1 T

0 0 0

0 1 1

1 0 1

1 1 0T

Page 202: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

202قصاص AABU/وائل

Example 1Design a circuit that works as a counter from 0 to 3 if the input x is 1 and stay in the same state if x is 0

01

10

00

11

1

1 1

1

0

0

0

0

Page 203: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

203قصاص AABU/وائل

State table

X=0 X=1

AB AB AB

00 00 01

01 01 10

10 10 11

11 11 00

We have 4 states so we need 2 flip flops

Page 204: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

204قصاص AABU/وائل

Excitation table Next state flip flop inputs

A B X A B JA KA JB KB0 0 0 0 0 0 X 0 X0 0 1 0 1 0 X 1 X0 1 0 0 1 0 X X 00 1 1 1 0 1 X X 11 0 0 1 0 X 0 0 X1 0 1 1 1 X 0 1 X1 1 0 1 1 X 0 X 01 1 1 0 0 X 1 X 1

Now we need to simplify the equation of each flip flop input

Page 205: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

205قصاص AABU/وائل

0 0 1 0

x x x X

x x x X

0 0 1 0

0 1 x X

0 1 x x

x x 1 0

x x 1 0

JA=Bx KA=Bx

JB=x KB=x

Page 206: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

206قصاص AABU/وائل

A

B

J

JX

K

K

QA

QB

Clock

Page 207: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

207قصاص AABU/وائل

Example 2Design a counter that counts from 3 down to 0 one step on each clock

Page 208: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

208قصاص AABU/وائل

Example 3Design a circuit that works as a down counter from 3 down to 0 if the input x is 1 and stay in the same state if x is 0

Page 209: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

209قصاص AABU/وائل

xAB AB Ta Tb

000

001

010

011

100

101

110

111

00

01

10

11

11

00

01

10

0

0

0

0

1

0

1

0

0

0

0

0

1

1

1

1

Page 210: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

210قصاص AABU/وائل

Example 4Design a sequential circuit that counts from 0 to 3 if X=1

And from 3 down to 0 if X=0

Present

xAB

Next

AB

Sa Ra Sb Rb

000

001

010

011

100

101

110

111

11

00

01

10

01

10

11

00

1

0

0

X

0

1

X

0

0

X

1

0

X

0

0

1

1

0

1

0

1

0

1

0

0

1

0

1

0

1

0

1

Page 211: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

211قصاص AABU/وائل

1 0 x 0

0 1 0 x

0 X 0 1

X 0 1 0

Ra=x’AB’+xAB

Page 212: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

212قصاص AABU/وائل

Example 5Design a sequential Ckt that generates the following sequence 000, 001, 010,100 , using T flip flops

This circuit has 4 states

01

10

00

11

Page 213: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

213قصاص AABU/وائل

Combinational CktSequential CktInputs

State Output

Clock

Page 214: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

214قصاص AABU/وائل

AB

Next

AB Ta Tb

Output

00

01

10

11

01

10

11

00

0

1

0

1

1

1

1

1

000

001

010

100

Page 215: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

215قصاص AABU/وائل

Example 6Repeat example 1 using RS flip flop

1) How RS Flip flop works

0 to 0 S=0, R=X ( don’t care)

0 to 1 S=1, R=0

1 to 0 S=0, R=1

1 to 1 S=X, R=0

2) Build the Excitation table, then simplify the equations that represents R and S for each flip flop.

Page 216: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

216قصاص AABU/وائل

Excitation table Next state flip flop inputs

A B X A B SA RA SB RB0 0 0 0 0 0 X 0 X0 0 1 0 1 0 X 1 00 1 0 0 1 0 X X 00 1 1 1 0 1 0 0 11 0 0 1 0 X 0 0 X1 0 1 1 1 X 0 1 01 1 0 1 1 X 0 X 01 1 1 0 0 0 1 0 1

Now we need to simplify the equation of each flip flop input

Page 217: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

217قصاص AABU/وائل

0 0 1 0

X X 0 X

X X 0 X

0 0 1 0

0 1 0 X

0 1 0 X

x 0 1 0

x 0 1 0

SA= RA=

SB= RB=

Page 218: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

218قصاص AABU/وائل

Example 7Design an up_down counter that counts from 0 to 6, depending on the input value, if x=0 it counts down, if 1 it counts up

001

010

011

100

101

000110

Page 219: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

219قصاص AABU/وائل

Present

xABC

Next

ABC

Da Db Dc

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

110

000

001

010

011

100

101

XXX

001

010

011

100

101

110

000

XXX

1

0

0

0

0

1

1

X

0

0

0

1

1

1

0

X

1

0

0

1

1

0

0

X

0

1

1

0

0

1

0

X

0

0

1

0

1

0

1

X

1

0

1

0

1

0

0

X

Page 220: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

220قصاص AABU/وائل

1 0 0 0

0 1 X 1

1 1 x 0

0 0 1 0

Da=

Page 221: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

221قصاص AABU/وائل

details on example 7We have a small problem here.

What if the counter started with 111 ?

We need to move it to one of the valid states,

To 000 for example

001

010

011

100

101

000

111

110

Page 222: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

222قصاص AABU/وائل

Non-Standard Counters

•Counters are sometimes defined that count in an order other than standard numerical order.•The state machine below is for a gray code counter in which one bit changes at a time.

Page 223: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

223قصاص AABU/وائل

3 bit binary counter

Page 224: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

224قصاص AABU/وائل

Page 225: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

225قصاص AABU/وائل

Page 226: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

226قصاص AABU/وائل

Complete ExampleA blinking traffic sign

• No lights on• 1 & 2 on• 1, 2, 3, & 4 on• 1, 2, 3, 4, & 5 on• (repeat as long as switch

is turned on)• When the input is 0 , No lights on

DANGERMOVERIGHT

1

2

3

4

5

Page 227: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

227قصاص AABU/وائل

Combinational CktSequential CktInputs

State Output

Clock

Page 228: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

228قصاص AABU/وائل

Traffic Sign State Diagram

State bit S1 State bit S0

Switch onSwitch off

Outputs

Transition on each clock cycle.

Page 229: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

229قصاص AABU/وائل

Next state flip flop inputsx A B A B Ta Tb0 0 0 0 00 0 1 0 00 1 0 0 0 0 1 1 0 01 0 0 0 1 1 0 1 1 01 1 0 1 11 1 1 0 0Now we need to simplify the equation of each flip flop input

Page 230: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

230قصاص AABU/وائل

Traffic Sign Truth Tables

Outputs(depend only on state: S1S0)

S1 S0 Z Y X

0 0 0 0 0

0 1 1 0 0

1 0 1 1 0

1 1 1 1 1

Lights 1 and 2

Lights 3 and 4

Light 5

Next State: S1’S0’(depend on state and input)

In S1 S0 S1’ S0’

0 X X 0 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 1

1 1 1 0 0

Switch

Whenever In=0, next state is 00.

Page 231: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

231قصاص AABU/وائل

2 input Sequential CktsQ. Build a counter that counts from 0 to 3, this counter

has two inputs X,Y,

XY

00 Reset the counter ( go to state 00)

01 Count forward

10 Counts backward

11 No change

Page 232: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

232قصاص AABU/وائل

We have 4 states we need two flip flops

We have 2 inputs each state has 4 transitions

01

10

00

11

Page 233: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

233قصاص AABU/وائل

State table

Present state

A BXY=00

A B

XY=01

A B

XY=10

A B

XY=11

A B

0 0

0 1

1 0

1 1

Next state

Page 234: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

234قصاص AABU/وائل

Excitation tableXYAB AB TA TB

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

Page 235: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

Chapter 7

Registers, Counters, and Memory units

Page 236: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

236قصاص AABU/وائل

Gated D-LatchTwo inputs: D (data) and WE (write enable)

• when WE = 1, latch is set to value of DS = NOT(D), R = D

• when WE = 0, latch holds previous valueS = R = 1

Page 237: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

237قصاص AABU/وائل

RegisterA register stores a multi-bit value.

• We use a collection of D-latches, all controlled by a common WE.

• When WE=1, n-bit value D is written to register.

Page 238: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

238قصاص AABU/وائل

4 bit register

Q

D

A0

I0

Q

D

A1

Q

D

A2

I2

Q

D

A3

I1I3

Clock

Page 239: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

239قصاص AABU/وائل

Register with parallel load

Page 240: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

240قصاص AABU/وائل

4 bit Shift right register

Page 241: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

241قصاص AABU/وائل

Serial Transfer

Page 242: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

242قصاص AABU/وائل

Page 243: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

243قصاص AABU/وائل

Serial Adder

Page 244: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

244قصاص AABU/وائل

Page 245: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

245قصاص AABU/وائل

Ripple counter

Page 246: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

246قصاص AABU/وائل

4 bit ribble couter (JK)

Q J

K

1

1

ClkQ J

K

1

1

ClkQ J

K

1

1

ClkQ J

K

1

1

Clk

A0A1A2A3

Page 247: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

247قصاص AABU/وائل

Decimal counter

Page 248: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

248قصاص AABU/وائل

BCD Ripple counter

Page 249: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

249قصاص AABU/وائل

•In BCD counter the first digit flips with the clock,•The second digit flips depending on the first digit a clock if the number is less than 8, since J is connected to Q8’

•When Q8 becomes 1, J will be 0, this will clear Q2.

•BUT this will take effect only after Q0 goes from 1 to 0.•What about J8

Page 250: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

250قصاص AABU/وائل

MSI 4 bit counter with Parallel load

I0 A0

I1 A1

I2 A2

I3 A3

Load

Clock

Clear

Page 251: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

251قصاص AABU/وائل

What is the different between if

Clear =1

Or

If load = 1 and the inputs are 0000

Page 252: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

252قصاص AABU/وائل

Using an MSI Binary counter , Build a BCD counter

•As you know, BCD counter goes to 0 after 9.•All what we want to do is to load 0 if the counter value is 9

I0 A0

I1 A1

I2 A2

I3 A3

Load

Clock0

Page 253: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

253قصاص AABU/وائل

www.datasheet4u.com

www.TI.com

Page 254: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

254قصاص AABU/وائل

Build a counter that counts from 0 to 6

Page 255: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

255قصاص AABU/وائل

Build a counter that counts from 5 to 13

Page 256: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

256قصاص AABU/وائل

Johnson counterSelf read.

Required for the exam.

0000

1000

1100

1110

1111

0111

0011

0001

0000

Page 257: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

257قصاص AABU/وائل

Memory Unit•A memory unit stores binary information in groups called words. Each is n bits.•Memory size is the number of locations (words) that a memory have.•A memory word ( which contains binary numbers) is used to represent an Instruction, Number, Character,…•MAR•MDR

MemoryMAR

MDR

Read

Write

Page 258: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

258قصاص AABU/وائل

Binary Cell & RAM

BC

Select

Output

Read/Write

input

R

S Q

Page 259: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

259قصاص AABU/وائل

Page 260: Digital Logic design 901220 By: Dr. Wa’el Al Qassas Al Albayt university

260قصاص AABU/وائل