ENG241 Digital Design Week #1 Digital Computers and Information.
-
Upload
noel-dawson -
Category
Documents
-
view
218 -
download
2
Transcript of ENG241 Digital Design Week #1 Digital Computers and Information.
ENG241 ENG241 Digital DesignDigital Design
Week #1Digital Computers and Information
2
ResourcesResources
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
TopicsTopics
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
PDA
Body
Entertainment
Household
Communication
Home Networking
Car
Medicine
PC
Super Computer
Computing Devices Everywhere!Computing Devices Everywhere!
Game console
5
The Transistor RevolutionThe Transistor Revolution
First transistorBell Labs, 1948
Bipolar logic1960’s
• Intel 4004 processor • Designed in 1971• Almost 3000 transistors• Speed:1 MHz operation
© K
LMH
Lien
ig6
1.3 VLSI Design Styles
Power (Vdd)-Rail
Ground (GND)-Rail
Contact
Vdd
GND
OUT
IN2
IN1OUT
IN2
IN1
OUTIN1
Vdd
GND
IN2
Diffusion layer
p-typetransistor
n-typetransistor
Metal layer
Poly layer
n+n+S
GD
+
DEVICE
CIRCUIT
GATE
MODULE
SYSTEM Specification
Functional design
Circuit design
Physical design
Test/Fabrication
Logic design
The VLSI Design CycleThe VLSI Design Cycle
8
Signals
An information variable represented by a physical quantity (speech, Temp, humidty, noise, …)
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
Analog Signals
Analog
Time
Continuous in value &
time
11
Digital Signals
For digital systems, the variable takes on discrete values (i.e., not continuous)
Time
DigitalDiscrete in
value
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
What are other physical quantities represent 0 and 1?
Binary Values: Other Physical Quantities
Magnetic Field DirectionSurface Pits/Light
Electrical Charge
CPU VoltageHDiskCDDynamic RAM
14
Digital System Example:
A Digital Counter (e. g., odometer):
1 30 0 5 6 4Count Up
Reset
Inputs: Count Up, Reset Outputs: Visual Display State: "Value" of stored digits
15
A Digital Computer Example
Inputs: Keyboard, mouse, modem, microphone
Outputs: CRT, LCD, modem, speakers
Memory
Controlunit Datapath
Input/Output
CPU
Data/Instructions/code
clock
16
Number Systems – Representation
A number with radix r is represented by a string of digits: An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m 1 A- m
in which 0 Ai < r and “.” is the radix point.
The string of digits represents the power series:
(Number)r = j = - m
jj
i
i = 0i rArA
(Integer Portion) + (Fraction Portion)
i = n - 1 j = - 1
1717
Decimal Number SystemDecimal 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
1 0 -12 -2
5 1 2 7 4
10 1 0.1100 0.01
500 10 2 0.7 0.04
d2*B2+d1*B
1+d0*B0+d-1*B
-1+d-2*B-2
(512.74)10
1818
Octal Number SystemOctal 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
1 0 -12 -2
8 1 1/864 1/64
5 1 2 7 4
5 *8 2+1 *8 1+2 *8 0+7 *8- 1+4 *8 -2
=(330.9375)10
(512.74)8
19
Octal Number System: Example
For Example, (27)8 can be expressed as: ( )10
(17.1)8 can be expressed as: ( )10
2020
Hexadecimal Number SystemHexadecimal 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
1 0 -12 -2
16 1 1/16256 1/256
1 E 5 7 A
1 *162+14 *161+5 *160+7 *16-1+10 *16-2
=(485.4765625)10
(1E5.7A)16
21
Hex to DecimalHex to Decimal
Just multiply each hex digit by decimal value, and add the results.
163 162 161 160
4096 256 16 1
(2ac)(2ac)1616
2 2 • 256• 256 + 10 + 10 • 16• 16 + 12 + 12 • 1• 1 = (684)= (684)1010
Dec Hex
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 a
11 b
12 c
13 d
14 e
15 f
2222
Binary Number SystemBinary Number System
Base = 2
● 2 digits { 0, 1 }, called binary digits or “bits”
Weights
● Weight = (Base) Position
Magnitude
● Sum of “Bit x Weight”
Formal Notation
Groups of bits 4 bits = Nibble
8 bits = Byte
1 0 -12 -2
2 1 1/24 1/4
1 0 1 0 1
1 *22+0 *21+1 *20+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
Binary Binary Decimal: Example Decimal: Example
7 6 5 4 3 2 1 0
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 0 0 1 1 1 0 0
128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156
What is 10011100 in decimal?What is 10011100 in decimal?
7 6 5 4 3 2 1 0 position
Binary #
position
value
Why Binary?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).2424
25
Binary NumbersBinary NumbersExamples:
(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 1n bits can store numbers from 0 to 2n-1
2626
The Power of 2 The Power of 2
n 2n
0 20=1
1 21=2
2 22=4
3 23=8
4 24=16
5 25=32
6 26=64
7 27=128
n 2n
8 28=256
9 29=512
10 210=1024
11 211=2048
12 212=4096
20 220=1M
30 230=1G
40 240=1T
Mega
Giga
Tera
Kilo
2727
Number Base ConversionsNumber Base Conversions
Decimal(Base 10)
Octal(Base 8)
Binary(Base 2)
Hexadecimal(Base 16)
Evaluate Magnitude
Evaluate Magnitude
Evaluate Magnitude
28
Conversion Between BasesConversion 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
2929
Decimal (Decimal (IntegerInteger) to Binary Conversion) to Binary Conversion
Divide the number by the ‘Base’ (=2)
Take the remainder (either 0 or 1) as a coefficient
Take the quotient and repeat the division
Example: (13)10
Quotient Remainder Coefficient
Answer: (13)10 = (a3 a2 a1 a0)2 = (1101)2
MSB LSBMSB LSB
13/ 2 = 6 1 a0 = 1 6 / 2 = 3 0 a1 = 0 3 / 2 = 1 1 a2 = 1 1 / 2 = 0 1 a3 = 1
Decimal to Binary ConversionDecimal to Binary Conversion
3131
Decimal (Decimal (FractionFraction) to Binary Conversion) to Binary Conversion
Multiply the number by the ‘Base’ (=2)
Take the integer (either 0 or 1) as a coefficient
Take the resultant fraction and repeat multiplication
Example: (0.625)10
Integer Fraction Coefficient
Answer: (0.625)10 = (0.a-1 a-2 a-3)2 = (0.101)2
MSB LSBMSB LSB
0.625 * 2 = 1 . 250.25 * 2 = 0 . 5 a-2 = 00.5 * 2 = 1 . 0 a-3 = 1
a-1 = 1
3232
Decimal to Octal ConversionDecimal to Octal Conversion
Example: (175)10
Quotient Remainder Coefficient
Answer: (175)10 = (a2 a1 a0)8 = (257)8
175 / 8 = 21 7 a0 = 7 21 / 8 = 2 5 a1 = 5 2 / 8 = 0 2 a2 = 2
Example: (0.3125)10
Integer Fraction Coefficient
Answer: (0.3125)10 = (0.a-1 a-2 a-3)8 = (0.24)8
0.3125 * 8 = 2 . 50.5 * 8 = 4 . 0 a-2 = 4
a-1 = 2
33
Decimal to HexDecimal to Hex
163 162 161 160
4096 256 16 1
Dec Hex
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 a
11 b
12 c
13 d
14 e
15 f
(684)(684)1010
684/16 = 42 rem 12=c684/16 = 42 rem 12=c c
42/16 = 2 rem 10=a42/16 = 2 rem 10=a ac
2/16 = 0 rem 22/16 = 0 rem 2 2ac
34
Hexadecimal (Base 16)Hexadecimal (Base 16)
Dec Bin Hex
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
Dec Bin Hex
8 1000 8
9 1001 9
10 1010 a
11 1011 b
12 1100 c
13 1101 d
14 1110 e
15 1111 f
•Power of 2Power of 2
•Size of byteSize of byte
Why useWhy usebase 16?base 16?
Strings of 0’s and 1’s too hard to write Use base-16 or hexadecimal – 4 bits
35
Hex to BinaryHex to Binary
Convention – write 0x (prefix) before number Hex to Binary – just convert digits
Bin Hex
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 a
1011 b
1100 c
1101 d
1110 e
1111 f
0x2ac0x2ac
00100010 10101010 11001100
0x2ac = (001010101100)0x2ac = (001010101100)22
No magic – remember hex digit = 4 bitsNo magic – remember hex digit = 4 bits
(2ac)(2ac)1616
3636
Binary Binary −− Hexadecimal Conversion Hexadecimal Conversion
16 = 24
Each group of 4 bits represents a hexadecimal digit
Hex Binary0 0 0 0 01 0 0 0 12 0 0 1 03 0 0 1 14 0 1 0 05 0 1 0 16 0 1 1 07 0 1 1 18 1 0 0 09 1 0 0 1A 1 0 1 0B 1 0 1 1C 1 1 0 0D 1 1 0 1E 1 1 1 0F 1 1 1 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
Binary to HexBinary to Hex
Just convert groups of 4 bits
Bin Hex
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 a
1011 b
1100 c
1101 d
1110 e
1111 f
(101001101111011)(101001101111011)22
10111011
55 33 77 bb
101001101111011 = 0x537b = (537b)101001101111011 = 0x537b = (537b)1616
0101 0101 0111 0111 0011 0011
3838
Octal Octal −− Hexadecimal Conversion 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
3939
AdditionAddition
Decimal Addition
5 5
55+
011
= Ten ≥ Base
Subtract a Base
11 Carry
4040
Binary AdditionBinary Addition
Column Addition
1 0 1111
1111 0+
0000 1 11
≥ (2)10
111111
= 61
= 23
= 84
4141
Binary SubtractionBinary Subtraction
Borrow a “Base” when needed
0 0 1110
1111 0−
0101 1 10
= (10)2
2
2
2 2
1
000
1
= 77
= 23
= 54
4242
Binary MultiplicationBinary Multiplication
Bit by bit
01 1 1 1
01 1 0
00 0 0 0
01 1 1 1
01 1 1 1
0 0 000
0110111 0
x
43
Binary Numbers and Binary CodingBinary 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
Given 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.
Example: Abinary codefor the sevencolors of therainbow
Code 100 is not used
Non-numeric Binary CodesNon-numeric Binary Codes
Binary Number 000001010011101110111
ColorRedOrangeYellowGreenBlueIndigoViolet
45
Given M elements to be represented by a binary code, the minimum number of bits, n, needed, satisfies the following relationships:
2n > M > 2(n – 1)
n = log2 M where x , is called the ceiling function, i.e the integer greater than or equal to x.
Number of Bits RequiredNumber of Bits Required
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 (log2 10) = ceiling (3.3219) = 4
• Checking:
Number of Bits RequiredNumber of Bits Required
)(loglog
,22
22
1
MceilingMn
whereM nn
8210162 34 46
4747
Binary CodesBinary Codes
Group of n bits
● Up to 2n combinations
● Each combination represents an element of information
Binary Coded Decimal (BCD)
● Each Decimal Digit is represented by 4 bits
● (0 – 9) Valid combinations
● (10 – 15) Invalid combinations
Decimal BCD0 0 0 0 01 0 0 0 12 0 0 1 03 0 0 1 14 0 1 0 05 0 1 0 16 0 1 1 07 0 1 1 18 1 0 0 09 1 0 0 1
4848
Gray CodeGray Code
One bit changes fromone code to the nextcode
Different than Binary
Decimal Gray00 000001 000102 001103 001004 011005 011106 010107 010008 110009 110110 111111 111012 101013 101114 100115 1000
Binary0000000100100011010001010110011110001001101010111100110111101111
49
Binary RepresentationsBinary 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..”A group of four bits four bits is called a nibblenibble (or nybble).
Bytes, therefore, consist of two nibbles: a “high-order nibble,” and a “low-order” nibble.
A bytebyte is a group of eight bitseight bits. A byte is the smallest possible addressable (can be found
via its location) unit of computer storage.A wordword is a contiguous group of bytescontiguous group of bytes.
Words can be any number of bits (16, 32, 64 bits are common).
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
BCD: Advantages/DisadvantagesBCD: 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
Character CodesCharacter Codes
From numbers to letters ASCII
Stands for American Standard Code for Information Interchange
Only 7 bits defined Unicode
ASCII CodeASCII Code
American Standard Code for Information Interchange
Info 7-bit CodeA 1000001B 1000010...
.
.
.Z 1011010
a 1100001b 1100010...
.
.
.z 1111010
@ 1000000? 0111111+ 0101011
5353
54
ASCII table
Error Detecting CodesError Detecting Codes
Parity
One bit added to a group of bits to make the total number of ‘1’s (including the parity bit) even or odd
● Even
● Odd
Good for checking single-bit errors
1 0 1 1 1 1 0 0 0 0 0 10
0 0 1 1 1 1 0 0 0 0 0 11
4-bit Example 7-bit Example
5555
56
ReadingReading
Read Chapter 1 Make sure you’re comfortable with
material Check the lecture notes from
the Web site. Solve the assignment.
57
HomeworkHomework
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