Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 17 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
17
Dung lượng
1,17 MB
Nội dung
8/13/13
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. LeDung - School of Electronics and Telecommunications
Page 2
8/13/13
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. LeDung - 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. LeDung - School of Electronics and Telecommunications
Page 4
8/13/13
3
1.1 Binary System
Decimal System
Dr. LeDung - 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.28
10
= 1•10
3
+ 9•10
2
+ 7•10
1
+ 4•10
0
+ 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. LeDung - 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)
8/13/13
4
1.1 Binary System
Counting in Decimal System
Dr. LeDung - School of Electronics and Telecommunications
Page 7
+ Based on the order {01 23456789}
+ 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. LeDung - School of Electronics and Telecommunications
Page 8
+ Two ordered symbols (2 bits) = {0,1} radix=2 (Binary)
+ Binary number
B = 1011.101
2
= 1•2
3
+ 0•2
2
+ 1•2
1
+ 1•2
0
+ 1•2
-1
+ 0•2
-2
+ 1•2
-3
= 11.625
10
r (radix) = 2, a
i
= digit (0 ≤ a
i
≤ 1)
+ Binary counting {0 1}
{00 01 10 11}
{000 001 ….111}
{0000 0001 … 1111}
8/13/13
5
1.1 Binary System
Why do we use the binary system ?
Dr. LeDung - 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. LeDung - 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.1E
16
= 2•16
2
+ 13•16
1
+ 12•16
0
+ 1•16
-1
+ 14•16
-2
Disadvantage of Binary System ?
- Not easy to read and remember Hexadecimal system
radix = 16 (Hexadecimal system) Why ?.
8/13/13
6
1.1 Binary System
Dr. LeDung - 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. LeDung - School of Electronics and Telecommunications
Page 12
Addition
1 + 1 = 0 carry 1 = 10
2
Binary addition table
Add two binary numbers
8/13/13
7
1.2 Binary Arithmetic
Dr. LeDung - 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
111 0 1
1111
111 0
0 111 0
-
Note: A – B = A + (-B) that means Sub Add
1.2 Binary Arithmetic
Dr. LeDung - 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
8/13/13
8
1.2 Binary Arithmetic
Dr. LeDung - 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 111 0 1 0
0 0 0 0
111 0
1 0 0 1 0 1 0
111 0
1 0 0 1 0
111 0
1 0 0 1 0
111 0
1 0 0
11 0 1
Quotient
Dividend
Remainder
Divisor
-
-
-
1.3 Sign Number Representation
Dr. LeDung - 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
8/13/13
9
1.3 Sign Number Representation
Dr. LeDung - 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 -(2
n-1
-1) and +(2
n-1
-1)
0011 +3
1011 -3
0110
1110 -6
+
Carry
error
1.3 Sign Number Representation
Dr. LeDung - 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
8/13/13
10
1.3 Sign Number Representation
Dr. LeDung - School of Electronics and Telecommunications
Page 19
Two’s Complement System
Radix-complement D* of a number D with n digits is
D* = r
n
– D D* + D = r
n
Eg. The 2-complement of D = 0011
2
is
D* = 2
4
- 3 = 13 = 1101
2
0011 +3
1101 (+3)
2-complement
11110
0000 0
+
Carry
Ok
represents (-3)
Two’s Complement Calculation ?
1.3 Sign Number Representation
Dr. LeDung - 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
[...]... + 00000 011 0 +6 0 010 +2 11 00 - 4 + 00000 11 10 - 2 11 10 - 2 11 00 - 4 + 11 000 10 10 - 6 0 010 +2 10 11 (+4)’ 0 011 1 + 11 10 - 2 0 010 +2 0 011 (- 4)’ 0 011 1 + 011 0 +6 11 10 - 2 0 011 (- 4)’ 11 111 + 0 010 +2 011 1 +7 011 0 +6 011 00 + 11 01 - 3 10 01 - 7 10 10 - 6 10 000 + 0 011 +3 Dr LeDung - School of Electronics and Telecommunications Page 22 11 8 /13 /13 1. 3 Sign Number Representation Summary of Two’s Complement Addition... Decimal (BCD) Coding 10 decimal digits by 4 bits DCBA DCBA Problem : Add two BCD codes ? Dr LeDung - School of Electronics and Telecommunications Page 26 13 8 /13 /13 1. 6 Character Codes American Standard Code for Information Interchange (ASCII 7-bit code) Unicode Dr LeDung - School of Electronics and Telecommunications Page 27 1. 7 Gray Code 00 01 11 10 10 11 01 00 Two consecutive... information Encoding (ADC, DAC) Dr LeDung - School of Electronics and Telecommunications Page 30 15 8 /13 /13 1. 9 Other Code Voice Encoding (Pulse Code Modulation) Dr LeDung - School of Electronics and Telecommunications Page 31 1.9 Other Code Image Encoding (Raster Image Pixels) Pixels Dr LeDung - School of Electronics and Telecommunications Page 32 16 8 /13 /13 1. 9 Other Code Video Encoding...8 /13 /13 1. 3 Sign Number Representation Two’s Complement System MSB +N = 0 Magnitude = absolute value of N 2-complement calculation -N = 1 N - integer with n bits lies between -(2n -1- 1) and +(2n -1- 1) Dr LeDung - School of Electronics and Telecommunications Page 21 1.3 Sign Number Representation Add and Sub in Two’s Complement System Addition Subtraction A+(B)’ +1 Overflow 0 010 +2 010 0 +4... Subtraction Dr LeDung - School of Electronics and Telecommunications Page 23 1. 4 Real Number Code Coding the position of the radix point Fixed-point Floating-point Scientific notation Dr LeDung - School of Electronics and Telecommunications Page 24 12 8 /13 /13 1. 4 Real Number Code Computer floating-point number Dr LeDung - School of Electronics and Telecommunications Page 25 1. 5 Binary Coded... differ in only 1 bit (distance = 1) Why do we use the gray code ? Dr LeDung - School of Electronics and Telecommunications Page 28 14 8 /13 /13 1. 8 Error Detection Code Error Correction Code Error ? Error Control: Error Detection and Error Correction Party Code Hamming Code Cyclic Redundancy Code (CRC -16 , CRC-32) Dr LeDung - School of Electronics and Telecommunications Page 29 1. 9 Other Code... Electronics and Telecommunications Page 32 16 8 /13 /13 1. 9 Other Code Video Encoding (Frames) Frames Frames Frames Dr LeDung - School of Electronics and Telecommunications Page 33 1. 9 Other Code ADC – Analog to Digital Converter Dr LeDung - School of Electronics and Telecommunications Page 34 17 . 11 10 - 2 11 00 - 4 11 000 10 10 - 6 + 0 010 +2 10 11 (+4)’ 0 011 1 11 10 - 2 Subtraction A+(B)’ +1 + 0 010 +2 0 011 (- 4)’ 0 011 1 011 0 +6 + 11 10 - 2 0 011 (- 4)’ 11 111 0 010 +2 + 011 1. + 011 1 +7 011 0 +6 011 00 11 01 - 3 Overflow + 10 01 - 7 10 10 - 6 10 000 0 011 +3 + 8 /13 /13 12 1. 3 Sign Number Representation Dr. Le Dung - School of Electronics and Telecommunications. value of N 10 10 - 2 11 00 - 4 10 000 011 0 +6 + Carry error N - integer with n bits lies between -(2 n -1 -1) and +(2 n -1 -1) 0 011 +3 10 11 -3 011 0 11 10 -6 + Carry error 1. 3 Sign