Presentation on theme: "Digital Computers and Information"— Presentation transcript:
1 Digital Computers and Information Chapter 1(1.1 through 1.6)Digital Computers and InformationBased on “Logic and Computer Design Fundamentals”, by Mano and Kime, Prentice Hall
2 AnnouncementsHomework problem set 1 will be posted on the class website.Due: Wednesday 1/23/2013
3 Overview: you will learn Information RepresentationNumber Systems [binary, octal and hexadecimal]Base ConversionDecimal Codes [BCD (binary coded decimal)]Alphanumeric CodesParity BitGray Codes
4 1-1 INFORMATION REPRESENTATION in Digital Systems- Signals Information variables represented by physical quantities. For digital systems, the variables take on discrete values.Two levels or binary values are the most prevalent values in digital systems. Binary values are represented abstractly by:digits 0 and 1words (symbols) False (F) and True (T)words (symbols) Low (L) and High (H)and words Off and On.
5 Signal Examples Over Time AnalogContinuous in value & timeAsynchronousDigitalDiscrete in value & continuous in timeDiscrete in value & timeSynchronouswith the clock
6 Advantage of Digital Circuit Immunity to noiseIllustration:Noise addedReceiverSenderSignalSignal
7 Immunity to noise: Noise Margin VOHNMHVIHForbiddenVILNMLVOLThreshold RegionThe HIGH range typically corresponds to binary 1 and LOW range to binary 0. The threshold region is a range of voltagesfor which the input voltage value cannot be interpreted reliably as either a 0 or a 1.We cannot violate the Noise Margins, otherwise our digital assumption is not valid: thus Vo must be > VOH or < VOL.
8 Binary Values: Other Physical Quantities What are other physical quantities represent 0 and 1?Logic Gates, CPU: VoltageDiskCDDynamic RAMMagnetic Field DirectionSurface Pits/LightElectrical Charge
9 1-2 Number Systems Positive radix, positional number systems Examples: Decimal (radix r =10)Binary (radix r =2)Octal (radix r = )Hexadecimal (r = )Ex: 24.3 = 2x x100+3x10-1Digits (0-9)Ex: = ( . )10Bits (0-1)= = 13.25Digits: 1,2,…9, A, B, C, D, E, F
11 Powers of 2: 2n It will be convenient to remember these powers n 2n n 123456789101632641282565121024n2n-1-2-188.8.131.52
12 Special Powers of 2 220 (=1,048,576) is Mega, denoted "M" 210 (=1024) is Kilo, denoted "K"220 (=1,048,576) is Mega, denoted "M"230 (1,073, 741,824) is ?Giga, denoted "G"240 (1,099,511,627,776 ) is Tera, denoted “T"Note: 8 bits (b) are also called a byte (B)= 2^8-1= 256-1=255Also what is the max no two bytes can represent?= 2^16-1 = 2^10 x 2^6 – 1 = 1024x64-1=65,536-1=65,535Exercise: what is ( )2 equal to in decimal?Also what is the maximum number (in decimal) a two bytes long word can represent?
13 Range of numbers Binary number: ex. a 3-bit number: n=3 000, 001 … ,111 or in decimal system: 0, 1 … 7Total of 8 numbers (=23)Range: from 0 to 7 (0 to 23-1)In general a n-bit number represents:2n different numbersMin: 0Max number: 2n-1For fractions: m bits after the radix point:Max number: (2m -1)/2mFractions Max number: ? 2m-1/2mProof: A A …. A-m2-m)= 2-m (A-12m-1 + A-22m-2 +… A-m20)= 2-m (2m -1)
14 Exercise 16 Gbyte (= 16 GB) of memory How many (address) bits are required to address each byte?We need to address or represent 32Giga numbers (address positions):16Giga = 24 x230=234 or n=34 bits.
15 ExerciseDigital camera has 2048x2048 pixels, and each pixel stores 8 bits of information:a. How many Mega pixels?b. How many bits are stored per frame?c. How many different intensity levels can be represented by each pixel?Solutions:2048x2048 = 2x1010 x 2x1010 = 4x1020=4Megapixelb. Each pixel stores 8 bits of information; with 4Megapixel there will be 8x4Mbits of information or 32 Mbits or 4Mbyte of information=32x1024x1024 = 33,554,432c. With 8 bits per pixel: no. of levels (numbers): 28=256 levels
16 Use of HEX system Short hand notation of large binary numbers: Each HEX digits can be represented by exactly 4 bits (16=24)Thus ( )2Conversion from binary to HEX and HEX to binary is very easy:( )2 = ( )16( )2 = ( )16B = ( )2E( )2 = ( 9D )16( )2 = ( )16=2 B CB39.7 =
17 Each octal digit can be represented by 3 bits Octal systemRadix r = 88 digits:0, 1, 2,…7Ex: 2758 = 2x82 + 7x8 + 5x1 == 18910Each octal digit can be represented by 3 bits
18 1-3 Conversion Between Bases To convert from one base to another:1) Convert the Integer Part2) Convert the Fraction Part3) Join the two results with a radix point
19 Conversion from Decimal to new Radix 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, …
20 Example: convert (325.65)10 to hex Integer part: = ( )16Fractional part: .65325/16 = 20 and rem = 520/16 = 1 and rem = 41/ = 0 and rem = 1Most significantLeast significant digitThus = 145160.65x16 = thus int = 10= A0.4x16 = thus int = 6Etc.Most significantLeast significantThus = A6616= 145.A6616
21 Example: Convert 54.687510 To Base 2 Join the results together with the radix point:542:54/2=27 + rem = 027/2=13 rem= 113/2=6 rem=16/2 = 3 rem=03/2 = 1 rem=1½ = 0 rem =1Thus 5410 =Answer 1: Converting 46 as integral part: Answer 2: Converting as fractional part:46/2 = 23 rem = * 2 = int = 123/2 = 11 rem = * 2 = int = 011/2 = 5 remainder = * 2 = int = 15/2 = 2 remainder = * 2 = int = 12/2 = 1 remainder =1/2 = 0 remainder = 1For fractional part: Reading off in the forward direction:For the integral part: Reading off in the reverse direction:Answer 3: Combining Integral and Fractional Parts:
22 Conversions from Binary to Octal and Hexadecimal Grouping in groups of 3 or 4 bitsConvert into octal and hexadecimal:Octal:Hexadecimal8 B16
23 Octal to Hexadecimal via Binary Conversion from Octal to Hexadecimal and vice versaConvert 2138 into an hexadecimal number:21388 B16
24 Exercise: Octal Hexadecimal Exercise: Hexadecimal to Octal:3A.5 16 = ( )8Octal to Binary to Hexadecimal= ( )16(3A.5) 16 = ( )8= = (72.24)8110|011| |111|111 2Regroup:(1|1001| |1111|1000)2Convert:D FAnswer 2: Marking off in groups of three (four) bits corresponds to dividing or multiplying by 23 = 8 (24 = 16) in the binary system.
25 Conversion - Summary Hexadecimal Ai.16i Decimal Binary Ai.8i Octal Divisions (or x) by 16HexadecimalAi.16iDecimalDivisons by 2Group in bits of 4SAi.2iBinaryDivisons by 8Octal Hex: through the binary representationGroup in bits of 3 Ai.8iOctal
27 Multiple Bit Binary Addition Extending this to two multiple bit examples:CarriesAugendAddendSumNote: The 0 is the default Carry-In to the least significant bit.CarriesAugendAddendSum
28 Multiple Bit Binary Subtraction Extending this to two multiple bit examples:BorrowsMinuendSubtrahendDifferenceNotes: The 0 is a Borrow-In to the least significant bit. If the Subtrahend > the Minuend, interchange and append a – to the result.BorrowsMinuendSubtrahend – –10011Difference
29 Example: 3-bit code can represent up to 8 different elements” 1-4 Binary CodesA n-bit binary code is a n-bit word which can represent up to 2n different elements.Example: 3-bit code can represent up to 8 different elements”All quantities in a PC needs to be expressed as a binary number: e.g. the digits 0, 1, …9; characters, control characters, etc. This can be done using a “Code
30 Binary CodesExample: A binary code for the seven colors of the rainbowCode 100 is not usedGiven n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the 2n binary numbers or elements.ColorBinary Number000001010011101110111RedOrangeYellowGreenBlueIndigoViolet
31 Binary Coded Decimal (BCD) The BCD code is the 8,4,2,1 code.This code only encodes the first ten values from 0 to 9.Each decimal digit is coded separately by 4 bitsExample:(325)10 = ( )BCDExercise: (856)10 = ( )BCD(325)10 = BCDIf it were a binary conversion (not BCD encoding):(9bits)(856)10 = BCD856 = ( )2325
32 1-5 ALPHANUMERIC CODES - ASCII Character Codes American Standard Code for Information InterchangeThis code is a popular code used to represent information sent as character-based data. It uses 7-bits to represent:94 Graphic printing characters.34 Non-printing charactersSome non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage return)
34 PARITY BIT Error-Detection Codes Redundancy (e.g. extra information), in the form of extra bits, can be incorporated into binary code words to detect and correct errors.A simple form of redundancy is parity, an extra bit appended onto the code word in the most significant position to make the number of 1’s odd or even. Parity can detect all single-bit errors and some multiple-bit errors.A code word has even parity if the number of 1’s in the code word is even.A code word has odd parity if the number of 1’s in the code word is odd.TXRX7Parity bit
35 ASCII Parity Code Example TXRX7Parity bitAt the receiver side:If an even parity is detected, send an ACK control =If error was detected send negative acknowledge NAK =Transmit Ha in ascii:Transmit with even parity:Even Parity Bits: 0, 1, 1, 0, 1, 0, 0, 1Odd Parity Bits: 1, 0, 0, 1, 0, 1, 1, 0added parity bit
36 1-6 GRAY CODE – Decimal Binary Gray 000 001 010 011 100 101 110 111 2 bit changesOnly 1 bit changesAnswer: As we “counts” up or down in decimal, the code word for the Gray code changes in only one bit position as we go from decimal digit to digit including from 9 to 0.