+ All Categories
Home > Documents > Digital Design: From Gates to Intelligent Machines

Digital Design: From Gates to Intelligent Machines

Date post: 04-Jan-2016
Category:
Upload: vachel
View: 42 times
Download: 2 times
Share this document with a friend
Description:
Digital Design: From Gates to Intelligent Machines. Bruce F Katz Da Vinci Engineering Press. Number Systems. Numbers and Numerals A number is a quantity A numeral is a representation of a number Example (all representations of the quantity 5) - PowerPoint PPT Presentation
20
Digital Design: From Gates to Intelligent Machines Bruce F Katz Da Vinci Engineering Press
Transcript
Page 1: Digital Design: From Gates to Intelligent Machines

Digital Design:From Gates to Intelligent

Machines

Bruce F Katz

Da Vinci Engineering Press

Page 2: Digital Design: From Gates to Intelligent Machines

Number Systems

Numbers and NumeralsA number is a quantity

A numeral is a representation of a number

Example (all representations of the quantity 5)

5, V (Roman), 101 (binary), (Babylonian)

Not equivalent in ease of computation, however

Page 3: Digital Design: From Gates to Intelligent Machines

Number Systems

Positional Number SystemsA quantity is a weighted sum of powers of a base b

Compactness of representation and ease of computation

Additional characteristics

digits to the left of radix point are integral

digits to the right of the radix point are fractional

mm

mm

nn

nn

nn bababababababa

11

11

00

22

11 ......

Page 4: Digital Design: From Gates to Intelligent Machines

Number Systems

Examples of Positional Number Systemsbase 10

102410 = 1*103 + 0*102 + 2*101 + 4*100

base 8

417.238= 4*82 + 1*81 + 7*80 + 2*8-1 + 3*8-2

= 256 + 8 + 7 + 2/8 + 3/64

base 2

1010.1 = 1*23 + 1*21 + 1*2-1 = 10.510

Page 5: Digital Design: From Gates to Intelligent Machines

Number Systems

Commonly used basesdecimal

(base 10)

binary

(base 2)

octal

(base 8)

hexadecimal

(base 16)

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

00000

00001

00010

00011

00100

00101

00110

00111

01000

01001

01010

01011

01100

01101

01110

01111

10000

0

1

2

3

4

5

6

7

10

11

12

13

14

15

16

17

20

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

10

Page 6: Digital Design: From Gates to Intelligent Machines

Number Systems

Which base is best for human use?

Base 12 has the most divisors among the small numbers but we usually use base 10. Why?

0123456

# of divisors

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

base

Page 7: Digital Design: From Gates to Intelligent Machines

Number Systems

Conversion between bases (special case)Principle

If one base is an integer power of another base, can group by this integer to perform conversion.

Examples

1011112 = ?8

solution: group by 3 bits

{101}{111}2 = 578F416 = ?2

solution: each hex digit represents 4 bits

F416 = {1111}{0100}2 = 111101002

Page 8: Digital Design: From Gates to Intelligent Machines

Number Systems

Conversion to and from base 10To base 10

Use definition of a positional number

Example: 1101.1012 to base 10

1101.1012 = 1*23 + 1*22 + 0*21 + 1*21 + 1*2-1 + 0*2-2 + 1*2-3 = 13.625

From base 10Use reformulation of definition of a positional number

Successive divisions by the base will yield then digits as remaindersExample: 125 to base 3

125/3 = 41 remainder 241/3 = 13 remainder 213/3 = 4 remainder 14/3 = 1 remainder 11/3 = 0 remainder 1

therefore answer is 111223

.]...))[(( 0121 ababababa nnn

Page 9: Digital Design: From Gates to Intelligent Machines

Number Systems

Binary Number SystemsMotivation

Correspondence between 0 and 1 and logical values (true and false)Ease of constructing binary circuits

Powers of 2n 2n significance

4

8

10

16

20

30

40

16

256

1,024

65,536

1,048,576

1,073,741,824

1.099E12

one nibble (1/2 a byte)

one byte; one ASCII char

quantity abbreviated by 1K (kilo)

two bytes; one UNICODE char

quantity abbreviated by 1M (mega)

quantity abbreviated by 1G (giga)

quantity abbreviated by 1T (tera)

Page 10: Digital Design: From Gates to Intelligent Machines

Number Systems

Binary Addition and SubtractionAddition

Same as decimal addition with binary carries0 0 1 1 0 0 1 0 carry

1 0 0 1 1 1 0 1 addend10 1 0 1 1 0 0 1 addend2-----------------------1 1 1 1 0 1 1 0 sum

SubtractionSame as decimal subtraction with binary borrows0 1 0 0 0 1 1 0 borrow

1 1 0 1 1 1 0 0 minuend0 1 1 0 1 0 0 1 subtrahend-----------------------0 1 1 1 0 0 1 1 difference

Page 11: Digital Design: From Gates to Intelligent Machines

Number Systems

Binary Addition and Subtraction Tables

Important: These tables are the foundation for computer arithmetic!

addition

addend 1 addend 2 carry in sum carry out

00001111

00110011

01010101

01101001

00010111

subtraction

minuend subtrahendborrow

indifference

borrowout

00001111

00110011

01010101

01101001

01110001

Page 12: Digital Design: From Gates to Intelligent Machines

Number Systems

Binary MultiplicationEasier than decimal multiplication because always multiplying

by 0 or 1Example

0 1 1 0 * 1 0 1 1

----------0 1 1 0

0 1 1 0 0 0 0 0 0 1 1 0 ------------------- 1 0 0 0 0 1 0

Page 13: Digital Design: From Gates to Intelligent Machines

Number Systems

Representing Negative Numbers

System 1: Signed Magnitude Leftmost bit represents negative signExamples

01010111 = 8711010111 = - 87

Advantage

Simplicity

DisadvantageMathematical operations clumsy, e.g. addition:

if (signs same)then{

     add magnitudes     give result this sign

}else     /* signs different */{

     compare magnitudes     subtract smaller from larger     give result sign of the

larger}

Page 14: Digital Design: From Gates to Intelligent Machines

Number Systems

Representing Negative Numbers

System 2: 2’s complementPositive numbers identical, negative numbers 2n - positive

version, where n is the number of bits in the representation

Examples00010001 = 17100000000 - 00010001 = 11101111 = - 17

Trick for computing negative numberFlip all the bits and add 10001000111101110 after flip11101111 after adding 1

Note: Negative numbers will always begin with 1, positive with 0

Page 15: Digital Design: From Gates to Intelligent Machines

Number Systems

Representing Negative Numbers

System 2: 2’s complementAddition methodJust add! (and ignore any bits > 2n-1)

0 0 1 0 1 0 1 1 (43)

+1 1 1 0 1 1 1 1 (-17)-------------------

1 0 0 0 1 1 0 1 0

Overflow condition: If add 2 positive and get a negative or vice versaExample

1 0 0 0 1 1 1 1 (-113)

+1 1 1 0 1 1 1 1 (-17)-------------------

1 0 1 1 1 1 1 1 0 overflow!

Page 16: Digital Design: From Gates to Intelligent Machines

Number Systems

CodesA way of representing a set of quantities or a set of symbols within a given base

Example in base 2

decimal Binary BCD gray even parity

0123456789

101112131415

0000000100100011010001010110011110001001101010111100110111101111

0000 00000000 00010000 00100000 00110000 01000000 01010000 01100000 01110000 10000000 10010001 00000001 00010001 00100001 00110001 01000001 0101

0000000100110010011001110101010011001101111111101010101110011000

00000100011001000011101000010100110101111100001001010101101101100111011111001111

Page 17: Digital Design: From Gates to Intelligent Machines

Number Systems

CodesBCD

Each decimal digit is encoded by four binary digitsMotivation

ease of conversionExamples

0001 0100 141001 0111 97

Gray CodingEach successive number differs by only 1 bit from previousMotivation

counting with CMOSKarnaugh maps

Page 18: Digital Design: From Gates to Intelligent Machines

Number Systems Codes

ParityAn extra bit is added to make the string always even or oddMotivation

error checking

ASCII

b6b5b4

b3b2b1b0 000 001 010 011 100 101 110 111

0000000100100011010001010110011110001001101010111100110111101111

NULSOHSTXETXEOTENQACKBELBSHTLFVTFFCRSOSI

DLEDC1DC2DC3DC4NAKSYNETBCANEMSUBESCFSGSRSUS

SP!“#$%&‘()*+,-./

0123456789:;<=>?

@ABCDEFGHIJKLMNO

PQRSTUVWXYZ[\]^_

`abcdefghijklmno

pqrstuvwxyz{|}~DEL

Page 19: Digital Design: From Gates to Intelligent Machines

Number Systems

CodesUnicode

4 hex digits encode 216 charactersExample

Page 20: Digital Design: From Gates to Intelligent Machines

Number Systems

Summary of topicsNumbers and numerals

Positional number systemsConversion between basesBinary number systemsBinary addition, subtraction, and multiplicationRepresentation of negative numbersCodes


Recommended