Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: 2 / 45 Digital Systems  Discrete Data ●Examples: ♦ 26 letters of the alphabet (A, B … etc) ♦ 10 decimal digits (0, 1, 2 … etc) ●Combine.

Similar presentations


Presentation on theme: "Chapter 1: 2 / 45 Digital Systems  Discrete Data ●Examples: ♦ 26 letters of the alphabet (A, B … etc) ♦ 10 decimal digits (0, 1, 2 … etc) ●Combine."— Presentation transcript:

1

2

3 Chapter 1:

4 2 / 45 Digital Systems  Discrete Data ●Examples: ♦ 26 letters of the alphabet (A, B … etc) ♦ 10 decimal digits (0, 1, 2 … etc) ●Combine together ♦ Words are made of letters (University … etc) ♦ Numbers are made of digits (4241 … etc)  Binary System ●Only ‘0’ and ‘1’ digits ●Can be easily implemented in electronic circuits AnalogDiscrete

5 3 / 45 Decimal Number System  Base (also called radix) = 10 ●10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }  Digit Position ●Integer & fraction  Digit Weight ●Weight = (Base) Position  Magnitude ●Sum of “Digit x Weight”  Formal Notation d 2 *B 2 +d 1 *B 1 +d 0 *B 0 +d -1 *B -1 +d -2 *B -2 (512.74) 10

6 4 / 45 Octal Number System  Base = 8 ●8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }  Weights ●Weight = (Base) Position  Magnitude ●Sum of “Digit x Weight”  Formal Notation /8641/ * * * * *8 - 2 =( ) 10 (512.74) 8

7 5 / 45 Binary Number System  Base = 2 ●2 digits { 0, 1 }, called b inary dig its or “bits”  Weights ●Weight = (Base) Position  Magnitude ●Sum of “Bit x Weight”  Formal Notation  Groups of bits 4 bits = Nibble 8 bits = Byte /241/ * * * * *2 - 2 =(5.25) 10 (101.01)

8 6 / 45 Hexadecimal Number System  Base = 16 ●16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }  Weights ●Weight = (Base) Position  Magnitude ●Sum of “Digit x Weight”  Formal Notation / /256 1E57A 1 * * * * *16 -2 =( ) 10 (1E5.7A) 16

9 7 / 45 The Power of 2 n2n2n 02 0 = = = = = = = =128 n2n2n 82 8 = = = = = =1M =1G =1T Mega Giga Tera Kilo

10 8 / 45 Addition  Decimal Addition = Ten ≥ Base  Subtract a Base 11Carry

11 9 / 45 Binary Addition  Column Addition ≥ (2) = 61 = 23 = 84

12 10 / 45 Binary Subtraction  Borrow a “Base” when needed − = (10) = 77 = 23 = 54

13 11 / 45 Binary Multiplication  Bit by bit x

14 12 / 45 Number Base Conversions Decimal (Base 10) Octal (Base 8) Binary (Base 2) Hexadecimal (Base 16) Evaluate Magnitude

15 13 / 45 Decimal (Integer) to Binary Conversion DD ivide the number by the ‘Base’ (=2) TT ake the remainder (either 0 or 1) as a coefficient TT ake the quotient and repeat the division Example: ( 13 ) 10 QuotientRemainder Coefficient Answer: (13) 10 = (a 3 a 2 a 1 a 0 ) 2 = (1101) 2 MSB LSB 13 / 2 = 61 a 0 = 1 6 / 2 = 30 a 1 = 0 3 / 2 = 11 a 2 = 1 1 / 2 = 01 a 3 = 1

16 14 / 45 Decimal (Fraction) to Binary Conversion MM ultiply the number by the ‘Base’ (=2) TT ake the integer (either 0 or 1) as a coefficient TT ake the resultant fraction and repeat the division Example: ( ) 10 IntegerFraction Coefficient Answer: (0.625) 10 = (0.a -1 a -2 a -3 ) 2 = (0.101) 2 MSB LSB * 2 = * 2 = 0. 5 a -2 = * 2 = 1. 0 a -3 = 1 a -1 = 1

17 15 / 45 Decimal to Octal Conversion Example: ( 175 ) 10 QuotientRemainder Coefficient Answer: (175) 10 = (a 2 a 1 a 0 ) 8 = (257) / 8 = 217 a 0 = 7 21 / 8 = 25 a 1 = 5 2 / 8 = 02 a 2 = 2 Example: ( ) 10 IntegerFraction Coefficient Answer: (0.3125) 10 = (0.a -1 a -2 a -3 ) 8 = (0.24) * 8 = * 8 = 4. 0 a -2 = 4 a -1 = 2

18 16 / 45 Binary − Octal Conversion  8 = 2 3  Each group of 3 bits represents an octal digit OctalBinary Example: ( ) 2 ( ) 8 Assume Zeros Works both ways (Binary to Octal & Octal to Binary)

19 17 / 45 Binary − Hexadecimal Conversion  16 = 2 4  Each group of 4 bits represents a hexadecimal digit HexBinary A1 0 B C D E F1 1 Example: ( ) 2 ( ) 16 Assume Zeros Works both ways (Binary to Hex & Hex to Binary)

20 18 / 45 Octal − Hexadecimal Conversion  Convert to Binary as an intermediate step Example: ( ) 2 ( ) 16 Assume Zeros Works both ways (Octal to Hex & Hex to Octal) ( ) 8 Assume Zeros

21 19 / 45 Decimal, Binary, Octal and Hexadecimal DecimalBinaryOctalHex A B C D E F

22 20 / 45 Complements 11 ’s Complement (Diminished Radix Complement) ●A●All ‘0’s become ‘1’s ●A●All ‘1’s become ‘0’s Example ( ) 2  ( ) 2 If you add a number and its 1’s complement …

23 21 / 45 Complements 22 ’s Complement (Radix Complement) ●T●Take 1’s complement then add 1 ●T●Toggle all bits to the left of the first ‘1’ from the right Example: Number: 1’s Comp.: OR

24 22 / 45 Negative Numbers CC omputers Represent Information in ‘0’s and ‘1’s ●‘●‘+’ and ‘−’ signs have to be represented in ‘0’s and ‘1’s 33 Systems ●S●Signed Magnitude ●1●1’s Complement ●2●2’s Complement All three use the left-most bit to represent the sign: ♦‘♦‘ 0’  positive ♦‘♦‘ 1’  negative

25 23 / 45 Signed Magnitude Representation MM agnitude is magnitude, does not change with sign (+3) 10  ( ) 2 (−3) 10  ( ) 2 CC an’t include the sign bit in ‘Addition’  (+3)  (−3)  (−6) 10 SignMagnitude SMagnitude (Binary)

26 24 / 45 1’s Complement Representation PP ositive numbers are represented in “Binary” NN egative numbers are represented in “1’s Comp.” (+3) 10  (0 011) 2 (−3) 10  (1 100) 2 TT here are 2 representations for ‘0’ (+0) 10  (0 000) 2 (−0) 10  (1 111) 2 0Magnitude (Binary) 1Code (1’s Comp.)

27 25 / 45 1’s Complement Range  4-Bit Representation 2 4 = 16 Combinations − 7 ≤ Number ≤ + 7 − ≤ Number ≤ +2 3 − 1  n-Bit Representation −2 n−1 +1 ≤ Number ≤ +2 n−1 − 1 Decimal1’s Comp − 01 1 − − − − − 51 0 − −

28 26 / 45 2’s Complement Representation PP ositive numbers are represented in “Binary” NN egative numbers are represented in “2’s Comp.” (+3) 10  (0 011) 2 (−3) 10  (1 101) 2 TT here is 1 representation for ‘0’ (+0) 10  (0 000) 2 (−0) 10  (0 000) 2 0Magnitude (Binary) 1Code (2’s Comp.) 1’s Comp

29 27 / 45 2’s Complement Range  4-Bit Representation 2 4 = 16 Combinations − 8 ≤ Number ≤ + 7 −2 3 ≤ Number ≤ − 1  n-Bit Representation −2 n−1 ≤ Number ≤ + 2 n−1 − 1 Decimal2’s Comp − 11 1 − − − − − 61 0 − −

30 28 / 45 Number Representations  4-Bit Example Unsigned Binary Signed Magnitude 1’s Comp.2’s Comp. Range0 ≤ N ≤ 15-7 ≤ N ≤ ≤ N ≤ +7 Positive Binary Negative X Binary1’s Comp.2’s Comp

31 29 / 45 Binary Subtraction Using 1’s Comp. Addition CC hange “Subtraction” to “Addition” II f “Carry” = 1 then add it to the LSB, and the result is positive (in Binary) II f “Carry” = 0 then the result is negative (in 1’s Comp.) (5) 10 – (1) 10 (+5) 10 + (-1) (5) 10 – (6) 10 (+5) 10 + (-6) − 1 1

32 30 / 45 Binary Subtraction Using 2’s Comp. Addition CC hange “Subtraction” to “Addition” II f “Carry” = 1 ignore it, and the result is positive (in Binary) II f “Carry” = 0 then the result is negative (in 2’s Comp.) (5) 10 – (1) 10 (+5) 10 + (-1) (5) 10 – (6) 10 (+5) 10 + (-6) − 1

33 31 / 45 Binary Codes GG roup of n bits ●U●Up to 2 n combinations ●E●Each combination represents an element of information BB inary Coded Decimal (BCD) ●E●Each Decimal Digit is represented by 4 bits ●(●(0 – 9)  Valid combinations ●(●(10 – 15)  Invalid combinations DecimalBCD

34 32 / 45 BCD Addition OO ne decimal digit + one decimal digit ●I●If the result is 1 decimal digit ( ≤ 9 ), then it is a simple binary addition Example: ●I●If the result is two decimal digits ( ≥ 10 ), then binary addition gives invalid combinations Example:

35 33 / 45 BCD Addition II f the binary result is greater than 9, correct the result by adding Two Decimal Digits Multiple Decimal Digits

36 34 / 45 Gray Code OO ne bit changes from one code to the next code DD ifferent than Binary DecimalGray Binary

37 35 / 45 ASCII Code American Standard Code for Information Interchange Info7-bit Code A B Z a b ?

38 36 / 45 Error Detecting Codes PP arity One bit added to a group of bits to make the total number of ‘1’s (including the parity bit) even or odd ●E●Even ●O●Odd GG ood for checking single-bit errors bit Example 7-bit Example

39 37 / 45 Binary Logic  Operators ●NOT If ‘x’ = 0thenNOT ‘x’ = 1 If ‘x’ = 1thenNOT ‘x’ = 0 ●AND If ‘x’ = 1 AND ‘y’ = 1then‘z’ = 1 Otherwise‘z’ = 0 ●OR If ‘x’ = 1 OR ‘y’ = 1then‘z’ = 1 Otherwise‘z’ = 0

40 38 / 45 Binary Logic  Truth Tables, Boolean Expressions, and Logic Gates xyz xyz xz ANDORNOT z = x y = x yz = x + yz = x = x’

41 39 / 45 Logic Signals BB inary ‘0’ is represented by a “low” voltage (range of voltages) BB inary ‘1’ is represented by a “high” voltage (range of voltages) TT he “voltage ranges” guard against noise of binary signalsExample

42 40 / 45 Switching Circuits ANDOR

43 41 / 45 Homework  Mano ●Chapter 1 ♦ 1-2 ♦ 1-7 ♦ 1-9 ♦ 1-10 ♦ 1-11 ♦ 1-16 ♦ 1-18 ♦ 1-20 ♦ 1-24(a) ♦ 1-29  Write your family name in ASCII with odd parity  Decode the following ASCII string (with MSB = parity): Is the parity even or odd?

44 42 / 45 Homework  Mano 1-2What is the exact number of bytes in a system that contains (a) 32K byte, (b) 64M byte, and (c) 6.4G byte? 1-7Express the following numbers in decimal: ( ) 2, (16.5) 16, and (26.24) Convert the hexadecimal number 68BE to binary and then from binary convert it to octal. 1-10Convert the decimal number 345 to binary in two ways: (a) convert directly to binary, (b) convert first to hexadecimal, then from hexadecimal to binary. Which method is faster?

45 43 / 45 Homework 1-11Do the following conversion problems: (a) Convert decimal to binary. (b) Calculate the binary equivalent of 1/3 out to 8 places. Then convert from binary to decimal. How close is the result to 1/3? (c) Convert the binary result in (b) into hexadecimal. Then convert the result to decimal. Is the answer the same? 1-16Obtain the 1’s and 2’s complements of the following binary numbers: (a) (b) (c) (d) (e)

46 44 / 45 Homework 1-18Perform subtraction on the following unsigned binary numbers using the 2’s-complement of the subtrahend. Where the result should be negative, 2’s complement it and affix a minus sign. (a) – (b) – (c) 1011 – (d) – Convert decimal +61 and +27 to binary using the signed- 2’s complement representation and enough digits to accommodate the numbers. Then perform the binary equivalent of (+27) + (– 61), (–27) + (+61) and (–27) + (–61). Convert the answers back to decimal and verify that they are correct.

47 45 / 45 Homework 1-24Represent decimal number 6027 in (a) BCD 1-29The following is a string of ASCII characters whose bit patterns have been converted into hexadecimal for compactness: 4A EF 68 6E 20 C4 EF E5. Of the 8 bits in each pair digit, the leftmost is a parity bit. The remaining bits are the ASCII code. (a) Convert to bit form and decode the ASCII (b) Determine the parity used: odd or even.


Download ppt "Chapter 1: 2 / 45 Digital Systems  Discrete Data ●Examples: ♦ 26 letters of the alphabet (A, B … etc) ♦ 10 decimal digits (0, 1, 2 … etc) ●Combine."

Similar presentations


Ads by Google