1+ function a_hat = PUCCH_decoder(f_tilde , A , L , min_sum )
2+ % PUCCH_DECODER Physical Uplink Control Channel (PUCCH) polar decoder from 3GPP New
3+ % Radio, as specified in Section 6.3.1 of TS 38.212 v1.1.1
4+ % a_hat = PUCCH_DECODER(f_tilde, A, L, min_sum) decodes the encoded LLR sequence
5+ % f_tilde, in order to obtain the recovered information bit sequence
6+ % a_hat.
7+ %
8+ % f_tilde should be a real row vector comprising E number of Logarithmic
9+ % Likelihood Ratios (LLRS), each having a value obtained as LLR =
10+ % ln(P(bit=0)/P(bit=1)).
11+ %
12+ % A should be an integer scalar. It specifies the number of bits in the
13+ % information bit sequence, where A should be less than E.
14+ %
15+ % L should be a scalar integer. It specifies the list size to use during
16+ % Successive Cancellation List (SCL) decoding.
17+ %
18+ % min_sum shoular be a scalar logical. If it is true, then the SCL
19+ % decoding process will be completed using the min-sum approximation.
20+ % Otherwise, the log-sum-product will be used. The log-sum-product gives
21+ % better error correction capability than the min-sum, but it has higher
22+ % complexity.
23+ %
24+ % a_hat will be a binary row vector comprising A number of bits, each
25+ % having the value 0 or 1.
26+ %
27+ % See also PUCCH_ENCODER
28+ %
29+ % Copyright © 2017 Robert G. Maunder. This program is free software: you
30+ % can redistribute it and/or modify it under the terms of the GNU General
31+ % Public License as published by the Free Software Foundation, either
32+ % version 3 of the License, or (at your option) any later version. This
33+ % program is distributed in the hope that it will be useful, but WITHOUT
34+ % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35+ % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
36+ % more details.
37+
38+ addpath ' components'
39+
40+ E = length(f_tilde );
41+
42+ % NEED TO ADD SEGMENTATION
43+
44+ % NEED TO CONFIRM CRC
45+
46+ % The CRC polynomial used in 3GPP PUCCH channel is
47+ % D^11 + D^10 + D^9 + D^5 + 1
48+ crc_polynomial_pattern = [1 1 1 0 0 0 1 0 0 0 0 1 ];
49+
50+ % The CRC has P bits. P-min(P2,log2(L)) of these are used for error
51+ % detection, where L is the list size. Meanwhile, min(P2,log2(L)) of
52+ % them are used to improve error correction. So the CRC needs to be
53+ % min(P2,log2(L)) number of bits longer than CRCs used in other codes,
54+ % in order to achieve the same error detection capability.
55+ P = length(crc_polynomial_pattern )-1 ;
56+ P2 = 3 ;
57+
58+ % Determine the number of information and CRC bits.
59+ K = A + P ;
60+
61+ if K - 3 < 12
62+ error(' polar_3gpp_matlab:UnsupportedBlockLength' ,' K-3 should be no less than 12.' );
63+ end
64+
65+ % Determine the number of bits used at the input and output of the polar
66+ % encoder kernal.
67+ N = get_3GPP_N(K ,E ,10 ); % n_max = 10 is used in PUCCH channels
68+
69+ % Get a rate matching pattern.
70+ [rate_matching_pattern , mode ] = get_3GPP_rate_matching_pattern(K ,N ,E );
71+
72+ % Get a sequence pattern.
73+ Q_N = get_3GPP_sequence_pattern(N );
74+
75+ % Perform channel deinterleaving
76+ channel_interleaver_pattern = get_3GPP_channel_interleaver_pattern(E );
77+ e_tilde = zeros(1 ,E );
78+ e_tilde(channel_interleaver_pattern ) = f_tilde ;
79+
80+ if K - 3 <= 22
81+ % Use PC-polar
82+ n_PC = 3 ;
83+
84+ % Get an information bit pattern.
85+ info_bit_pattern = get_3GPP_info_bit_pattern(K + n_PC , Q_N , rate_matching_pattern , mode );
86+
87+ % Get a PC bit pattern.
88+ if E - K + 3 > 192
89+ PC_bit_pattern = get_PC_bit_pattern(info_bit_pattern , Q_N , n_PC , 1 );
90+ else
91+ PC_bit_pattern = get_PC_bit_pattern(info_bit_pattern , Q_N , n_PC , 0 );
92+ end
93+
94+ % Perform polar decoding.
95+ a_hat = PCCA_polar_decoder(e_tilde ,crc_polynomial_pattern ,info_bit_pattern ,PC_bit_pattern ,5 ,rate_matching_pattern ,mode ,L ,min_sum ,P2 );
96+ else
97+ % Use CA-polar
98+
99+ % Get an information bit pattern.
100+ info_bit_pattern = get_3GPP_info_bit_pattern(K , Q_N , rate_matching_pattern , mode );
101+ % Perform polar decoding.
102+ a_hat = CA_polar_decoder(e_tilde ,crc_polynomial_pattern ,info_bit_pattern ,rate_matching_pattern ,mode ,L ,min_sum ,P2 );
103+ end
104+
105+ % SEGMENTATION
0 commit comments