Upload
buikhue
View
214
Download
0
Embed Size (px)
Citation preview
Chapter 1.Introduction
1
1. Digital SystemSystem
SystemInputs outputsybehavior
Inputs outputs
Digital systemPhysical quantities or signals are represented by discrete valuesExtensively used in computation, data processing, control systems, communications, and measurement
Analog vs. DigitalAnalog entity - represented by continuously varying wave
2
Digital entity – represented by sequence of discrete values
T Tanalog digital10
5
10
5
0time
0time
Real world operates in an analog fashion Why digital? greater accuracy and reliabilityy g g y y
Impairments in signal may distort or change the values of original signalMakes it more difficult to determine exact form of original signalImpairment sources
Attenuation - signal strength falls off with distanceN i t d i l i t d h
3
Noise - unwanted signal inserted somewhereetc
(ex) impaired signal by attenuation
sub- sub- sub-
Analog system
system1 system2 system3
sub- sub- sub-
Digital system
subsystem1
subsystem2
subsystem3
01110101 01110101 01110101 01110101
4
Binary digital systemO t t f t l t i d i h di d Outputs of most electronic devices, such as diodes or transistors, are represented by two states
high or lowhigh or low+V volt or 0 volt“ON” or “OFF”
(Volts)+V1
“1” or “0”It is natural to use binary numbers in digital systems
00
logic 1
l i 0
(ex) quaternary digital system
logic 0
logic 3logic 2
logic 1
5
logic 1logic 0
Ideal and real digital signals
logic 15V 5V
ideal real
logic 0
Not perfect 5V or 0Vd d d d Degradation caused by noise or attenuation produced by
signals passing through wires
5Vnoise margin
6
logic 1 logic 0
* Three parts of complex digital system designSystem designLogic designCircuit design
Memory I / Osubsystem
Memoryunit
I / Odevicessubsystem
ALU subsystem
Digital system (e.g., computer )
7
System designBreak overall system into subsystemsSpecify characteristics of each subsystem as well as interconnection and control of the subsystems
L i d iLogic designDetermine how to interconnect basic logic building blocks (called logic gates) to perform a specific function(called logic gates) to perform a specific functionThis course is devoted to a study of logic design
Circuit designSpecifies the interconnection of electrical elements such Spec f es the nterconnect on of electr cal elements such as resistors, diodes, transistors and capacitors to form logic building block
8
* Switching networksView digital systems as networks of interconnected gates and switches
Two types of switching networksCombinational networkCombinational networkSequential network
Combinational networkOutputs depend only on the present values of inputs not on Outputs depend only on the present values of inputs not on past values
Sequential networkqOutputs depend on both the present and past input valuesGenerally composed of a combinational network with added
9
y mp f mmemory elements
2. Number Systems and Conversion* Number systems
Decimal (base 10) numbersEach digit is multiplied by an appropriate power of 10 depending on its position in the number
(ex) 08.07.035090078.953 10 21012 108107103105109 2 1 0 -1-2
Base R numbersR digits (0, 1, …. , R-1) are usedR is called base or radixA number can be expanded in a power series in R
(ex) 2
21
10
11
22
321123 .
RaRaRaRaRaaaaaa R
10
2112321123 R
Binary (base 2) numbersRepresented only by using the two digits of 0 and 1 called bits bits (binary digits)
(ex) 210132 22222)11.1011(
25.05.0128
10)75.11(
cf) power-of-2
Powers of 2: Useful abbreviations:Powers of 2 Useful abbreviations20 = 1 24 = 16 28 = 256 K = 210 = 1,02421 = 2 25 = 32 29 = 512 M = 220 = 1,048,57622 4 26 64 210 1024 G 230 1 073 741 8242 = 4 26 = 64 2 0 = 1024 G = 230 = 1,073,741,82423 = 8 27 = 128
RAM b 2
11
RAM: base 2Hard disk: base 10
Hexadecimal(base 16) numbers0~9, A, B, C, D, E, F are used
(ex) 10
1216 )2607(151621610)2( FA
* Conversion
1016 )()(
Conversion of a decimal integerinteger to base RDivide decimal by R and record the remainderRepeat until no more quotientLeast significant digit is obtained first
2 5312 26g g
(ex) convert (53)10 to binary12 26
2 132 6 1
0
210 )110101()53( 0
2 32 1
110
12
0 1
Conversion of a decimal fraction to base RM lti l th f ti b R d d th i t t d Multiply the fraction by R and record the integer part and remove itRepeat until we obtain a sufficient number of digitsRepeat until we obtain a sufficient number of digitsMost significant digit is obtained first
(ex) convert (0 625)10 and (0 7)10 to binary(ex) convert (0.625)10 and (0.7)10 to binary
6250
7.024.1625.0
2250.1
22
28.0
6125.0
20.1 2
26.1
2.1
40 4.028.0
)1010()6250(
13
210 )101.0()625.0(
01101.0011001101.0)7.0( 10
(cf) why does this work?( ) 1 4 6 f d l d l(ex) convert 123.456 from decimal to decimal
10 123310 12 3
0 12
10 1210 1
Each division strips off the rightmost digit (the remainder) the quotient represents the remaining digitsq p g gSimilarly, to convert fractions, each multiplication strips off the leftmost digit (the integer part) the fraction represents the remaining digits
456.010
56.4
6510
10
14
6.510
0.6
Conversion between two bases other than decimal
1021 RRbase R1 base R2
Easy way
base R1 base R2
decimal
15
Conversion from binary to octal or hexadecimalStarting at the binary point bits are divided into groups of Starting at the binary point, bits are divided into groups of 3 (for octal) or 4 (for hexadecimal) and each group is replaced by an octal or hexadecimal digit
octal binary0 0001 001
hexadecimal binary hexadecimal binary0 0000 8 10001 0001 9 10011 001
2 0103 011
1 0001 9 10012 0010 A 10103 0011 B 10113 011
4 1005 101
3 0011 B 10114 0100 C 11005 0101 D 1101
6 1107 111
6 0110 E 11107 0111 F 1111
16
(ex) (11010111110.0011 )2
011010111110.0011003 2 7 6 . 1 4
011010111110.00118)14.3276(
)36( BE6 B E . 3 16)3.6( BE
Conversion from octal or hexadecimal to binaryEach digit is replaced by the corresponding 3 or 4 bits,
lrespectively(ex)
(76 1)8 = (111110 001)2(76.1)8 = (111110.001)2(4F.9)16 = (01001111.1001)2
17
Conversion between octal and hexadecimal
E i
octal hexadecimal
Easier way
octal hexadecimal
binaryy
(ex) (232)8 = (010011010)2 = (9A)169 A
18
* Binary arithmeticAddition0 + 0 = 00 1 10 + 1 = 11 + 0 = 11 + 1 = 0 with carry 1 to the next column1 + 1 = 0 with carry 1 to the next columnadd a carry if exists(ex)(ex)
1 1 1 0 (Carries)
The initial carry in is implicitly 0
11( )1 0 1 1 (Augend)
+ 1 1 1 0 (Addend)1 1 0 0 1 (Sum)
10
159
1016111
1
most significant least significant
111
19
bit (MSB) bit (LSB)
Subtraction0 – 0 = 0
0 – 1 = 1 with borrow from the next column
1 0 11 – 0 = 1
1 – 1 = 0
Subtract a borrow if existsSubtract a borrow if exists
(ex)10000
11
1 1 1 1 borrow1110110011
1 borrow
• Multiplication and division are done in the same manner as
111101
-100111010
-
Multiplication and division are done in the same manner as decimal(ex) 1011
101)101 110111
1011
1011011011
00001011
) 101 111 101
101
20
1011110111
101 101 0
* Binary codesC d f bi i i hi h diff bi Code – a set of n-bit strings in which different bit strings represent different numbers or other things (e.g., characters) (e.g., characters)
Binary codes for decimal digitsy gComputers work internally with binary numbersPeople prefer to deal with decimal numbers
l f A decimal number is represented by a string of bits
Decimalinput
Decimaloutput
Computer(binary operation)
encode decode
21
* Examples of binary codes for decimal digits decimal digit BCDdecimal digitsBCD (Binary-Coded-Decimal) aka 8421 code
g
0 0000
1 0001Encodes the digits 0 through 9 by 4-bit binary representations, 0000 through 1001
2 0010
3 0011through 1001Code words 1010 through 1111 are not used
4 0100
5 01014 bit weighted code
(cf) weighted code
6 0110
7 0111(cf) weighted code
weight : w3w2w1w0
code : a3a2a1a0
8 1000
9 10013 2 1 0
decimal number:
N = w3a3 + w2a2 + w1a1 + w0a0
22
(ex) 273 0010 0111 0011 =(273)10
Gray codeO l bit h b t h i f i d dOnly one bit changes between each pair of successive code wordsNot weighted codeReflected codeReflected code1 bit gray code : 0 12 bit gray code :
00 01 11 10
3 bit gray code :reflected
000 001 011 010 110 111 101 100
Gray code for decimal digits (4bits)0000 0001 0011 0010 0110 1110 1010 1011 1001 1000
23
Other binary codes6311 d i ht d d6311 code : weighted code
(cf) Is it possible to construct 6211 code? No! Why?
Excess 3 code : BCD + 0011 not weighted codeExcess-3 code : BCD + 0011, not weighted code
2 out of 5 code : 2 out of 5bits are 1, useful for error checking, not weighted codeg, g
2421, 84-2-1, etc.
Decimal digit 6311code Excess-3 code0 0000 00111 0001 01002 0011 01012 0011 01013 0100 01104 0101 0111
111 1
Self-complementary
d5 0111 10006 1000 10017 1001 1010
code
24
8 1011 10119 1100 1100
* Alphanumeric codes : represent numbers, characters, and symbolssymbols
(ex) ASCII, EBCDIC
ASCII (American Standard Code for Info Interchange)Uses seven bits to code 128 characters (numbers, letters, Uses seven bits to code 128 characters (numbers, letters, special characters)
Cf: Parity bit –(7-bit ASCII code) + (1 parity bit)
E i l # f 1 i Even parity: total # of 1s is evenOdd parity: total # of 1s is odd
(Ex) even parity odd parity(Ex) even parity odd parity1000001 01000001 11000001
Helpful in detecting errors during transmission of info
25
Helpful n detect ng errors dur ng transm ss on of nfo