Download presentation

Presentation is loading. Please wait.

Published byDean Lisk Modified over 2 years ago

2
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh

3
Princess Sumaya Univ. Computer Engineering Dept. Chapter 1:

4
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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 102-2 51274 1010.11000.01 5001020.70.04 d 2 *B 2 +d 1 *B 1 +d 0 *B 0 +d -1 *B -1 +d -2 *B -2 (512.74) 10

6
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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 102-2 811/8641/64 51274 5 *8 2 +1 *8 1 +2 *8 0 +7 *8 -1 +4 *8 - 2 =(330.9375) 10 (512.74) 8

7
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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 102-2 211/241/4 10101 1 *2 2 +0 *2 1 +1 *2 0 +0 *2 -1 +1 *2 - 2 =(5.25) 10 (101.01) 2 1 0 1 1 1 1 0 0 0 1 0 1

8
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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 102-2 161 1/16 256 1/256 1E57A 1 *16 2 +14 *16 1 +5 *16 0 +7 *16 -1 +10 *16 -2 =(485.4765625) 10 (1E5.7A) 16

9
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 7 / 45 The Power of 2 n2n2n 02 0 =1 12 1 =2 22 2 =4 32 3 =8 42 4 =16 52 5 =32 62 6 =64 72 7 =128 n2n2n 82 8 =256 92 9 =512 102 10 =1024 112 11 =2048 122 12 =4096 202 20 =1M 302 30 =1G 402 40 =1T Mega Giga Tera Kilo

10
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 8 / 45 Addition Decimal Addition 55 55 + 011 = Ten ≥ Base Subtract a Base 11Carry

11
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 9 / 45 Binary Addition Column Addition 101111 11110 + 0000111 ≥ (2) 10 111111 = 61 = 23 = 84

12
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 10 / 45 Binary Subtraction Borrow a “Base” when needed 001110 11110 − 0101110 = (10) 2 2 2 2 2 1 000 1 = 77 = 23 = 54

13
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 11 / 45 Binary Multiplication Bit by bit 01111 0110 00000 01111 01111 0 0000 01101110 x

14
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 12 / 45 Number Base Conversions Decimal (Base 10) Octal (Base 8) Binary (Base 2) Hexadecimal (Base 16) Evaluate Magnitude

15
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 13 / 45 Decimal (Integer) to Binary Conversion DD ivide the number by the ‘Base’ (=2) TT ake the remainder (either 0 or 1) as a coefficient TT 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
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 14 / 45 Decimal (Fraction) to Binary Conversion MM ultiply the number by the ‘Base’ (=2) TT ake the integer (either 0 or 1) as a coefficient TT ake the resultant fraction and repeat the division Example: ( 0.625 ) 10 IntegerFraction Coefficient Answer: (0.625) 10 = (0.a -1 a -2 a -3 ) 2 = (0.101) 2 MSB LSB 0.625 * 2 = 1. 25 0.25 * 2 = 0. 5 a -2 = 0 0.5 * 2 = 1. 0 a -3 = 1 a -1 = 1

17
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 15 / 45 Decimal to Octal Conversion Example: ( 175 ) 10 QuotientRemainder Coefficient Answer: (175) 10 = (a 2 a 1 a 0 ) 8 = (257) 8 175 / 8 = 217 a 0 = 7 21 / 8 = 25 a 1 = 5 2 / 8 = 02 a 2 = 2 Example: ( 0.3125 ) 10 IntegerFraction Coefficient Answer: (0.3125) 10 = (0.a -1 a -2 a -3 ) 8 = (0.24) 8 0.3125 * 8 = 2. 5 0.5 * 8 = 4. 0 a -2 = 4 a -1 = 2

18
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 16 / 45 Binary − Octal Conversion 8 = 2 3 Each group of 3 bits represents an octal digit OctalBinary 00 0 0 10 0 1 20 1 0 30 1 1 41 0 0 51 0 1 61 1 0 71 1 1 Example: ( 1 0 1 1 0. 0 1 ) 2 ( 2 6. 2 ) 8 Assume Zeros Works both ways (Binary to Octal & Octal to Binary)

19
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 17 / 45 Binary − Hexadecimal Conversion 16 = 2 4 Each group of 4 bits represents a hexadecimal digit HexBinary 00 0 10 0 0 1 20 0 1 0 30 0 1 1 40 1 0 0 50 1 60 1 1 0 70 1 1 1 81 0 0 0 91 0 0 1 A1 0 B1 0 1 1 C1 1 0 0 D1 1 0 1 E1 1 1 0 F1 1 Example: ( 1 0 1 1 0. 0 1 ) 2 ( 1 6. 4 ) 16 Assume Zeros Works both ways (Binary to Hex & Hex to Binary)

20
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 18 / 45 Octal − Hexadecimal Conversion Convert to Binary as an intermediate step Example: ( 0 1 0 1 1 0. 0 1 0 ) 2 ( 1 6. 4 ) 16 Assume Zeros Works both ways (Octal to Hex & Hex to Octal) ( 2 6. 2 ) 8 Assume Zeros

21
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 19 / 45 Decimal, Binary, Octal and Hexadecimal DecimalBinaryOctalHex 000000000 010001011 020010022 030011033 040100044 050101055 060110066 070111077 081000108 091001119 10101012A 11101113B 12110014C 13110115D 14111016E 15111117F

22
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 20 / 45 Complements 11 ’s Complement (Diminished Radix Complement) ●A●All ‘0’s become ‘1’s ●A●All ‘1’s become ‘0’s Example (10110000) 2 (01001111) 2 If you add a number and its 1’s complement … 1 0 1 1 0 0 0 0 + 0 1 0 0 1 1 1 1 1 1 1 1

23
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 21 / 45 Complements 22 ’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.: 0 1 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 1 1 1 + 1 OR 1 0 1 1 0 0 0 0 00001010

24
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 22 / 45 Negative Numbers CC omputers Represent Information in ‘0’s and ‘1’s ●‘●‘+’ and ‘−’ signs have to be represented in ‘0’s and ‘1’s 33 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
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 23 / 45 Signed Magnitude Representation MM agnitude is magnitude, does not change with sign (+3) 10 ( 0 0 1 1 ) 2 (−3) 10 ( 1 0 1 1 ) 2 CC an’t include the sign bit in ‘Addition’ 0 0 1 1 (+3) 10 + 1 0 1 1 (−3) 10 1 1 1 0 (−6) 10 SignMagnitude SMagnitude (Binary)

26
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 24 / 45 1’s Complement Representation PP ositive numbers are represented in “Binary” NN egative numbers are represented in “1’s Comp.” (+3) 10 (0 011) 2 (−3) 10 (1 100) 2 TT here are 2 representations for ‘0’ (+0) 10 (0 000) 2 (−0) 10 (1 111) 2 0Magnitude (Binary) 1Code (1’s Comp.)

27
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 25 / 45 1’s Complement Range 4-Bit Representation 2 4 = 16 Combinations − 7 ≤ Number ≤ + 7 −2 3 +1 ≤ Number ≤ +2 3 − 1 n-Bit Representation −2 n−1 +1 ≤ Number ≤ +2 n−1 − 1 Decimal1’s Comp. + 70 1 1 1 + 60 1 1 0 + 50 1 + 40 1 0 0 + 30 0 1 1 + 20 0 1 0 + 10 0 0 1 + 00 0 − 01 1 − 11 1 1 0 − 21 1 0 1 − 31 1 0 0 − 41 0 1 1 − 51 0 − 61 0 0 1 − 71 0 0 0

28
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 26 / 45 2’s Complement Representation PP ositive numbers are represented in “Binary” NN egative numbers are represented in “2’s Comp.” (+3) 10 (0 011) 2 (−3) 10 (1 101) 2 TT 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. 1 1 1 1 + 1 1 0 0 0 0

29
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 27 / 45 2’s Complement Range 4-Bit Representation 2 4 = 16 Combinations − 8 ≤ Number ≤ + 7 −2 3 ≤ Number ≤ + 2 3 − 1 n-Bit Representation −2 n−1 ≤ Number ≤ + 2 n−1 − 1 Decimal2’s Comp. + 70 1 1 1 + 60 1 1 0 + 50 1 + 40 1 0 0 + 30 0 1 1 + 20 0 1 0 + 10 0 0 1 + 00 0 − 11 1 − 21 1 1 0 − 31 1 0 1 − 41 1 0 0 − 51 0 1 1 − 61 0 − 71 0 0 1 − 81 0 0 0

30
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 28 / 45 Number Representations 4-Bit Example Unsigned Binary Signed Magnitude 1’s Comp.2’s Comp. Range0 ≤ N ≤ 15-7 ≤ N ≤ +7 -8 ≤ N ≤ +7 Positive Binary Negative X Binary1’s Comp.2’s Comp. 000111

31
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 29 / 45 Binary Subtraction Using 1’s Comp. Addition CC hange “Subtraction” to “Addition” II f “Carry” = 1 then add it to the LSB, and the result is positive (in Binary) II f “Carry” = 0 then the result is negative (in 1’s Comp.) 0 1 + 1 1 1 0 (5) 10 – (1) 10 (+5) 10 + (-1) 10 0 0 1 1 + 0 1 0 0 0 1 + 1 0 0 1 (5) 10 – (6) 10 (+5) 10 + (-6) 10 0 1 1 1 0 1 1 1 0 + 4− 1 1

32
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 30 / 45 Binary Subtraction Using 2’s Comp. Addition CC hange “Subtraction” to “Addition” II f “Carry” = 1 ignore it, and the result is positive (in Binary) II f “Carry” = 0 then the result is negative (in 2’s Comp.) 0 1 + 1 1 1 1 (5) 10 – (1) 10 (+5) 10 + (-1) 10 1 0 1 0 0 0 1 + 1 0 1 0 (5) 10 – (6) 10 (+5) 10 + (-6) 10 0 1 1 1 1 + 4 − 1

33
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 31 / 45 Binary Codes GG roup of n bits ●U●Up to 2 n combinations ●E●Each combination represents an element of information BB inary Coded Decimal (BCD) ●E●Each Decimal Digit is represented by 4 bits ●(●(0 – 9) Valid combinations ●(●(10 – 15) Invalid combinations DecimalBCD 00 0 10 0 0 1 20 0 1 0 30 0 1 1 40 1 0 0 50 1 60 1 1 0 70 1 1 1 81 0 0 0 91 0 0 1

34
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 32 / 45 BCD Addition OO 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: 5 + 3 8 0 1 + 0 0 1 1 1 0 0 0 5 + 5 1 0 0 1 + 0 1 0 1 1 0 0 0 0 1 0 0 0 0

35
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 33 / 45 BCD Addition II f the binary result is greater than 9, correct the result by adding 6 5 + 5 1 0 0 1 + 0 1 0 1 1 0 + 0 1 1 0 0 0 0 1 0 0 0 0 Two Decimal Digits Multiple Decimal Digits 3 5 1 0 0 1 10 1 0 0 0 1

36
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 34 / 45 Gray Code OO ne bit changes from one code to the next code DD ifferent than Binary DecimalGray 000000 010001 020011 030010 040110 050111 060101 070100 081100 091101 101111 111110 121010 131011 141001 151000 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

37
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 35 / 45 ASCII Code American Standard Code for Information Interchange Info7-bit Code A1000001 B1000010............ Z1011010 a1100001 b1100010............ z1111010 @1000000 ?0111111 +0101011

38
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 36 / 45 Error Detecting Codes PP 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 GG ood for checking single-bit errors 1 0111 1000001 0 0 01111000001 1 4-bit Example 7-bit Example

39
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 38 / 45 Binary Logic Truth Tables, Boolean Expressions, and Logic Gates xyz 000 010 100 111 xyz 000 011 101 111 xz 01 10 ANDORNOT z = x y = x yz = x + yz = x = x’

41
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 39 / 45 Logic Signals BB inary ‘0’ is represented by a “low” voltage (range of voltages) BB inary ‘1’ is represented by a “high” voltage (range of voltages) TT he “voltage ranges” guard against noise of binary signalsExample

42
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 40 / 45 Switching Circuits ANDOR

43
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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): 11000011 01101111 11101101 11110000 11000000 01010000 01010011 01010101 11010100 Is the parity even or odd?

44
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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: (10110.0101) 2, (16.5) 16, and (26.24) 8. 1-9Convert 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
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 43 / 45 Homework 1-11Do the following conversion problems: (a) Convert decimal 34.4375 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) 11101010 (b) 01111110 (c) 00000001 (d) 10000000 (e) 00000000

46
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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) 11011 – 11001 (b) 110100 – 10101 (c) 1011 – 110000 (d) 101010 – 101011 1-20Convert 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
Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 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.

Similar presentations

Presentation is loading. Please wait....

OK

Logic and Digital System Design - CS 303

Logic and Digital System Design - CS 303

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on world technology day Ppt on pin diode characteristic curve Download ppt on electricity Ppt on gsm based home automation system Ppt on arunachal pradesh cultures How to save ppt on ipad 2 Ppt on remote control robot cars Ppt on indian textile industries in pakistan Ppt on barack obama leadership Ppt on online shopping mall