Upload
son2483
View
6
Download
1
Embed Size (px)
DESCRIPTION
212416587-Chuong-1-Ma-Hoa-Kenh
Citation preview
CHƯƠNG 1: MÃ HÓA KÊNH
Đặng Lê Khoa
Email: [email protected]
Facuty of Electronics & Telecommunications, HCMUS
1
Nội dung trình bày:
Mã hóa kênh ( Channel coding ) Mã hóa khối (Block codes)
+ Mã lập (Repetition Code)
+ Hamming codes
+ Cyclic codes
* Reed-Solomon codes Mã hóa chập (Convolutional codes)
+ Encode
+ Decode Điều chế mã lưới (Trellis Coded Modulation)
2
Sơ đồ khối DCS
FormatSourceencode
FormatSourcedecode
Channelencode
Pulsemodulate
Bandpassmodulate
Channeldecode
Demod. SampleDetect
Channel
Digital modulation
Digital demodulation
3
Channel coding là gì?
• Tín hiệu truyền qua kênh truyền sẽ bị ảnh hưởng bởi nhiễu, can nhiễu, fading… là tín hiệu đầu thu bị sai.
• Mã hóa kênh: dùng để bảo vệ dữ liệu không bị sai bằng cách thêm vào các bit dư thừa (redundancy).
• Ý tưởng mã hóa kênh là gởi một chuỗi bit có khả năng sửa lỗi
• Mã hóa kênh không làm giảm lỗi bit truyền mà chỉ làm giảm lỗi bit dữ liệu (bảng tin)
• Có hai loại mã hóa kênh cơ bản là: Block codes và Convolutional codes
4
Các loại mã hóa sửa sai
Mã lập (Repetition Code) Mã khối tuyến tính (Linear Block Code), e.g.
Hamming Mã vòng (Cyclic Code), e.g. CRC BCH và RS Code Mã chập (Convolutional Code)
Truyền thống, giải mã Viterbi Mã Turbo Mã LDPC
Coded Modulation TCM BICM
5
Mã lập
Recovered state
6
Kiểm tra chẵn lẻ (Parity Check)
Thêm 1 bit để xor các bit có kết quả là 0 Dữ liệu truyền, sửa lỗi, không thể sửa lỗi
Kiểm tra hàng và cột
Ứng dụng: ASCII, truyền dữ liệu qua cổng nối tiếp
7
Mã khối tuyến tính (Linear block codes)
Chuỗi bit thông tin được chia thành từng khối k bit. Mỗi khối được encode thành từng khối lớn hơn có
n bit. Các bit được mã hóa và gửi trên kênh truyền. Quá trình giải mã được thực hiện ở phía thu.
Data blockChannelencoder Codeword
k bits n bits
rate Code
bits Redundant
n
kR
n-k
c
8
Linear block codes – cont’d
Khoảng cách Hamming giữa hai vector U và V, là số các phần tử khác nhau.
Khoảng các tối thiểu của mã hóa khối là
Ví dụ: Tính khoảng cách Hamming của C1: 101101 và C2 :001100
Giải: Vì =>d12=W(1000001)=2
=> Ta có thể giải mã để sửa sai bằng cách chọn codewords có dmin
)()( VUVU, wd
)(min),(minmin ii
jiji
wdd UUU
100001001100101101
9
Linear block codes – cont’d
Khả năng phát hiện lỗi được cho bởi:
Khả năng sửa lỗi t của mã hóa được định nghĩa là số lỗi tối đa có thể sửa được trên 1 từ mã (codeword)
2
1mindt
1min de
10
Linear block codes – cont’d
Encoding trong bộ mã hóa khối (n,k)
Các hàng của G thì độc lập tuyến tính.
mGU
kn
k
kn
mmmuuu
mmmuuu
VVV
V
V
V
2221121
2
1
2121
),,,(
),,,(),,,(
11
Linear block codes – cont’d
Example: Block code (6,3)
1
0
0
0
1
0
0
0
1
1
1
0
0
1
1
1
0
1
3
2
1
V
V
V
G
1
1
1
1
1
0
0
0
0
1
0
1
1
1
1
1
1
0
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
1
0
Message vector Codeword
12
Linear block codes – cont’d
Mã hóa khối (n,k) k phần tử đầu tiên (hoặc cuối cùng) trong từ mã là các
bit thông tin.
matrix )(
matrixidentity
][
knk
kk
k
k
k
P
I
IPG
),...,,,,...,,(),...,,(
bits message
21
bitsparity
2121 kknn mmmpppuuu U
13
Linear block codes – cont’d
Đối với bất kỳ mã hóa khối tuyến tính, chúng ta có một ma trận . Các hàng của ma trận này trực giao với ma trận :
H được gọi là ma trận kiểm tra parity và các hàng của chúng độc lập tuyến tính.
Đối với mã hóa khối truyến tính:
nkn )(HG
0GH T
][ Tkn PIH
14
Linear block codes – cont’d
Kiểm tra đặc trưng: S là đặc trưng của r, tưng ứng với error pattern e.
FormatChannel encoding
Modulation
Channeldecoding
FormatDemodulation
Detection
Data source
Data sink
U
r
m
m̂
channel
or vectorpattern error ),....,,(
or vector codeword received ),....,,(
21
21
n
n
eee
rrr
e
reUr
TT eHrHS
15
Linear block codes – cont’d
Mảng tiêu chuẩn Hàng được tạo thành bằng cách cộng U
với pattern
kknknkn
k
k
22222
22222
221
UeUee
UeUee
UUU
zero codeword
coset
coset leaders
kni 2,...,3,2ie
16
Linear block codes – cont’d
Mảng tiêu chuẩn và đặc trưng bảng giải mã1. Tính
2. Tìm coset chính , tưng ứng với .
3. Tính và tưng ứng với .
Chú ý:• Nếu , error được sửa.• Nếu , bộ giải mã không thể phát hiện lỗi.
TrHS ieeˆ S
erU ˆˆ m̂
)ˆˆ(ˆˆ e(eUee)UerU
eeˆeeˆ
17
Linear block codes – cont’d
Ví dụ: Mảng chuẩn cho mã (6,3)
010110100101010001
010100100000
100100010000
111100001000
000110110111011010101101101010011100110011000100
000101110001011111101011101100011000110111000010
000110110010011100101000101111011011110101000001
000111110011011101101001101110011010110100000000
Coset leaders
coset
codewords
18
Linear block codes – cont’d
111010001
100100000
010010000
001001000
110000100
011000010
101000001
000000000
(101110)(100000)(001110)ˆˆ
estimated is vector corrected The
(100000)ˆ
is syndrome this toingcorrespondpattern Error
(100)(001110)
:computed is of syndrome The
received. is (001110)
ted. transmit(101110)
erU
e
HrHS
r
r
U
TT
Error pattern Syndrome
19
Hamming codes Là trường hợp riêng của linear block codes Diễn tả theo hàm của một số nguyên .
Hamming codes
2m
t
mn-k
mk
nm
m
1 :capability correctionError
:bitsparity ofNumber
12 :bitsn informatio ofNumber
12 :length Code
20
Hamming codes
Example: Systematic Hamming code (7,4)
][
1011100
1101010
1110001
33TPIH
][
1000111
0100011
0010101
0001110
44
IPG
21
Mã hóa Hamming
Mã hóa: H(7,4)
Nhiều phép kiểm tra tổngMessage=[a b c d]
r= (a+b+d) mod 2
s= (a+b+c) mod 2
t= (b+c+d) mod 2
Code=[r s a t b c d]
Tốc độ mã: 4/7 Càng nhỏ, nhiều redundance bit, được bảo vệ tốt hơn. Khác biệt giữa phát hiện và sửa lỗi
Message=[1 0 1 0] r=(1+0+0) mod 2 =1
s=(1+0+1) mod 2 =0
t=(0+1+0) mod 2 =1
Code=[ 1 0 1 1 0 1 0 ]
22
Hamming codes
Example: Systematic Hamming code (7,4)
][
1011100
1101010
1110001
33TPIH
][
1000111
0100011
0010101
0001110
44
IPG
23
Ví dụ mã hóa Hamming
H(7,4) Ma trận sinh G: đầu tiên là ma trận đơn vị 4x4 Dữ liệu truyền là vector p Vector truyền x (G=[I/P])
Vector nhận r và vector lỗi e
24
Sửa lỗi Nếu không có lỗi, vector đặc trưng (syndrome) z=zeros
Nếu có 1 lỗi ở vị trí thứ 2
Vector đặc trưng z là
tương với cột thứ 2 của H. Vậy, lỗi đuợc phát hiện ở vị trí thứ 2 và có thể sửa lại cho đúng.
25
Độ lợi mã hóa (Coding Gain)
Tốc độ mã R=k/n, k: số symbol dữ liệu, n tổng symbol
SNR từ và SNR của bit
Với một sơ đồ mã hóa, độ lợi mã hóa tại một sắc xuất lỗi bit được định nghĩa là sự khác biệt giữa năng lượng cần thiết cho 1 bit thông tin đã mã hóa để đạt được sắc xuất lỗi cho trước và truyền dẫn không mã hóa
26
Ví dụ độ lợi mã hóa
27
Example of the block codes
8PSK
QPSK
[dB] / 0NEb
BP
28
Cyclic code
Cyclic codes được quan tâm và quan trọng vì Dựa trên cấu trúc đại số và có thể ứng dụng rộng
rãi. Dễ dàng thực hiện bằng thanh ghi dịch (shift register) Được ứng dụng rộng rãi trong thực nghiệm
Trong thực nghiệm, cyclic codes được sử dụng để phát hiện lỗi (Cyclic redundancy check, CRC) Được sử dụng trong mạng chuyển mạch gói Khi có 1 lỗi được phát hiện ở bộ nhận, chúng sẽ
được yêu cầu truyền lại. ARQ (Automatic Repeat-reQuest)
29
Cyclic block codes
Một mã tuyến tính (n,k) được gọi là Cyclic code nếu khi dịch vòng 1codeword thì đó cũng là codeword.
Ví dụ:
),...,,,,,...,,(
),...,,,(
121011)(
1210
inninini
n
uuuuuuu
uuuu
U
U “i” cyclic shifts of U
UUUUU
U
)1101( )1011( )0111( )1110(
)1101()4()3()2()1(
30
Cyclic block codes
Cấu trúc đại số của Cyclic codes, suy ra codewords được sinh ra từ
Mối quan hệ giữa codeword và thanh ghi dịch:
Vậy:
)1( degree ...)( 11
2210 n-XuXuXuuX n
n
U
)1()(
...
...,)(
1)1(
)1(
11
)(
12
2101
11
22
10
1)1(
nn
Xu
nn
n
X
nnn
nn
nn
XuX
uXuXuXuXuu
XuXuXuXuXX
nn
U
U
U
)1( modulo )()()( nii XXXX UUBy extension
)1( modulo )()()1( nXXXX UU
31
Cyclic block codes
Thuật toán mã hóa Cyclic code (n,k):1. Nhân thông tin với chuỗi bằng
2. Chia kết quả bước 1 với đa thức sinh . Lấy là phần dư
3. Thêm vào để tạo thành codeword
)(Xm knX
)(Xg)(Xp
)(Xp )(XX kn m
)(XU
32
Cyclic block codes
Example: For the systematic (7,4) Cyclic code with generator polynomial
1. Find the codeword for the message
)1 1 0 1 0 0 1(
1)()()(
:polynomial codeword theForm
1)1()1(
:(by )( Divide
)1()()(
1)()1011(
3 ,4 ,7
bits messagebitsparity
6533
)(remainder generator
3
quotient
32653
6533233
32
U
mpU
gm
mm
mm
pgq
XXXXXXX
XXXXXXXX
X)XX
XXXXXXXXXX
XXX
knkn
X(X)(X)
kn
kn
)1011(m
31)( XXX g
33
Cyclic block codes
Find the generator and parity check matrices, G and H, respectively.
1011000
0101100
0010110
0001011
)1101(),,,(1011)( 321032
G
g ggggXXXX
Not in systematic form.We do the following:
row(4)row(4)row(2)row(1)
row(3)row(3)row(1)
1000101
0100111
0010110
0001011
G
1110100
0111010
1101001
H
44I33I TP
P
34
Cyclic block codes
Giải mã Cyclic code: Từ mã ở bộ thu được cho bởi
Đặc trưng ở phần dư có được bằng cách chia chuỗi nhận cho đa thức sinh:
Với đặc trưng và mảng tiêu chuẩn, lỗi sẽ được ước lượng.
)()()( XXX eUr Received codewor
d
Error pattern
)()()()( XXXX Sgqr Syndrome
35
Ví dụ CRC
36
Checking for errors
37
Khả năng của CRC
Một lỗi E(X) không thể phát hiện khi chúng chia hết cho G(x). Ngược lại, thì có thể phát hiện lỗi.
Có khả năng mạnh mẽ trong phát hiện lỗi
38
BCH Code
Bose, Ray-Chaudhuri, Hocquenghem Có khả năng sửa được nhiều lỗi Dễ dàng thực hiện mã hóa và giải mã
Các chuẩn trong công nghiệp
- (511, 493) mã hóa BCH trong ITU-T. Chuẩn H.261- một chuẩn mã hóa video được sử dụng cho video conferencing và video phone. (40, 32) mã hóa BCH trong ATM (Asynchronous
Transfer Mode)
39
BCH Performance
40
Reed-Solomon Codes
Một trường hợp riêng của non-binary BCH Được ứng dụng rộng rãi
Storage devices (tape, CD, DVD…) Wireless or mobile communication Satellite communication Digital television/Digital Video Broadcast(DVB) High-speed modems (ADSL, xDSL…)
41
Giới thiệu Convolutional Code
Convolutional code tạo ra từ mã bằng cách nhân chập chuỗi bit thông tin với chuỗi phát (generator)
Mã hóa K bit thông tin thành từ mã N bit (N>K) ở mỗi bước thời gian (lần dịch)
42
Encoder Convolutional code được yêu cầu thực hiện đơn giản trong các ứng
dụng. Chúng hoạt động thành các luồng (stream) (not in blocks) Convolution code có nhớ và được tận dụng các bit trước đó để mã
hóa và các bit sau để giải mã (block codes không dùng bộ nhớ) Convolutional code được biểu diễn (n,k,L), với L là mã hóa (or
encoder) Memory depth (number of register stages) Constraint length C=n(L+1) được định nghĩa là số các bit được mã
hóa của một bit thông tin có liên quan
43
Example Convolutional encoder, k = 1, n = 2, L=2
Convolutional encoder là một finite state machine (FSM) xử lý các bit thông tin thành 1 chuỗi nối tiếp
Mã được phát ra như là một hàm của ngõ vào và trạng thái của FSM
Ví dụ bộ mã hóa (n,k,L) = (2,1,2) của mỗi bit thông tin bao gồm C= n(L+1)=6 bit ngõ ra liên tục = constraint length C
Ví dụ, ngõ ra có n-bit, chúng ta cần n thanh ghi dịch cho bộ mã hóa
44
Example: Using generator matrix
(1)
( 2)
[1 0 11]
[111 1]
g
g
45
Example of exhaustive maximal likelihood detection Giả sử có 3 bit thông tin được truyền [và mã hóa
theo phương pháp (2,1,2)]. Hai bit ‘0’ được thêm vào cuối cùng của chuỗi bit thông tin. Vậy 5 bit được mã hóa và sinh ra mã 10 bit. Giả sử kênh truyền có xác suất lỗi là p = 0.1. Dữ liệu sau kênh truyền 10,01,10,11,00 (bao gồm lỗi). Khảo sát bộ giải mã:
a
b
c
d
states
decoder outputsif this path is selected
46
Note also the Hamming distances!
correct:1+1+2+2+2=8;8 ( 0.11) 0.88
false:1+1+0+0+0=2;2 ( 2.30) 4.6
total path metric: 5.48
The largest metric, verifythat you get the same result!
47
The Viterbi algorithm
Problem of optimum decoding is to find the minimum distance path from the initial state back to initial state (below from S0 to S0). The minimum distance is the sum of all path metrics
that is maximized by the correct path Exhaustive maximum likelihood
method must search all the paths in phase trellis (2k paths emerging/entering from 2 L+1 states for an (n,k,L) code)
The Viterbi algorithm gets itsefficiency via concentrating intosurvivor paths of the trellis
0ln ( , ) ln ( | )jm j mjp p y x
y x
Received codesequence
Decoder’s output sequencefor the m:th path
48
The survivor path
Assume for simplicity a convolutional code with k=1, and up to 2k = 2 branches can enter each state in trellis diagram
Assume optimal path passes S. Metric comparison is done by adding the metric of S into S1 and S2. At the survivor path the accumulated metric is naturally smaller (otherwise it could not be the optimum path)
For this reason the non-survived path canbe discarded -> all path alternatives need notto be considered
Note that in principle whole transmittedsequence must be received before decision.However, in practice storing of states for input length of 5L is quite adequate
2 branches enter each nodek
2 nodes, determined L
by memory depth
49
Example of using the Viterbi algorithm
Assume the received sequence is
and the (n,k,L)=(2,1,2) encoder shown below. Determine the Viterbi decoded output sequence!
01101111010001y
(Note that for this encoder code rate is 1/2 and memory depth L = 2)
states
50
The maximum likelihood path
The decoded ML code sequence is 11 10 10 11 00 00 00 whose Hamming distance to the received sequence is 4 and the respective decoded sequence is 1 1 0 0 0 0 0 (why?). Note that this is the minimum distance path.(Black circles denote the deleted branches, dashed lines: '1' was applied)
(1)
(1)
(0)
(2)
(1)
(1)
1
1
Smaller accumulated metric selected
First depth with two entries to the node
After register length L+1=3branch pattern begins to repeat
(Branch Hamming distancesin parenthesis)
51
Turbo Codes
Backgound Turbo codes were proposed by Berrou and Glavieux
in the 1993 International Conference in Communications.
Performance within 0.5 dB of the channel capacity limit for BPSK was demonstrated.
Features of turbo codes Parallel concatenated coding Recursive convolutional encoders Pseudo-random interleaving Iterative decoding
52
Motivation: Performance of Turbo Codes
Comparison: Rate 1/2 Codes. K=5 turbo code. K=14
convolutional code.
Plot is from: L. Perez, “Turbo Codes”,
chapter 8 of Trellis Coding by C. Schlegel. IEEE Press, 1997
Gain of almost 2 dB!
Theoretical Limit!
53
The Turbo-Principle
Turbo codes get their name because the decoder uses feedback, like a turbo engine.
54
Performance as a Function of Number of Iterations
K=5, r=1/2, L=65,536
0.5 1 1.5 210
-7
10-6
10-5
10-4
10-3
10-2
10-1
100
Eb/N
o in dB
BE
R
1 iteration
2 iterations
3 iterations6 iterations
10 iterations
18 iterations
55
Turbo Code Summary
Turbo code advantages: Remarkable power efficiency in AWGN and flat-fading
channels for moderately low BER. Deign tradeoffs suitable for delivery of multimedia
services. Turbo code disadvantages:
Long latency. Poor performance at very low BER. Because turbo codes operate at very low SNR, channel
estimation and tracking is a critical issue. The principle of iterative or “turbo” processing can
be applied to other problems. Turbo-multiuser detection can improve performance of
coded multiple-access systems.56
Trellis Coded Modulation
1. Combine both encoding and modulation. (using Euclidean distance only)
2. Allow parallel transition in the trellis.
3. Has significant coding gain (3~4dB) without bandwidth compromise.
4. Has the same complexity (same amount of computation, same decoding time and same amount of memory needed).
5. Has great potential for fading channel.
6. Widely used in Modem
57
Set Partitioning
1. Branches diverging from the same state must have the largest distance.
2. Branches merging into the same state must have the largest distance.
3. Codes should be designed to maximize the length of the shortest error event path for fading channel (equivalent to maximizing diversity).
4. By satisfying the above two criterion, coding gain can be increased.
58
Coding Gain
About 3dB
59
EE 552/452 Spring 2007
Homework
7.2 7.7 7.9 7.11
60
EE 552/452 Spring 2007
Reference
1. Theodore S.Rappaport, Wireless Communications: Principles and Practice, Prentice Hall P T R, USA, 1996
61
EE 552/452 Spring 2007
Questions?
62