Download presentation
Presentation is loading. Please wait.
Published byNoel Dawson Modified over 9 years ago
1
ENG241 Digital Design Week #1 Digital Computers and Information
2
2 Resources Chapter #1, Mano Sections 1.1 Digital Computers 1.2 Number Systems 1.3 Arithmetic Operations 1.4 Decimal Codes 1.5 Alphanumeric Codes
3
3Topics Computing Devices and VLSI Design Signals (Digital vs. Analog) Digital Systems and Computers Number systems [binary, octal, hex] Base Conversion Arithmetic Operations Decimal Codes [BCD] Alphanumeric Codes
4
4 PDA Body Entertainment Household Communication Home Networking Car Medicine PC Super Computer Computing Devices Everywhere! Game console
5
5 The Transistor Revolution First transistor Bell Labs, 1948 Bipolar logic 1960’s Intel 4004 processor Designed in 1971 Almost 3000 transistors Speed:1 MHz operation
6
© KLMH Lienig 6 1.3VLSI Design Styles Power (Vdd)-Rail Ground (GND)-Rail Contact Vdd GND OUT IN2 IN1 OUT IN2 IN1 OUT IN1 Vdd GND IN2 Diffusion layer p-type transistor n-type transistor Metal layer Poly layer
7
n+ S G D + DEVICE CIRCUIT GATE MODULE SYSTEM Specification Functional design Circuit design Physical design Test/Fabrication Logic design The VLSI Design Cycle
8
8 Signals An information variable represented by a physical quantity (speech, Temp, humidty, noise, …)
9
9 Signals Signals can be analog or digital: 1.Analog signals can have an infinite number of values in a range; 2.Digital signals can have only a limited number of values.
10
10 Analog Signals Analog Time Continuous in value & time
11
11 Digital Signals For digital systems, the variable takes on discrete values (i.e., not continuous) Time Digital Discrete in value
12
12 Signal Examples Over Time Asynchronous Synchronous Discrete in value & continuous in time Discrete in value & time Digital Digital (Binary) values are represented by: digits 0 and 1 / False (F) and True (T) words (symbols) Low (L) and High (H) words On and Off. Time
13
13 What are other physical quantities represent 0 and 1? Binary Values: Other Physical Quantities Magnetic Field Direction Surface Pits/Light Electrical Charge CPU Voltage HDisk CD Dynamic RAM
14
14 Digital System Example: A Digital Counter (e. g., odometer): 1300564 Count Up Reset Inputs: Count Up, Reset Outputs:Visual Display State: "Value" of stored digits
15
15 A Digital Computer Example Inputs: Keyboard, mouse, modem, microphone Outputs: CRT, LCD, modem, speakers Data/Instructions/code clock
16
16 Number Systems – Representation 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
17
17 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
18
18 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
19
19 Octal Number System: Example For Example, (27) 8 can be expressed as: ( ) 10 (17.1) 8 can be expressed as: ( ) 10
20
20 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
21
21 Hex to Decimal Just multiply each hex digit by decimal value, and add the results. 16 3 16 2 16 1 16 0 4096256161 (2ac) 16 2 256 + 10 16 + 12 1 = (684) 10 DecHex 00 11 22 33 44 55 66 77 88 99 10a 11b 12c 13d 14e 15f
22
22 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
23
23 Binary Decimal: Example 76543210 2727 2626 2525 2424 23232 2121 2020 1286432168421 100 1 1 1 0 0 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156 What is 10011100 in decimal? 76543210 position Binary # position value
24
Why Binary? This is easier to implement in hardware than a unit that can take on 10 different values. ●For instance, it can be represented by a transistor being off (0) or on (1). ●Alternatively, it can be a magnetic stripe that is magnetized with North in one direction (0) or the opposite (1). Binary also has a convenient and natural association with logical values of: ●False (0) and ●True (1). 24
25
25 Binary Numbers Examples: (00) 2 (0) 10 (01) 2 (1) 10 (10) 2 (2) 10 (010) 2 (2) 10 (11) 2 (3) 10 (100) 2 (4) 10 (1001010101000) 2 Strings of binary digits (“bits”) One bit can store a number from 0 to 1 n bits can store numbers from 0 to 2 n -1
26
26 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
27
27 Number Base Conversions Decimal (Base 10) Octal (Base 8) Binary (Base 2) Hexadecimal (Base 16) Evaluate Magnitude
28
28 Conversion Between Bases 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
29
29 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
30
Decimal to Binary Conversion
31
31 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 multiplication 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
32
32 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
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) 10 684/16 = 42 rem 12=c c 42/16 = 2 rem 10=a ac 2/16 = 0 rem 2 2ac
34
34 Hexadecimal (Base 16) 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? Strings of 0’s and 1’s too hard to write Use base-16 or hexadecimal – 4 bits
35
35 Hex to Binary Convention – write 0x (prefix) before number 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 0x2ac = (001010101100) 2 No magic – remember hex digit = 4 bits (2ac) 16
36
36 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)
37
37 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) 2 1011 537b 101001101111011 = 0x537b = (537b) 16 0101 0111 0011
38
38 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
39
39 Addition Decimal Addition 55 55 + 011 = Ten ≥ Base Subtract a Base 11Carry
40
40 Binary Addition Column Addition 101111 11110 + 0000111 ≥ (2) 10 111111 = 61 = 23 = 84
41
41 Binary Subtraction Borrow a “Base” when needed 001110 11110 − 0101110 = (10) 2 2 2 2 2 1 000 1 = 77 = 23 = 54
42
42 Binary Multiplication Bit by bit 01111 0110 00000 01111 01111 0 0000 01101110 x
43
43 Binary Numbers and Binary Coding Flexibility of representation Within constraints below, can assign any binary combination (called a code word) to any data as long as data is uniquely encoded. Information Types Numeric Must represent range of data needed Very desirable to represent data such that simple, straightforward computation for common arithmetic operations permitted Tight relation to binary numbers Non-numeric Greater flexibility since arithmetic operations not applied. Not tied to binary numbers
44
44 Given n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the 2 n binary numbers. Example: A binary code for the seven colors of the rainbow Code 100 is not used Non-numeric Binary Codes Binary Number 000 001 010 011 101 110 111 Color Red Orange Yellow Green Blue Indigo Violet
45
45 Given M elements to be represented by a binary code, the minimum number of bits, n, needed, satisfies the following relationships: 2 n > M > 2 (n – 1) n = log 2 M where x, is called the ceiling function, i.e the integer greater than or equal to x. Number of Bits Required
46
Given M elements to be represented by a binary code, the minimum number of bits, n, needed, satisfies the following relationships: Example: How many bits are required to represent decimal digits with a binary code? M = 10, hence n = ceiling (log 2 10) = ceiling (3.3219) = 4 Checking: Number of Bits Required 46
47
47 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
48
48 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
49
49 Binary Representations A bit A bit is the most basic unit of information in a computer. It is a state of “on” or “off” in a digital circuit. Sometimes these states are “high” or “low” voltage instead of “on” or “off..” four bits nibble A group of four bits is called a nibble (or nybble). Bytes, therefore, consist of two nibbles: a “high-order nibble,” and a “low-order” nibble. byteeight bits A byte is a group of eight bits. A byte is the smallest possible addressable (can be found via its location) unit of computer storage. wordcontiguous group of bytes A word is a contiguous group of bytes. Words can be any number of bits (16, 32, 64 bits are common).
50
50 Conversion or Coding? 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) BCD (0001|0011) BCD (This is coding) Advantages/Disadvantages?
51
51 BCD: Advantages/Disadvantages Disadvantage: It is obvious that a BCD number needs more bits than its equivalent binary value (26) 10 = (11010) 2 (26) 10 = (0010 0110) BCD Advantages: Computer input/output data are handled by people who use the decimal system. So it is easier to convert back/forth to BCD.
52
52 Character Codes From numbers to letters ASCII Stands for American Standard Code for Information Interchange Only 7 bits defined Unicode
53
ASCII Code American Standard Code for Information Interchange Info7-bit Code A1000001 B1000010............ Z1011010 a1100001 b1100010............ z1111010 @1000000 ?0111111 +0101011 53
54
54 ASCII table
55
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 55
56
56Reading Read Chapter 1 Make sure you’re comfortable with material Check the lecture notes from the Web site. Solve the assignment.
57
57Homework See Assignment #1 On Web I expect you to know number systems well and be able to do conversions and arithmetic Decimal – Binary Binary – Decimal Decimal – Hex Hex – Decimal Will be on test!
58
58
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.