Digital Electronics - Chapter 1: Binary system and Binary Codes - Dr Le Dung

1.1 Binary System

1.2 Binary Arithmetic

1.3 Sign Number Representation

1.4 Real Number Code

1.5 Binary Coded Decimal (BCD)

1.6 Character Code

1.7 Gray Code

1.8 Error Detection Codes and Error Correction Codes

1.9 Other (Information) Codes

pdf15 trang | Chuyên mục: Kỹ Thuật Số | Chia sẻ: tuando | Lượt xem: 387 | Lượt tải: 0download
Tóm tắt nội dung Digital Electronics - Chapter 1: Binary system and Binary Codes - Dr Le Dung, để xem tài liệu hoàn chỉnh bạn click vào nút "TẢI VỀ" ở trên
9/10/12 
1 
Digital Electronics 
- Part I: Digital Principle - 
Dr. Lê Dũng 
Department of Electronics and Computer System (C9-401) 
School of Electronics and Telecommunications 
Hanoi University of Science and Technology 
Email: ledung-fet@mail.hut.edu.vn 
Part I: Digital Principles - Overview 
Boolean 
Functions 
(Boolean Algebra) 
True 
False 
1 
0 
High 
Low 
Basic Logic Gates 
Inverter,AND,OR,NAND,NOR,XOR,XNOR 
Electronic circuits 
(Transistor BJT, Diode, 
Resister, MOS...) Implementation 
Digital System 
Digital 
Integrated 
Circuits 
Information Digitalization 
Logic Level Logic Clause 
Sequential 
Logic Circuits 
Combinational 
Logic Circuits 
Logic Circuits 
Analysis & 
Synthesis 
-  Custom design 
-  Standard cell 
design 
- Gate array 
-  PLA, PLD, FPGA 
-  FSMD design 
- VHDL 
Logic Families 
RTL, DTL, HTL 
TTL, CMOS 
PMOS, NMOS, 
BiMOS, ECL, 
Specifications: 
- Current & Voltages 
- Fan-in, Fan-out 
- Propagation Delay 
- Noise Margin 
- Power Dissipation 
- Speed Power Product 
Open-Collector 
Output 
& 
Tristate Output 
Dr. Le Dung - School of Electronics and Telecommunications Page 2 
9/10/12 
2 
Part I: Digital Principles - Contents 
Chapter 1 : Binary system and Binary Codes 
Chapter 2 : Boolean Algebra 
Chapter 3 : Logic Gates and Digital Integrated Circuits 
Dr. Le Dung - School of Electronics and Telecommunications Page 3 
Binary system and Binary Codes 
Chapter 1 
1.1 Binary System 
1.2 Binary Arithmetic 
1.3 Sign Number Representation 
1.4 Real Number Code 
1.5 Binary Coded Decimal (BCD) 
1.6 Character Code 
1.7 Gray Code 
1.8 Error Detection Codes and Error Correction Codes 
1.9 Other (Information) Codes 
Dr. Le Dung - School of Electronics and Telecommunications Page 4 
9/10/12 
3 
1.1 Binary System 
 Decimal System 
Dr. Le Dung - School of Electronics and Telecommunications Page 5 
+ 10 digits = {0,1,2,3,4,5,6,7,8,9}  radix = 10 (Decimal) 
+ A number 
 D = 1974.2810= 1•103 + 9•102 + 7•101 + 4•100 + 2•10-1 + 8•10-2 
r (radix) = 10 and i (weighted position) runs from -2 to 3 
1.1 Binary System 
 Number System 
Dr. Le Dung - School of Electronics and Telecommunications Page 6 
+ An ordered set of symbols 
+ A number = Positional Notation 
+ Polynomial Notation 
 (with r- radix and i-weighted position) 
9/10/12 
4 
1.1 Binary System 
 Counting in Decimal System 
Dr. Le Dung - School of Electronics and Telecommunications Page 7 
+ Based on the order {01 23456789} 
+ When 9 return 0 at the weighted position (i) 
  a change at the weighted position (i+1) 
 For example: 00  01  02    09 
 10  11  12    19 
 20  21  22    29 
 ... 099  100 
1.1 Binary System 
 Binary System 
Dr. Le Dung - School of Electronics and Telecommunications Page 8 
+ Two ordered symbols (2 bits) = {0,1}  radix=2 (Binary) 
+ Binary number 
 B = 1011.1012 = 1•23 + 0•22 + 1•21 + 1•20 + 1•2-1 + 0•2-2 + 1•2-3 
 = 11.62510 
r (radix) = 2, ai = digit (0 ≤ ai ≤ 1) 
+ Binary counting {0  1} 
 {00  01  10  11} 
 {000  001  .111} 
 {0000  0001    1111} 
9/10/12 
5 
1.1 Binary System 
 Why do we use the binary system ? 
Dr. Le Dung - School of Electronics and Telecommunications Page 9 
Calculating machine (Müller 1784) 
with decimal system 
Because: Two bits {0, 1} can be 
represented more easily by: 
+ Two positions of an 
electrical switch. 
+ Two distinct voltage or 
current levels allowed by a 
circuit. 
+ Two distinct levels of light 
intensity 
+ Two directions of 
magnetization or polarization 
+ . 
1.1 Binary System 
 Hexadecimal System 
Dr. Le Dung - School of Electronics and Telecommunications Page 10 
+ 16 symbols = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,} 
+ Hexadecimal Number 
 2DC.1E16= 2•162 + 13•161 + 12•160 + 1•16-1 + 14•16-2 
 Disadvantage of Binary System ? 
- Not easy to read and remember  Hexadecimal system 
radix = 16 (Hexadecimal system)  Why ?. 
9/10/12 
6 
1.1 Binary System 
Dr. Le Dung - School of Electronics and Telecommunications Page 11 
 Base Conversions 
  Convert to base 10 
  use the polynomial notation with 
radix and weighted positions 
  Convert to base 2 
  use radix divide method for the 
integer part (remainders and quotient) 
  use radix multiply method for the 
fraction part. 
  Convert between base 2 and 16 
  4 bits  1 hexadecimal digit 
1.2 Binary Arithmetic 
Dr. Le Dung - School of Electronics and Telecommunications Page 12 
 Addition 
1 + 1 = 0 carry 1 = 102 
Binary addition table Add two binary numbers 
9/10/12 
7 
1.2 Binary Arithmetic 
Dr. Le Dung - School of Electronics and Telecommunications Page 13 
 Subtraction 
1 - 1 = 0 - 0 = 0 
1 - 0 = 0 
0 - 1 = 1 borrow 1 
A (Minuend) 
B (Subtrahend) 
borrow 
difference 
1 1 1 0 1 
 1 1 1 1 
1 1 1 0 
0 1 1 1 0 
- 
Note: A – B = A + (-B) that means Sub  Add 
1.2 Binary Arithmetic 
Dr. Le Dung - School of Electronics and Telecommunications Page 14 
 Multiplication 
Binary multiplication table Multiply two binary numbers 
Note: - Multiplication by repeated Add & Shift 
 - Can be implemented in a faster way 
9/10/12 
8 
1.2 Binary Arithmetic 
Dr. Le Dung - School of Electronics and Telecommunications Page 15 
 Division 
1 / 1 = 1 
0 / 0 = 0 = 0 / 1 
1 / 0 = undefined 
Note: - Division by repeated Sub & Shift 
1 0 1 1 1 0 1 0 
0 0 0 0 
1 1 1 0 
1 0 0 1 0 1 0 
1 1 1 0 
1 0 0 1 0 
1 1 1 0 
1 0 0 1 0 
1 1 1 0 
1 0 0 
1 1 0 1 Quotient 
Dividend 
Remainder 
Divisor 
- 
- 
- 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 16 
 Sign Number Format 
S 
MSB 
Sign 
= 0  positive + 
= 1  negative - 
N = Representing the magnitude 
 Representing the magnitude 
  Sign magnitude representation 
  Two’s complement system 
9/10/12 
9 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 17 
  Sign-Magnitude representation 
S 
MSB 
N = Magnitude = absolute value of N 
1010 - 2 
1100 - 4 
10000 
0110 +6 
+ 
Carry 
 error 
N - integer with n bits lies 
between -(2n-1-1) and +(2n-1-1) 
0011 +3 
1011 -3 
0110 
1110 -6 
+ 
Carry 
 error 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 18 
  Sign-Magnitude Numbers Addition and Subtraction 
  Sign-magnitude representation leads 
to slow, expensive adder/subtractor 
due to repeated comparison and test 
of sign and magnitude 
  This is why we represent numbers 
mostly using two’s complement 
system 
9/10/12 
10 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 19 
  Two’s Complement System 
Radix-complement D* of a number D with n digits is 
 D* = rn – D  D* + D = rn 
Eg. The 2-complement of D = 00112 is 
 D* = 24 - 3 = 13 = 11012 
0011 +3 
1101 (+3)2-complement 
11110 
0000 0 
+ 
Carry 
Ok 
 represents (-3) 
 Two’s Complement Calculation ? 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 20 
  Two’s Complement System 
Two’s Complement Calculation: 
Algorithm 1: Complement bits then add 1 
Algorithm 2: Copy from LSB to the first 1-bit then 
continue replace the bits with their complement until the 
MSB has been replaced 
9/10/12 
11 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 21 
  Two’s Complement System 
0 
MSB 
+N = Magnitude = absolute value of N 
N - integer with n bits lies 
between -(2n-1-1) and +(2n-1-1) 
1 -N = 
2-complement calculation 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 22 
  Add and Sub in Two’s Complement System 
0010 +2 
0100 +4 
00000 
0110 +6 
Addition 
+ 
0010 +2 
1100 - 4 
00000 
1110 - 2 
+ 
1110 - 2 
1100 - 4 
11000 
1010 - 6 
+ 
0010 +2 
1011 (+4)’ 
00111 
1110 - 2 
Subtraction 
A+(B)’+1 
+ 
0010 +2 
0011 (- 4)’ 
00111 
0110 +6 
+ 
1110 - 2 
0011 (- 4)’ 
11111 
0010 +2 
+ 
0111 +7 
0110 +6 
01100 
1101 - 3 
Overflow 
+ 
1001 - 7 
1010 - 6 
10000 
0011 +3 
+ 
9/10/12 
12 
1.3 Sign Number Representation 
Dr. Le Dung - School of Electronics and Telecommunications Page 23 
  Summary of Two’s Complement Addition and Subtraction 
1.4 Real Number Code 
Dr. Le Dung - School of Electronics and Telecommunications Page 24 
  Coding the position of the radix point 
  Fixed-point 
  Floating-point 
9/10/12 
13 
1.4 Real Number Code 
Dr. Le Dung - School of Electronics and Telecommunications Page 25 
  Computer floating-point number 
1.5 Binary Coded Decimal (BCD) 
Dr. Le Dung - School of Electronics and Telecommunications Page 26 
  Coding 10 decimal digits by 4 bits DCBA 
DCBA 
Problem : Add two BCD codes ? 
9/10/12 
14 
1.6 Character Codes 
Dr. Le Dung - School of Electronics and Telecommunications Page 27 
  American Standard Code for Information Interchange 
 (ASCII 7-bit code) 
  Unicode 
1.7 Gray Code 
Dr. Le Dung - School of Electronics and Telecommunications Page 28 
00  01  11  10 
10  11  01  00 
  Two consecutive number differ 
in only 1 bit (distance = 1) 
Why do we use the gray code ?. 
9/10/12 
15 
1.8 Error Detection Code 
Error Correction Code 
Dr. Le Dung - School of Electronics and Telecommunications Page 29 
  Error ? 
  Error Control: Error Detection and Error Correction 
  Party Code 
  Hamming Code 
  Cyclic Redundancy Code (CRC-16, CRC-32) 
1.9 Other Code 
Dr. Le Dung - School of Electronics and Telecommunications Page 30 
  Voice Encoding (Pulse Code Modulation) 
  Image and Video Encoding (Pixels, Frames) 
  Other information Encoding (ADC, DAC) 

File đính kèm:

  • pdfdigital_electronics_chapter_1_binary_system_and_binary_codes.pdf
Tài liệu liên quan