Professional Documents
Culture Documents
P-1/80
Part I
教 師 : 郭 峻 因 教授
INSTRUCTOR : Prof. Jiun-In Guo
E-mail: jiguo@cs.ccu.edu.tw
2008/3/12
課程名稱:數位系統設計導論 P-2/80
Chapter 1
Binary Systems
Outline 2008/3/12
P-4/80
Digital Systems
1. Digital system examples: Digital telephones, digital
TV, DVD, digital cameras (DC), digital videos (DV),
and digital computers.
2. Digital systems: Manipulate discrete data
3. Binary: Numbers are presented by two discrete
values (0 and 1), Binary digit = Bit
4. Group of bits: Binary code
5. Digital systems: A system manipulates discrete
elements of information that is represented
internally binary form.
6. HDL (Hardware description language): A
programming language and suitable for describing
digital circuits in textual form.
1.2 Binary Numbers 2008/3/12
P-7/80
Decimal Number
11010.11=26.75
⇒ 1×24+ 1×23+ 0×22+ 1×21+ 0×20+ 1×2-1+ 1×2-2=26.75
1.2 Binary Numbers 2008/3/12
P-10/80
an⋅ rn + an-1⋅ rn-1 +… + a2⋅ r2 + a1⋅ r + a0 + a-1⋅ r-1 + a-2⋅ r-2 + …+ a-m⋅ r-m
⇒ (4021.2)5 = 4×53+ 0×52+ 2×51+ 1×50+ 2×5-1 = (511.4)10
⇒ (127.4)8 = 1×82+ 2×81+ 7×80+ 4×8-1 = (87.5)10
⇒ (B65F)16 = 11×163+ 6×162+ 5×161+ 15×160 = (46687)10
⇒ (110101)2 = 32+16+4+1 = (53)10
1.2 Binary Numbers 2008/3/12
P-11/80
1. Base-2, Binary
2. Base-8, Octal
3. Base-10, Decimal
4. Base-16, Hexadecimal, (10=A, 11=B, 12=C, D=13, E=14,
F=15)
1.2 Binary Numbers 2008/3/12
P-12/80
Base-2 Power of n
1. 4K=4×210=212
2. 16M=16×220=224
3. 4G=4×230=232
1.2 Binary Numbers 2008/3/12
P-14/80
Augend: 101101
Addend: 100111
Sum: 1010100
1.2 Binary Numbers 2008/3/12
P-15/80
Minuend: 101101
Subtrahend: 100111
Difference: 000110
1.2 Binary Numbers 2008/3/12
P-16/80
Multiplicand: 1011
Multiplier: 101
1011
0000
1011
Product: 110111
1.3 Number Base Conversions 2008/3/12
P-17/80
2 41
2 20 1
2 10 0
2 5 0
2 2 1
2 1 0
0 1 Answer: 1 0 1 0 0 1
1.3 Number Base Conversions 2008/3/12
P-21/80
Conveniently Process:
Decimal (Base-10) to Octal (Base-8)
8 153
8 19 1
8 2 3
0 2 Answer: ( 2 3 1 )8
1.3 Number Base Conversions 2008/3/12
P-22/80
Answer: (0.6875)10=(0.a-1a-2a-3a-4)2=(0.1011)2
1.3 Number Base Conversions 2008/3/12
P-24/80
0.513× 8= 4.104
0.104 × 8= 0.832
0.832 × 8= 6.656
0.656 × 8= 5.248
0.248 × 8= 1.984
0.984 × 8= 7.872
Answer: (0.513)10=(0.406517…)8
1.3 Number Base Conversions 2008/3/12
P-25/80
1. (41.6875)10 = (101001.1011)2
2. (153.513)10 = (231.406517)8
1.4 Octal and Hexadecimal Numbers 2008/3/12
P-26/80
(10 110 001 101 011 . 111 100 000 110)2 = (26153.7406)8
2 6 1 5 3. 7 4 0 6
Complements
Complement
r's Complement
For base-r
r-1's Complement
1.5 Complements 2008/3/12
P-32/80
If
r =10 Ö r-1=9 :
9’s complements of N = (10n-1) - N
1.5 Complements 2008/3/12
P-33/80
rn-N, for N ≠ 0
0, for N = 0
1.5 Complements 2008/3/12
P-37/80
M= 72532
10's complement of N= + 9 6 7 5 0
Sum = 169282
Discard and carry 105= -1 0 0 0 0 0
Answer = 69282
1.5 Complements 2008/3/12
P-42/80
No carry !!
25 (unsigned binary)
11001
-9 (signed binary)
1.6 Signed Binary Numbers 2008/3/12
P-47/80
Signed-magnitude 10001001
-9 Signed-1'sc 11110110
Signed-2'sc 11110111
1.6 Signed Binary Numbers 2008/3/12
P-48/80
(±A)-(+B)=(±A)+(-B)
(±A)-(-B)=(±A)+(+B)
2'sc of -B
1.7 Binary Codes 2008/3/12
P-53/80
Binary Codes
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
1.7 Binary Codes 2008/3/12
P-56/80
Feature of BCD
Example of BCD
BCD Addition
k-digit decimal requires 4k-bits in BCD !!
BCD carry 1 1
0001 1000 0100 184
+0101 0111 0110 +576
Binary Sum 0111 10000 1010
Add 6 0110 0110
BCD Sum 0111 0110 0000 760
1.7 Binary Codes 2008/3/12
P-60/80
Decimal Arithmetic
(395)10
= 0110 1100 1000 (in Exceed-3)
= 1001 0011 0111 (9'sc 604)
1.7 Binary Codes 2008/3/12
P-63/80
Gray Code
Decimal Binary Gray
Code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110 Binary: 0 bn b3 b2 b1 b0
...
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100 Gray Code: gn g3 g2 g1 g0
...
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
1.7 Binary Codes 2008/3/12
P-64/80
Only one bit in the code group changes from one number
to the next !
Only one bit
change !!
For Example 7 ⇒ 8
4 bit change
1.7 Binary Codes 2008/3/12
P-65/80
Error-Detecting Code:
Communication and computation will cause error
Register
Register Transfer
Memory Unit
Sum
0000000000
Operand 1 0011100001
Operand 2
0001000010
Transfer of
Information with 0001000010 R1
Register
Digital logic
circuits for 0100100011 R3
binary addition
0011100001 R2
Processor Unit
1.9 Binary Logic 2008/3/12
P-73/80
Binary Logic
1. 0/1
2. True/False
3. Yes/No
1.9 Binary Logic 2008/3/12
P-75/80
Binary Logic
x y=z
AND or x AND y is equal to z
xy=z
Why?
OR x y=z x OR y is equal to z
x'=z
NOT or NOT x is equal to z
x=z
1.9 Binary Logic 2008/3/12
P-77/80
AND OR NOT
x y x y x y x+y x x’
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
1.9 Binary Logic 2008/3/12
P-78/80
4
Range for Logic 1
3
Transition occurs
between these limits
1
Range for Logic 0
0
1.9 Binary Logic 2008/3/12
P-79/80
x Two Input
z=x y
y AND Gate
x Two Input
z=x+y
y OR Gate
NOT Gate or
x x' Inverter
1.9 Binary Logic 2008/3/12
P-80/80
A
3 Input
B F=A B C
C AND Gate
A 3 Input
B G=A+B+C OR Gate
C
2008/3/12
Exercise P-82/80
• Problem set
– 1.1, 1.4, 1.10, 1.13, 1.14, 1.17, 1.20, 1.25,
1.27, 1.28, 1.34, 1.35
• Deadline
– 2008/03/05