cs121 : digital design

58
CS121 : Digital Design

Upload: howe

Post on 05-Jan-2016

44 views

Category:

Documents


3 download

DESCRIPTION

CS121 : Digital Design. Basic Information. Title : Digital Design Code : CS121 Lecture : 3 Tutorial : 1 Pre-Requisite : Computer Introduction. Overall Aims of Course. By the end of the course the students will be able to: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CS121 : Digital Design

CS121 : Digital Design

Page 2: CS121 : Digital Design

Basic Information

Title: Digital Design Code: CS121 Lecture: 3 Tutorial: 1 Pre-Requisite: Computer Introduction

Page 3: CS121 : Digital Design

Overall Aims of Course

By the end of the course the students will be able to: Grasp basic principles of combinational and sequential

logic design. Determine the behavior of a digital logic circuit

(analysis) and translate description of logical problems to efficient digital logic circuits (synthesis).

Understanding of how to design a general-purpose computer, starting with simple logic gates.

Page 4: CS121 : Digital Design

Contents

TopicsContactHours

No. ofWeeks

-Introduction to the course content, text book(s), reference(s) and course plane.

- Digital Systems and Binary numbers9 3

- Boolean Algebra and Logic Gates 6 2

- Gate Level Minimization 6 2

- Combinational Logic 12 4

- Synchronous Sequential Logic 12 4

Total 45 15

Page 5: CS121 : Digital Design

Assessment schedule

Assessment Methods Week Weighting of Assessments

First Midterm Exam 6 10%

Second Midterm Exam 12 15%

Quiz 5 & 10 5%

Lab-project 11 5%

Lab- Evaluation 2,4,6,8,10,12 5%

Final Lab 15 20%

Final Exam After week15 40%

Total 100%

Page 6: CS121 : Digital Design

List of References

Essential Books “DIGITAL DESIGN”, by Mano M. Morris, 4th edition, Prentice- Hall.

Recommended Books “FUNDAMENTALS OF LOGIC DESIGN”, by Charles H. Roth,

Brooks/Cole Thomson Learning. “INTRODUCTION TO DIGITAL SYSTEMS”, by M.D. ERCEGOVAC, T.

Lang, and J.H. Moreno, Wiley and Sons. 1998. “DIGITAL DESIGN, PRINCIPLES AND PRACTICES”, by John F.Wakely,

Latest Edition, Prentice Hall, Eaglewood Cliffs, NJ. “FUNDMENTALS OF DIGITAL LOGIC WITH VHDL DESIGN”, by

Stephen Brown and Zvonko Vranesic, McGraw Hill. “INTRODUCTION TO DIGITAL LOGIC DESIGN”, by John Hayes,

Addison Wesley, Reading, MA.

Page 7: CS121 : Digital Design

1. Digital Systems and Binary Numbers

1.1 Digital Systems1.2 Binary Numbers1.3 Number-Base Conversions

1.4 Octal and Hexadecimal Numbers

1.5 Complements

1.6 Signed Binary Numbers

1.7 Binary Codes

Page 8: CS121 : Digital Design

1.1 Digital Systems

Page 9: CS121 : Digital Design

1.2 Binary Numbers

In general, a number expressed in a base-r system has coefficients multiplied by powers of r:

r is called base or radix.

Page 10: CS121 : Digital Design
Page 11: CS121 : Digital Design

1.3 Number-Base Conversions (Integer Part)

Example:

Page 12: CS121 : Digital Design

1.3 Number-Base Conversions (Fraction Part)

Example:

Page 13: CS121 : Digital Design

Binary-to-Decimal Conversion

Example:

Example:

Page 14: CS121 : Digital Design

1.4 Octal and Hexadecimal Numbers

Page 15: CS121 : Digital Design

Decimal-to-Octal Conversion

Example:

Page 16: CS121 : Digital Design

Decimal-to-Hexadecimal Conversion

Example:

Page 17: CS121 : Digital Design

Octal-to-Decimal Conversion

Example:

Example:

Page 18: CS121 : Digital Design

Hexadecimal-to-Decimal Conversion

Example:

Example:

Page 19: CS121 : Digital Design

Binary–Octal and Octal–Binary Conversions

Example:

Example:

Page 20: CS121 : Digital Design

Hex–Binary and Binary–Hex Conversions

Example:

Example:

Page 21: CS121 : Digital Design

Hex–Octal and Octal–Hex Conversions

For Hexadecimal–Octal conversion, the given hex number is firstly converted into its binary equivalent which is further converted into its octal equivalent.

An alternative approach is firstly to convert the given hexadecimal number into its decimal equivalent and then convert the decimal number into an equivalent octal number. The former method is definitely more convenient and straightforward.

For Octal–Hexadecimal conversion, the octal number may first be converted into an equivalent binary number and then the binary number transformed into its hex equivalent.

The other option is firstly to convert the given octal number into its decimal equivalent and then convert the decimal number into its hex equivalent. The former approach is definitely the preferred one.

Page 22: CS121 : Digital Design

Example

Page 23: CS121 : Digital Design

Arithmetic Operation

augend 101101Added: + 100111 ----------

Sum: 1010100

Addition

Page 24: CS121 : Digital Design

Subtraction

minuend: 101101subtrahend: - 100111 -------------difference: 000110

Page 25: CS121 : Digital Design

Multiplication

Page 26: CS121 : Digital Design

Diminished Radix Complement ((r-1)‘s complement)

Given a number N in base r having n digits, the (r - 1)’sComplement of N is defined as (rn- 1) -N.

the 9’s complement of 546700 is 999999 – 46700=453299the 1’s complement of 1011000 is 0100111

Note: The (r-1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit from 7 or F (decimal 15), respectively

1.5 Complements

Page 27: CS121 : Digital Design

Radix Complement

Given a number N in base r having n digit, the r’s complement of Nis defined as (rn -N) for N ≠0 and as 0 for N =0 .

The 10’s complement of 012398 is 987602The 10’s complement of 246700 is 753300The 2’s complement of 1011000 is 0101000

Page 28: CS121 : Digital Design

Subtraction with Complement

The subtraction of two n-digit unsigned numbers M – N in base r can be done as follows:

M + (rn - N), note that (rn - N) is r’s complement of N. If M N, the sum will produce an end carry x,

which can be discarded; what is left is the result M- N. If M < N, the sum does not produce an end carry

and is (N - M). Take the r’x complement of the sum and place a negative sign in front.

Page 29: CS121 : Digital Design

Example:

Using 10’s complement subtract 72532 – 3250

M = 72532

10’s complement of N = 96750

sum = 169282

Discarded end carry 105 = -100000 answer: 69282

Page 30: CS121 : Digital Design

Example:

Using 10’s complement subtract 3250 - 72532

M = 03250

10’s complement of N = 27468

sum = 30718

Discarded end carry 105 = -100000 answer: -(100000 - 30718) = -69282

The answer is –(10’s complement of 30718) = -69282

Page 31: CS121 : Digital Design

Example

Using 2’s complement subtract (a) 1010100 – 1000011

M = 1010100

N = 1000011, 2’s complement of N = 0111101

1010100

0111101 sum = 10010001

Discarded end carry 27=-10000000answer: 0010001

Page 32: CS121 : Digital Design

Example

(b) 1000011 – 1010100M = 1000011

N = 1010100, 2’s complement of N = 0101100

1000011 0101100sum = 1101111

answer: - (10000000 - 1101111) = -0010001

The answer is –(2’s complement of 1101111) = - 0010001

Page 33: CS121 : Digital Design

Using 1’s complement, subtract 1010100 - 1000011

M = 1010100

N = 1000011, 1’s complement of N = 0111100

answer: 0010001

1010100 0111100

10010000

33

Example

end-around carry = + 1

Page 34: CS121 : Digital Design

Using 1’s complement, subtract 1000011 - 1010100

M = 1000011

N = 1010100, 1’s complement of N = 0101011

1000011

0101011

1101110

34

Example

Answer: -0010001

Page 35: CS121 : Digital Design

1.6 Signed Binary Numbers

Page 36: CS121 : Digital Design

1.6 Signed Binary Numbers

1 - Sign and Magnitude representation

2 - 1’s Complement Representation

3 - 2’s Complement Representation

1 - The previous representation are the same for positive numbers and different for negative numbers

2 - For a signed binary number the most significant bit is used for representing the sign of the number

We use 0 for positive numbers and 1 for negative numbers

Notes

Example : represent +76

10 2

10 2

10 2

76 1001100 &

76 1001100 1'

0

76 1

0

0 001100 2 '

Sign Magnitude

s Complement

s Complement

Page 37: CS121 : Digital Design

Representing negative numbers in the previous three systems

1’s Complement of a negative number can be obtained by flipping all bits of the positive binary number

2’s Complement of a negative number can be obtained by adding 1 to the 1’s Complement or by flipping bits of the positive binary number after the first one from the right

Example : represent -76

10 2

10 2

10 2

76 1001100 &

76 0110011 1'

1

76 0

1

1 110100 2 '

Sign Magnitude

s Complement

s Complement

Page 38: CS121 : Digital Design

Arithmetic Addition with Comparison

The addition of two numbers in the signed mgnitude system follow the rules of ordinary arithmetic.

If the signed are the same, we add the two magnitudes and give the sum the common sign.

If the signed are different, we subtract the smaller magnitudefrom the larger and give the difference the sign of the largermagnitude. EX. (+25) + (-38) = -(38 - 25) = -13

Arithmetic Addition

Page 39: CS121 : Digital Design

Arithmetic Addition without Comparison

The addition of two signed binary number with negative numbers represented in signed 2’s complement form is obtained from the addition of the two numbers, including their signed bits. A carry out of the signed bit position is discarded (note that the 4th case).

Page 40: CS121 : Digital Design

Arithmetic Addition without Comparison

19 1110110113 1111001106 11111010

07 1111100113 1111001106 00000110

07 00000111

13 0000110106 11111010

19 00010011

13 0000110106 00000110

40

Page 41: CS121 : Digital Design

Arithmetic Subtraction

(+/-) A – (+B)= (+/-) A + (-B) (+/-) A – (-B)= (+/-) A + (+B)

Example (-6) – (-13)= +7In binary: (1111010 – 11110011)= (1111010 +

00001101) =100000111 after removing the carry out the result will be : 00000111

Page 42: CS121 : Digital Design

1.7 Binary Codes

Page 43: CS121 : Digital Design

Binary Coded Decimal (BCD)

Page 44: CS121 : Digital Design

Binary Coded Decimal (BCD)

in this system each digit is represented in 4 bits

For example : to represent in BCD

9 54

1001

10945

0100 0101

10 BCD10010100010 9 5 14

Page 45: CS121 : Digital Design

BCD Addition

Example : Evaluate the following operations in BCD System

1 – 3 + 4

2 – 4 + 8

3 - 148 + 576

3

4

7

01000111

0011BCD BCD Decimal

Page 46: CS121 : Digital Design

BCD Addition

Example : Evaluate the following operations in BCD System

1 – 3 + 4

2 – 4 + 8

3 - 148 + 5764

8

12

10001100

0100BCD BCD

Decimal

Error

01100001001012

We must add 6 (0110) to the result

Page 47: CS121 : Digital Design

BCD

BCD Addition

Example : Evaluate the following operations in BCD System

1 – 3 + 4

2 – 4 + 8

3 - 184 + 576

1846 57

1

0001BCD 1000 0100

0101 0111 0110

Decimal

0111 0000 1010

0110 0110

0111 0110 00001 1

1

760 1

760

Page 48: CS121 : Digital Design

1 – In BCD Addition , we add (0110)=(6) if the result value was greater than (1001)=(9) or if the result was more than 4 digits

Notes

In previous Example we added 0110 when the result was

1 - greater than 9 (1001)

2 - more than 4 digits (10000)

Note : result more than 4 digit is greater than 9(1001)

Page 49: CS121 : Digital Design

Decimal ArithmeticAddition for signed numbers

Example: (+375) + (- 240) = + 135 in BCD

Apply 10‘s complement to the negative number only. Addition is done by summing all digits,including the

sign digit,and discarding the end carry 0 375 +9 760 ------------ 0 135

Page 50: CS121 : Digital Design

Decimal Arithmetic

Subtraction for signed and unsigned numbers

Apply 10‘s complement to the subtrahend and apply addition (same as binary case)

Page 51: CS121 : Digital Design

(ex-3) is like (BCD) in the way of representing number

i.e. each digit is represented in 4 bits

Except that : each digit is firstly incremented by three

Excess-3 (ex-3)Excess-three (ex-3)is another system to represent a number

For example : to represent in ex-3

12 87

1100

10945

0111 1000

10 311000111100 94 05

ex

9 54

Page 52: CS121 : Digital Design
Page 53: CS121 : Digital Design

Gray Code

Page 54: CS121 : Digital Design

ASCII code is used to represent characters , Symbols , …

ASCII code consists of 7-bits (to represent 128 character)

ASCII character code

ASCII : American Standard Code for Information Interchange

Upper case Letters are represented by ASCII (65 : 90)

Lower case Letters are represented by ASCII (97 : 122)

# ASCII Ch

65 1000001 A

66 1000010 B

90 1011010 Z

97 1100001 a

98 1100010 b

122 1111001 z

Page 55: CS121 : Digital Design
Page 56: CS121 : Digital Design

Error Detecting Code

with even parity with odd parityASCII A 1000001 01000001 11000001ASCII T 1010100 11010100 01010100

Page 57: CS121 : Digital Design
Page 58: CS121 : Digital Design

For more information about Number Systems and Conversations between them

Check these

1 – Our Logic Book

2 - Computer Organization's Lectures

3 – Any other References