Presentation is loading. Please wait.

Presentation is loading. Please wait.

0907231 Digital Logic Dr. Walid Abu-Sufah Read Chapter 1: Sections 1-7 Based on notes by A. Lastra and slides provided by the text publisher.

Similar presentations


Presentation on theme: "0907231 Digital Logic Dr. Walid Abu-Sufah Read Chapter 1: Sections 1-7 Based on notes by A. Lastra and slides provided by the text publisher."— Presentation transcript:

1 0907231 Digital Logic Dr. Walid Abu-Sufah Read Chapter 1: Sections 1-7 Based on notes by A. Lastra and slides provided by the text publisher

2 Instructor (Section 3) Instructor: Dr. Walid Abu-Sufah Email: abusufah@ju.edu.jo Office: CPE 417 Office Hours: Sunday, Tuesday, Wednesday 1-2 Course web site: http://www2.ju.edu.jo/sites/academic/abusufah /material/cpe231_spr13/index.html CPE 432 Computer Design 2

3 3 Prerequisite 1900100 Computer Skills

4 4 Textbook Logic and Computer Design Fundamentals, M. Morris Mano and Charles R. Kime (latest edition). Prentice Hall.

5 5 Grading Policy 4 Quizzes 16% 4 Homeworks4% Mid-term Exam30% ♦ Saturday, March 30; 2-3:15 Final Exam50% ♦ Monday, May 20; 2-4 PM Visit course website for updates on dates of exams, quizzes, and homeworks

6 6 Policies: The Course Web Site Class announcements, such as homework/quizzes dates and changes in assignments, will be posted on the Web. You are therefore responsible for checking the course web site. If you make an error because you did not check the Web, I will hold you fully responsible.

7 7 Policies: Homework and Quizzes Four homeworks Due at the beginning of the first lecture in the weeks indicated in the course calendar on the website. No late homework will be accepted. One quiz will be given at the beginning of the same lecture when each of the four homeworks is collected. For each student, the lowest of the 4 grades of quizzes will be dropped. As a result, there will be no make-up quizzes for any reason.

8 8 Policies: Makeup Midterm  There will be no make-up for the midterm. In case of medical/ or other DISABLING emergencies, the instructor should be notified BEFORE the midterm and his approval for missing the midterm should be obtained before the midterm. If for any reason the instructor could not be reached, the department secretary should be notified before the midterm. The phone number is 535- 5000 Extension 23000.

9 9 Policies: Grading Corrections  Ask the instructor for any grading correction requests within a week of returning the exam/quiz papers. After that, your grade will not be adjusted. If you find any mistake in grading, please let the instructor know. Your grade will not be lowered.

10 10 Policies: Class Attendance  Class attendance will be taken. University regulations regarding attendance will be strictly enforced. If you miss class, you must obtain the covered material from a willing classmate and/or the course web site. The instructor will not be available (during office hours or other times) to repeat material covered.

11 11 Policies: Academic Honesty Your work in this class must be your own. Penalties for excessive collaboration and cheating are severe. Sharing homework answers is forbidden

12 12 Today’s Topics Material from Chapter 1 ♦ What is digital logic? ♦ Binary signaling ♦ Number systems ♦ Codes

13 13 What’s Course About? Digital logic focusing on the design of computers Stay above transistor level High-level Hardware Description Language, HDL ♦ Allows Staying above logic gate levellogic gate ♦ Will be covered in the lab course

14 14 Schematic Diagram

15 15 Discrete Data Some data inherently discrete ♦ Names (sets of letters) Some quantized ♦ Music recorded from microphone ♦ Note that other examples like music from CD or electronic keyboard already quantized

16 Chapter 1 16 I NFORMATION R EPRESENTATION - Signals  Information variables represented by physical quantities.  For digital systems, the variables take on discrete values.  Two level, or binary values are used in digital systems  Binary values are represented by: digits 0 and 1 words (symbols) False (F) and True (T) words (symbols) Low (L) and High (H) and words On and Off.

17 17 Signal Example – Physical Quantity: Voltage Threshold Region

18 18 Signal Examples Over Time Analog Asynchronous Synchronous Time Continuous in value & time Discrete in value & continuous in time Discrete in value & time Digital

19 19 Numbers and Arithmetic Review of binary numbers, Hexadecimal numbers, Arithmetic

20 20 Binary Numbers Strings of binary digits (“bits”) ♦ One bit can store a number from the set (0, 1) ♦ n bits can store numbers from 0 to 2 n -1

21 21 Binary – Powers of 2 Positional representation Each digit represents a power of 2 So 101 binary is 1 2 2 + 0 2 1 + 1 2 0 or 1 4 + 0 2 + 1 1 = 5

22 22 Converting Binary to Decimal Easy, just multiply digit by power of 2 Just like a decimal number is represented Example follows

23 23 Binary  Decimal Example 76543210 2727 2626 2525 2424 23232 2121 2020 1286432168421 10011100 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156 What is 10011100 in decimal?

24 24 Decimal to Binary A little more work than binary to decimal Some examples ♦ 3 = 2 + 1 = 11 (that’s 12 1 + 12 0 ) ♦ 5 = 4 + 1 = 101 (that’s 12 2 + 02 1 + 12 0 )

25 25 Algorithm – Decimal to Binary 1.Find largest power-of-two smaller than decimal number 2.Make the appropriate binary digit a ‘1’ 3.Subtract the “power of 2” from decimal 4.Do the same thing again

26 26 Decimal  Binary Example Convert 28 decimal to binary 32 is too large, so use 16 Binary  10000Decimal  28 – 16 = 12 Binary  11000Decimal  12 – 8 = 4 Next is 8 Binary  11100Decimal  4 – 4 = 0 Next is 4

27 27 Hexadecimal Strings of 0s and 1s too hard to write Use base-16 or hexadecimal – 4 bits DecBinHex 000000 100011 200102 300113 401004 501015 601106 701117 DecBinHex 810008 910019 101010? 111011? 121100? 131101? 141110? 151111?

28 28 Hexadecimal Letters to represent 10-15 DecBinHex 000000 100011 200102 300113 401004 501015 601106 701117 DecBinHex 810008 910019 101010a 111011b 121100c 131101d 141110e 151111f Power of 2Power of 2 Size of byteSize of byte Why use base 16?

29 29 Hex to Binary Convention – write 0x before number: 0x2ac or (2ac) 16 Hex to Binary – just convert digits BinHex 00000 00011 00102 00113 01004 01015 01106 01117 10008 10019 1010a 1011b 1100c 1101d 1110e 1111f 0x2ac 001010101100 (2ac) 16 = 0x2ac = 001010101100 No magic – remember hex digit = 4 bits

30 30 Binary to Hex Just convert groups of 4 bits BinHex 00000 00011 00102 00113 01004 01015 01106 01117 10008 10019 1010a 1011b 1100c 1101d 1110e 1111f 101001101111011 1011 537b 101001101111011 = 0x537b = (537b) 16 0101  0111  0011 

31 31 Hex to Decimal Just multiply each hex digit by a decimal value which is its positional weight, and add the results.  16 3 16 2 16 1 16 0 4096256161 0x2ac 2 256 + 10 16 + 12 1 = 684 DecHex 00 11 22 33 44 55 66 77 88 99 10a 11b 12c 13d 14e 15f

32 32 Decimal to Hex Analogous to decimal  binary. 1.Find largest power-of-16 smaller than decimal number 2.Divide by power-of-16. The integer result is hex digit. 3.The remainder is new decimal number. 4.Do the same thing again

33 33 Decimal to Hex  16 3 16 2 16 1 16 0 4096256161 DecHex 00 11 22 33 44 55 66 77 88 99 10a 11b 12c 13d 14e 15f 684 684/256 = 2 0x2__ 684%256 = 172 172/16 = 10 = a 0x2a_ 172%16 = 12 = c 0x2ac

34 34 Octal Octal is base 8 Similar to hexadecimal ♦ Conversions Less convenient for use with 8-bit bytes

35 Chapter 1 35 In General: N UMBER S YSTEMS – Representation  Positive radix, positional number systems  A number with radix r is represented by a string of digits: A n - 1 A n - 2 … A 1 A 0. A - 1 A - 2 … A - m  1 A - m in which 0  A i < r and. is the radix point.  The string of digits represents the power series:  (Number) r =   j = - m j j i i = 0 i rArA (Integer Portion) + (Fraction Portion) i = n - 1 j = - 1

36 Chapter 1 36 Number Systems – Examples GeneralDecimalBinary Radix (Base)r102 Digits0 => r - 10 => 90 => 1 0 1 2 3 Powers of 4 Radix 5 -2 -3 -4 -5 r 0 r 1 r 2 r 3 r 4 r 5 r -1 r -2 r -3 r -4 r -5 1 10 100 1000 10,000 100,000 0.1 0.01 0.001 0.0001 0.00001 1 2 4 8 16 32 0.5 0.25 0.125 0.0625 0.03125

37 Chapter 1 37 Special Powers of 2  2 10 (1024) is Kilo, denoted "K"  2 20 (1,048,576) is Mega, denoted "M"  2 30 (1,073, 741,824)is Giga, denoted "G"  2 40 (1,099,511,627,776 ) is Tera, denoted “T"

38 38 Conversion Between Bases  Method 2  To convert from one base to another: 1) Convert the Integer Part 2) Convert the Fraction Part 3) Join the two results with a radix point

39 39 Example: Convert 46.6875 10 To Base 2  Convert 46 to Base 2  Convert 0.6875 to Base 2:  Join the results together with the radix point:

40 40 Conversion Details  To Convert the Integral Part: Repeatedly divide the number by the new radix and save the remainders. The digits for the new radix are the remainders in reverse order of their computation.  To Convert the Fractional Part: Repeatedly multiply the fraction by the new radix and save the integer digits that result. The digits for the new radix are the integer digits in order of their computation.  If the new radix is > 10, then convert all integers > 10 to digits A, B, …

41 41 Additional Issue - Fractional Part  Note that in this conversion, the fractional part became 0 as a result of the repeated multiplications.  In general, it may take many bits to get this to happen or it may never happen.  Example: Convert 0.65 10 to N 2 0.65 = 0.1010011001001 … The fractional part begins repeating every 4 steps yielding repeating 1001 forever!  Solution: Specify number of bits to right of radix point and round or truncate to this number.

42 42 Arithmetic -- addition Binary similar to decimal arithmetic 01100 +10001 11101 No carries 101100 10110 +10111 101101 Carries 1+1 is 2 (or 10 2 ), which results in a carry

43 43 Arithmetic -- subtraction 10110 -10010 00100 No borrows 00110 11110 -10011 01011 Borrows 0 - 1 results in a borrow

44 44 Arithmetic -- multiplication 1011 0000 1011 110111 Successive additions of multiplicand or zero, multiplied by 2 (10 2 ). Note that multiplication by 10 2 just shifts bits left. 1011 X 101 multiplicandmultiplier

45 45 Hexadecimal Arithmetic Similar If you’re doing by hand, easiest to convert each set of digits to decimal and back

46 Chapter 1 46 D ECIMAL C ODES - Binary Codes for Decimal Digits Decimal8,4,2,1 Excess3 8,4,-2,-1 Gray 0 0000 0011 0000 1 0001 0100 0111 0100 2 0010 0101 0110 0101 3 0011 0110 0101 0111 4 0100 0111 0100 0110 5 0101 1000 1011 0010 6 0110 1001 1010 0011 7 0111 1010 1001 0001 8 1000 1011 1000 1001 9 1100 1111 1000  There are over 8,000 ways that you can chose 10 from the 16 binary numbers of 4 bits. A few are useful:

47 47 BCD Binary Coded Decimal Decimal digits stored in binary ♦ Four bits/digit ♦ Like hex, except stops at 9 ♦ Example 931 is coded as 1001 0011 0001

48 Chapter 1 48 Warning: Conversion or Coding?  Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a BINARY CODE.  13 10 = 1101 2 (This is conversion)  13  0001|0011 (This is coding)

49 49 Other Codes Exist Non positional Example: 3-bit Gray Code ♦ 000,001,011,010,110,111,101,100 Binary Gray code for octal digits ♦ Only one bit changes at a time ♦ Actually there’s a family of Gray codes

50 Chapter 1 50 G RAY C ODE – Decimal Decimal8,4,2,1 Gray 0 0000 1 0001 0100 2 0010 0101 3 0011 0111 4 0100 0110 5 0101 0010 6 0110 0011 7 0111 0001 8 1000 1001 9 1000

51 51 Character Codes From numbers to letters ASCII ♦ Stands for American Standard Code for Information Interchange ♦ Only 7 bits defined Unicode

52 52 ASCII table

53 53 Even Parity Sometimes high-order bit of ASCII coded to enable detection of errors Even parity – set bit to make number of 1’s even Examples ♦ A (100 0001) with even parity is 0100 0001 ♦ C (100 0011) with even parity is 1100 0011

54 54 Odd Parity Similar except make the number of 1’s odd Examples A (100 0001) with odd parity is 1100 0001 C (100 0011) with odd parity is 0100 0011

55 55 Error Detection Note that parity detects only simple errors ♦ One, three, etc. bits More complex methods exist Some that enable recovery of original info ♦ Cost is more redundant bits


Download ppt "0907231 Digital Logic Dr. Walid Abu-Sufah Read Chapter 1: Sections 1-7 Based on notes by A. Lastra and slides provided by the text publisher."

Similar presentations


Ads by Google