Upload
sayandeep-nag
View
216
Download
0
Embed Size (px)
Citation preview
8/6/2019 eea051-01
1/38
Chapter 1
Binary Systems
September 2005
EEA051 - Digital Logic
8/6/2019 eea051-01
2/38
2
Chapter 1. Binary Systems
1-1 Digital Systems
1-2 Binary Numbers1-3 Number Base Conversions
1-4 Octal and Hexadecimal Numbers
1-5 Complements
1-6 Signed Binary Numbers
1-7 Binary Codes1-8 Binary Storage and Registers
1-9 Binary Logic
8/6/2019 eea051-01
3/38
3
Chapter 1. Binary Systems
Presents the various binary systems
suitable for representing information indigital systems
The binary number system is explainedand binary codes are illustrated
Examples are given for addition and
subtraction of signed binary numbers anddecimal numbers in BCD
8/6/2019 eea051-01
4/38
4
Analog vs. digital
analog continuous digital discrete
the real world is mainly analog
Why digital? digital systems are easier to design
information storage is easy
accuracy and precision is better operation can be programmed
digital circuits are less affected by noise
Example: digital camera
1-1 Digital Systems
8/6/2019 eea051-01
5/38
5
Digital age
Digital systems
telephone switching exchanges
digital camera
electronic calculators, PDA's
digital TV, digital broadcast
Digital computers
many scientific, industrial and commercial applications
Generality
Discrete information-processing systems
Digital Systems
8/6/2019 eea051-01
6/38
6
(ADC)
(DAC)
Typical Control System
8/6/2019 eea051-01
7/38
7
Representing Binary Quantities
8/6/2019 eea051-01
8/38
8
Digital Signals and Timing Diagrams
Signals: physical quantities, e.g. voltages and currents, torepresent discrete elements of information in a digital system predominately implemented by transistors most use just two discrete values, said to be binary
A binary digit, called a bit, has two values: 0 and 1Binary codes: groups of bitsWhy binary?
reliability: a transistor circuit is either on or off (two stable states)
8/6/2019 eea051-01
9/38
9
1-2 Binary Numbers
Numbers system: ana3a2a1a0.a-1a-2a-3 a-m
Decimal number (base or radix = 10) (10 digits)
7,392 = 7*103 + 3*102 + 9*101 + 2*100
Binary number (base = 2)
(11010.11)2 = (26.75)10
8/6/2019 eea051-01
10/38
10
Base-r System
Base-r system (coefficients multiplied by powers of r)
(4021.2)5, (127.4)8, (B65F)16
Base-r Decimal (4021.2)5 = (511.4)10
Octal (127.4)8 = (87.5)10
Hexadecimal (B65F)16=(46,687)10
Binary (110101)2=(53)10
8/6/2019 eea051-01
11/38
11
Binary Numbers
Powers of Two
K(kilo)=210, M(mega)=220, G(giga)=230, T(tera)=240
20, 21, 22, 23, 24, 25, 26, 27, 28,
110101, 100111
8/6/2019 eea051-01
12/38
12
Binary Arithmetic Operations
Arithmetic operations with numbers in base r follow
the same rules as for decimal numbers(discussed later)
8/6/2019 eea051-01
13/38
13
1-3 Number Base Conversions
Decimal Base-r: converting a decimal numberto a number in base r(four examples)
1. Convert decimal 41 to binary: (101001)2
2. Convert decimal 153 to octal: (231)8
3. Convert (0.6875)10 to binary: (0.1011)2
4. Convert (0.513)10 to octal: (0.406517)8
Combining:
(41.6875)10 = (101001.1011)2
(153.513)10 = (231.406517)8
8/6/2019 eea051-01
14/38
14
1-4 Octal and Hexadecimal Numbers
Binary to octal: 23=8
Binary to hexadecimal: 24=16
Octal to binary
Hexadecimal to binaryOctal or hexadecimal representation is more
desirable
8/6/2019 eea051-01
15/38
15
Binary
Octal
Hexadecimal
8/6/2019 eea051-01
16/38
16
1-5 Complements
Used for simplifying the subtraction operation
and for logical manipulation
Two types of complementdiminished radix complement: (r-1)s complement
(rn-1)-N
radix complement: rs complementrn-N
Decimal number
10s complement and 9s complement
Binary number2s complement and 1s complement
8/6/2019 eea051-01
17/38
17
Examples
Diminished Radix Complement
The 9s complement of 546700 is 999999 546700 = 453299
The 9s complement of 012398 is 999999 012398 = 987601The 1s complement of 1011000 is 0100111
The 1s complement of 0101101 is 1010010
Radix Complement
The 10s complement of 546700 is 453300
The 10s complement of 012398 is 987602The 2s complement of 1101100 is 0010100
The 2s complement of 0110111 is 1001001
8/6/2019 eea051-01
18/38
18
Subtraction with rs ComplementsSubtraction of two n-digit unsigned numbers M-N in
base r:
1. Add M to the rs complement of the subtrahend, N:M + (rn N) = sum
2. If M N, the sum will produce an end carry, rn,
which can be discardedM + (rn N) = sum = (M N) + rn,
so M-N = sum - rn
3. If M < N, the sum is the rs complement of (N-M)M + (rn N) = sum = rn (N-M),
so M-N = -(rn-sum)
8/6/2019 eea051-01
19/38
19
Subtraction with (r-1)s Complements
Subtraction of two n-digit unsigned numbers M-N in
base r: Add M to the (r-1)s complement of subtrahend N:
M + ((rn-1) N) = sum
If M N, the sum will produce an end carry, rn,which can be discarded
M + ((rn-1) N) = sum = (M N) + (rn-1),
so M-N = sum rn + 1 (end-around carry) If M < N, the sum is the rs complement of (N-M)
M + ((rn-1) N) = sum = (rn-1) (N-M),
so M-N = -((rn -1) - sum)
8/6/2019 eea051-01
20/38
20
Examples
8/6/2019 eea051-01
21/38
8/6/2019 eea051-01
22/38
22
1-6 Signed Binary NumbersTable 1-3
8/6/2019 eea051-01
23/38
23
Arithmetic Addition
Arithmetic Subtraction(A) (+B) = (A) + (B)
(A) (B) = (A) + (+B)
8/6/2019 eea051-01
24/38
24
1.7 Binary Codes
n-bit binary code
2n distinct combinations
BCD Binary Coded Decimal (4-bit)
(185)10 = (0001 1000 0101)BCD = (10111001)2
(396)10 = (0011 1011 0110)BCD
BCD addition
Get the binary sum
If the sum > 9, add 6 to the sum
Obtain the correct BCD digit sum and a carry
8/6/2019 eea051-01
25/38
25
Number Systems and BCD Code
15
14
13
1211
10
9
8
7
6
5
4
32
1
0
Decimal
1111
1110
1101
11001011
1010
1001
1000
111
110
101
100
1110
1
0
Binary
0001 0011D15
0001 0100E16
0001 0101F17
0001 0010C140001 0001B13
0001 0000A12
1001911
1000810
011177
011066
010155
010044
001133001022
000111
000000
BCDHexadecimalOctal
8/6/2019 eea051-01
26/38
26
BCD Addition
184 + 576 = 760
8/6/2019 eea051-01
27/38
27
Other Decimal Codes
8/6/2019 eea051-01
28/38
28
Gray Code
only one bit change
between two consecutive
numbers
useful in Analog-to-DigitalConverter
8/6/2019 eea051-01
29/38
29
ASCIICharacter
Code
8/6/2019 eea051-01
30/38
30
Error-Detecting Code
Parity bit: an extra bit included with a message tomake the total number of 1s either even or odd
8/6/2019 eea051-01
31/38
31
1.8 Binary Storage and Registers
A binary cell two stable state
store one bit of information examples: flip-flop circuits, ferrite cores,
capacitor
A register a group of binary cells e.g. AX in x86 CPU
Register Transfer a transfer of the information stored in one
register to another one of the major operations in digital system
an example
8/6/2019 eea051-01
32/38
32
Transfer of information
8/6/2019 eea051-01
33/38
33
The other major component of a digital system circuit elements to manipulate individual bits of information
8/6/2019 eea051-01
34/38
34
1.9 Binary Logic
Binary Logic Boolean algebra consists of binary variables and logical operations
Binary variables two discrete values (true/false; yes/no; 1/0) Logical operations
Three basic operations: AND, OR, NOT
8/6/2019 eea051-01
35/38
35
Binary signalsElectrical signals: voltages or
currents
two separate voltage levels: logic-1and logic-0
the intermediate region is crossedonly during state transition
Logic circuits
circuits = logical manipulation paths
Computation and control
combinations of logic circuitsLogic gates
electronic circuits that operate onone or more input signals to produce
an output signal
Logic Gates
8/6/2019 eea051-01
36/38
36
8/6/2019 eea051-01
37/38
37
8/6/2019 eea051-01
38/38
38
SummaryChapter 1. Binary Systems
1-1 Digital Systems1-2 Binary Numbers
1-3 Number Base Conversions
1-4 Octal and Hexadecimal Numbers1-5 Complements
1-6 Signed Binary Numbers
1-7 Binary Codes1-8 Binary Storage and Registers
1-9 Binary Logic