Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zzha zzha
OpenXG-RAN
Commits
92ba679b
Commit
92ba679b
authored
Jul 13, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop-PUCCH2' into integration_2023_w28
parents
52f21f52
1d6f740c
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
551 additions
and
249 deletions
+551
-249
doc/FEATURE_SET.md
doc/FEATURE_SET.md
+2
-2
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+93
-7
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+27
-6
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+169
-172
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
+235
-53
openair1/PHY/CODING/nr_polar_init.c
openair1/PHY/CODING/nr_polar_init.c
+10
-4
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+14
-1
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
+0
-3
openair2/RRC/NR/nr_rrc_config.c
openair2/RRC/NR/nr_rrc_config.c
+1
-1
No files found.
doc/FEATURE_SET.md
View file @
92ba679b
...
...
@@ -271,7 +271,7 @@ The following features are valid for the gNB and the 5G-NR UE.
-
Support for 256 QAM
*
NR-PUCCH
-
Format 0 (2 bits, for ACK/NACK and SR)
-
Format 2 (
up to 11 bits,
mainly for CSI feedback)
-
Format 2 (mainly for CSI feedback)
*
NR-SRS
-
SRS signal reception
-
Channel estimation (with T tracer real time monitoring)
...
...
@@ -443,7 +443,7 @@ The following features are valid for the gNB and the 5G-NR UE.
-
Support for up to 2 layers
*
NR-PUCCH
-
Format 0 (2 bits for ACK/NACK and SR)
-
Format 2 (
up to 11 bits,
mainly for CSI feedback)
-
Format 2 (mainly for CSI feedback)
-
Format 1 (limited testing)
-
Format 3 and 4 present but old code never tested (need restructuring before verification)
*
NR-SRS
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
92ba679b
...
...
@@ -39,6 +39,8 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "assertions.h"
//#define POLAR_CODING_DEBUG
static
inline
void
updateCrcChecksum2
(
int
xlen
,
int
ylen
,
uint8_t
crcChecksum
[
xlen
][
ylen
],
...
...
@@ -611,24 +613,78 @@ uint32_t polar_decoder_int16(int16_t *input,
uint8_t
aggregation_level
)
{
t_nrPolar_params
*
polarParams
=
nr_polar_params
(
messageType
,
messageLength
,
aggregation_level
,
true
);
#ifdef POLAR_CODING_DEBUG
printf
(
"
\n
RX
\n
"
);
printf
(
"rm:"
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
i
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%i"
,
input
[
i
]
<
0
?
1
:
0
);
}
printf
(
"
\n
"
);
#endif
int16_t
d_tilde
[
polarParams
->
N
];
// = malloc(sizeof(double) * polarParams->N);
nr_polar_rate_matching_int16
(
input
,
d_tilde
,
polarParams
->
rate_matching_pattern
,
polarParams
->
K
,
polarParams
->
N
,
polarParams
->
encoderLength
);
nr_polar_rate_matching_int16
(
input
,
d_tilde
,
polarParams
->
rate_matching_pattern
,
polarParams
->
K
,
polarParams
->
N
,
polarParams
->
encoderLength
,
polarParams
->
i_bil
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
d_tilde
[
i
]
<-
128
)
d_tilde
[
i
]
=-
128
;
else
if
(
d_tilde
[
i
]
>
127
)
d_tilde
[
i
]
=
128
;
}
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],(
void
*
)
&
d_tilde
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
//Extract the information bits (û to ĉ)
uint64_t
Cprime
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
B
[
4
]
=
{
0
,
0
,
0
,
0
};
#ifdef POLAR_CODING_DEBUG
printf
(
"d: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
i
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%i"
,
d_tilde
[
i
]
<
0
?
1
:
0
);
}
printf
(
"
\n
"
);
#endif
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],
(
void
*
)
&
d_tilde
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
memset
(
polarParams
->
nr_polar_U
,
0
,
polarParams
->
N
*
sizeof
(
uint8_t
));
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
Cprime
[
i
>>
6
]
=
Cprime
[
i
>>
6
]
|
((
uint64_t
)
polarParams
->
nr_polar_U
[
polarParams
->
Q_I_N
[
i
]])
<<
(
i
&
63
);
#ifdef POLAR_CODING_DEBUG
printf
(
"u: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
i
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%i"
,
polarParams
->
nr_polar_U
[
i
]);
}
printf
(
"
\n
"
);
#endif
// Extract the information bits (û to ĉ)
uint64_t
Cprime
[
4
]
=
{
0
};
nr_polar_info_extraction_from_u
(
Cprime
,
polarParams
->
nr_polar_U
,
polarParams
->
information_bit_pattern
,
polarParams
->
parity_check_bit_pattern
,
polarParams
->
N
,
polarParams
->
n_pc
);
#ifdef POLAR_CODING_DEBUG
printf
(
"c: "
);
for
(
int
n
=
0
;
n
<
polarParams
->
K
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
Cprime
[
n1
]
>>
n2
)
&
1
);
}
printf
(
"
\n
"
);
#endif
//Deinterleaving (ĉ to b)
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
uint64_t
B
[
4
]
=
{
0
};
if
(
polarParams
->
K
<
65
)
{
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
...
...
@@ -650,6 +706,21 @@ uint32_t polar_decoder_int16(int16_t *input,
}
}
#ifdef POLAR_CODING_DEBUG
int
B_array
=
(
polarParams
->
K
+
63
)
>>
6
;
int
n_start
=
(
B_array
<<
6
)
-
polarParams
->
K
;
printf
(
"b: "
);
for
(
int
n
=
0
;
n
<
polarParams
->
K
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
(
n
+
n_start
)
>>
6
;
int
n2
=
(
n
+
n_start
)
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
B
[
B_array
-
1
-
n1
]
>>
(
63
-
n2
))
&
1
);
}
printf
(
"
\n
"
);
#endif
int
len
=
polarParams
->
payloadBits
;
//int len_mod64=len&63;
int
crclen
=
polarParams
->
crcParityBits
;
...
...
@@ -700,6 +771,21 @@ uint32_t polar_decoder_int16(int16_t *input,
else
if
(
crclen
==
6
)
crc
=
(
uint64_t
)(
crc6
(
A64_flip
,
8
*
offset
+
len
)
>>
26
)
&
0x3f
;
}
#ifdef POLAR_CODING_DEBUG
int
A_array
=
(
len
+
63
)
>>
6
;
printf
(
"a: "
);
for
(
int
n
=
0
;
n
<
len
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
alen
=
n1
==
0
?
len
-
(
A_array
<<
6
)
:
64
;
printf
(
"%lu"
,
(
Ar
>>
(
alen
-
1
-
n2
))
&
1
);
}
printf
(
"
\n\n
"
);
#endif
#if 0
printf("A %llx B %llx|%llx Cprime %llx|%llx (crc %x,rxcrc %llx %d)\n",
Ar,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
92ba679b
...
...
@@ -106,6 +106,7 @@ struct nrPolar_params {
int16_t
*
Q_F_N
;
int16_t
*
Q_PC_N
;
uint8_t
*
information_bit_pattern
;
uint8_t
*
parity_check_bit_pattern
;
uint16_t
*
channel_interleaver_pattern
;
//uint32_t crc_polynomial;
...
...
@@ -238,24 +239,28 @@ void nr_polar_rate_matching(double *input,
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
const
uint16_t
*
rmp
,
const
uint16_t
K
,
const
uint16_t
N
,
const
uint16_t
E
,
const
uint8_t
i_bil
);
void
nr_polar_interleaving_pattern
(
uint16_t
K
,
uint8_t
I_IL
,
uint16_t
*
PI_k_
);
void
nr_polar_info_bit_pattern
(
uint8_t
*
ibp
,
uint8_t
*
pcbp
,
int16_t
*
Q_I_N
,
int16_t
*
Q_F_N
,
uint16_t
*
J
,
int16_t
*
Q_PC_N
,
const
uint16_t
*
J
,
const
uint16_t
*
Q_0_Nminus1
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
,
uint8_t
n_PC
);
uint8_t
n_PC
,
uint8_t
n_pc_wm
);
void
nr_polar_info_bit_extraction
(
uint8_t
*
input
,
uint8_t
*
output
,
...
...
@@ -272,6 +277,22 @@ void nr_byte2bit_uint8_32(uint8_t *in,
const
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
);
void
nr_polar_generate_u
(
uint64_t
*
u
,
const
uint64_t
*
Cprime
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
uint16_t
N
,
uint8_t
n_pc
);
void
nr_polar_uxG
(
uint64_t
*
D
,
const
uint64_t
*
u
,
const
uint64_t
**
G_N_tab
,
uint16_t
N
);
void
nr_polar_info_extraction_from_u
(
uint64_t
*
Cprime
,
const
uint8_t
*
u
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
uint16_t
N
,
uint8_t
n_pc
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
N
,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
92ba679b
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
View file @
92ba679b
...
...
@@ -32,6 +32,117 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
// TS 38.212 - Section 5.3.1.2 Polar encoding
void
nr_polar_generate_u
(
uint64_t
*
u
,
const
uint64_t
*
Cprime
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
uint16_t
N
,
uint8_t
n_pc
)
{
int
N_array
=
N
>>
6
;
int
k
=
0
;
if
(
n_pc
>
0
)
{
uint64_t
y0
=
0
,
y1
=
0
,
y2
=
0
,
y3
=
0
,
y4
=
0
;
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
uint64_t
yt
=
y0
;
y0
=
y1
;
y1
=
y2
;
y2
=
y3
;
y3
=
y4
;
y4
=
yt
;
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
if
(
parity_check_bit_pattern
[
n
]
==
1
)
{
u
[
N_array
-
1
-
n1
]
|=
y0
<<
(
63
-
n2
);
}
else
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
uint64_t
bit
=
(
Cprime
[
k1
]
>>
k2
)
&
1
;
u
[
N_array
-
1
-
n1
]
|=
bit
<<
(
63
-
n2
);
k
++
;
y0
=
y0
^
(
int
)
bit
;
}
}
}
}
else
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
uint64_t
bit
=
(
Cprime
[
k1
]
>>
k2
)
&
1
;
u
[
N_array
-
1
-
n1
]
|=
bit
<<
(
63
-
n2
);
k
++
;
}
}
}
}
void
nr_polar_info_extraction_from_u
(
uint64_t
*
Cprime
,
const
uint8_t
*
u
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
uint16_t
N
,
uint8_t
n_pc
)
{
int
k
=
0
;
if
(
n_pc
>
0
)
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
if
(
parity_check_bit_pattern
[
n
]
==
0
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
}
}
else
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
}
}
void
nr_polar_uxG
(
uint64_t
*
D
,
const
uint64_t
*
u
,
const
uint64_t
**
G_N_tab
,
uint16_t
N
)
{
int
N_array
=
N
>>
6
;
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
const
uint64_t
*
Gn
=
G_N_tab
[
N
-
1
-
n
];
int
n_ones
=
0
;
for
(
int
a
=
0
;
a
<
N_array
;
a
++
)
{
uint64_t
uxG
=
u
[
a
]
&
Gn
[
a
];
for
(
int
m
=
0
;
m
<
64
;
m
++
)
{
if
(((
uxG
>>
m
)
&
1
)
==
1
)
{
n_ones
++
;
}
}
}
uint64_t
bit
=
n_ones
%
2
;
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
D
[
n1
]
|=
bit
<<
n2
;
}
}
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
N
,
...
...
@@ -138,14 +249,17 @@ void nr_polar_channel_interleaver_pattern(uint16_t *cip,
void
nr_polar_info_bit_pattern
(
uint8_t
*
ibp
,
int16_t
*
Q_I_N
,
int16_t
*
Q_F_N
,
uint16_t
*
J
,
const
uint16_t
*
Q_0_Nminus1
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
,
uint8_t
n_PC
)
uint8_t
*
pcbp
,
int16_t
*
Q_I_N
,
int16_t
*
Q_F_N
,
int16_t
*
Q_PC_N
,
const
uint16_t
*
J
,
const
uint16_t
*
Q_0_Nminus1
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
,
uint8_t
n_PC
,
uint8_t
n_pc_wm
)
{
int16_t
*
Q_Ftmp_N
=
malloc
(
sizeof
(
int16_t
)
*
(
N
+
1
));
// Last element shows the final
int16_t
*
Q_Itmp_N
=
malloc
(
sizeof
(
int16_t
)
*
(
N
+
1
));
// array index assigned a value.
...
...
@@ -159,44 +273,44 @@ void nr_polar_info_bit_pattern(uint8_t *ibp,
uint16_t
limit
,
ind
;
if
(
E
<
N
)
{
if
((
K
/
(
double
)
E
)
<=
(
7
.
0
/
16
))
{
//
puncturing
if
((
K
/
(
double
)
E
)
<=
(
7
.
0
/
16
))
{
//
puncturing
for
(
int
n
=
0
;
n
<=
N
-
E
-
1
;
n
++
)
{
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
J
[
n
];
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
J
[
n
];
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
}
if
((
E
/
(
double
)
N
)
>=
(
3
.
0
/
4
))
{
limit
=
ceil
((
double
)
(
3
*
N
-
2
*
E
)
/
4
);
for
(
int
n
=
0
;
n
<=
limit
-
1
;
n
++
)
{
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
n
;
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
}
if
((
E
/
(
double
)
N
)
>=
(
3
.
0
/
4
))
{
limit
=
ceil
((
double
)
(
3
*
N
-
2
*
E
)
/
4
);
for
(
int
n
=
0
;
n
<=
limit
-
1
;
n
++
)
{
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
n
;
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
}
}
else
{
limit
=
ceil
((
double
)
(
9
*
N
-
4
*
E
)
/
16
);
for
(
int
n
=
0
;
n
<=
limit
-
1
;
n
++
)
{
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
n
;
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
}
limit
=
ceil
((
double
)
(
9
*
N
-
4
*
E
)
/
16
);
for
(
int
n
=
0
;
n
<=
limit
-
1
;
n
++
)
{
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
n
;
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
}
}
}
else
{
//shortening
}
else
{
//
shortening
for
(
int
n
=
E
;
n
<=
N
-
1
;
n
++
)
{
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
J
[
n
];
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
ind
=
Q_Ftmp_N
[
N
]
+
1
;
Q_Ftmp_N
[
ind
]
=
J
[
n
];
Q_Ftmp_N
[
N
]
=
Q_Ftmp_N
[
N
]
+
1
;
}
}
}
//Q_I,tmp_N = Q_0_N-1 \ Q_F,tmp_N
//
Q_I,tmp_N = Q_0_N-1 \ Q_F,tmp_N
for
(
int
n
=
0
;
n
<=
N
-
1
;
n
++
)
{
flag
=
1
;
for
(
int
m
=
0
;
m
<=
Q_Ftmp_N
[
N
];
m
++
)
{
if
(
Q_0_Nminus1
[
n
]
==
Q_Ftmp_N
[
m
])
{
flag
=
0
;
break
;
flag
=
0
;
break
;
}
}
if
(
flag
)
{
...
...
@@ -205,19 +319,26 @@ void nr_polar_info_bit_pattern(uint8_t *ibp,
}
}
//Q_I_N comprises (K+n_PC) most reliable bit indices in Q_I,tmp_N
//
Q_I_N comprises (K+n_PC) most reliable bit indices in Q_I,tmp_N
for
(
int
n
=
0
;
n
<=
(
K
+
n_PC
)
-
1
;
n
++
)
{
ind
=
Q_Itmp_N
[
N
]
+
n
-
((
K
+
n_PC
)
-
1
);
Q_I_N
[
n
]
=
Q_Itmp_N
[
ind
];
}
//Q_F_N = Q_0_N-1 \ Q_I_N
if
(
n_PC
>
0
)
{
AssertFatal
(
n_pc_wm
==
0
,
"Q_PC_N computation for n_pc_wm = %i is not implemented yet!
\n
"
,
n_pc_wm
);
for
(
int
n
=
0
;
n
<
n_PC
-
n_pc_wm
;
n
++
)
{
Q_PC_N
[
n
]
=
Q_I_N
[
n
];
}
}
// Q_F_N = Q_0_N-1 \ Q_I_N
for
(
int
n
=
0
;
n
<=
N
-
1
;
n
++
)
{
flag
=
1
;
for
(
int
m
=
0
;
m
<=
(
K
+
n_PC
)
-
1
;
m
++
)
{
if
(
Q_0_Nminus1
[
n
]
==
Q_I_N
[
m
])
{
flag
=
0
;
break
;
flag
=
0
;
break
;
}
}
if
(
flag
)
{
...
...
@@ -226,16 +347,25 @@ void nr_polar_info_bit_pattern(uint8_t *ibp,
}
}
//
Information
Bit Pattern
//
Information and Parity Chack
Bit Pattern
for
(
int
n
=
0
;
n
<=
N
-
1
;
n
++
)
{
ibp
[
n
]
=
0
;
ibp
[
n
]
=
0
;
for
(
int
m
=
0
;
m
<=
(
K
+
n_PC
)
-
1
;
m
++
)
{
if
(
n
==
Q_I_N
[
m
])
{
ibp
[
n
]
=
1
;
break
;
ibp
[
n
]
=
1
;
break
;
}
}
pcbp
[
n
]
=
0
;
for
(
int
m
=
0
;
m
<
n_PC
-
n_pc_wm
;
m
++
)
{
if
(
n
==
Q_PC_N
[
m
])
{
pcbp
[
n
]
=
1
;
break
;
}
}
}
free
(
Q_Ftmp_N
);
...
...
@@ -325,23 +455,75 @@ void nr_polar_rate_matching(double *input,
}
}
/*
* De-interleaving of coded bits implementation
* TS 138.212: Section 5.4.1.3 - Interleaving of coded bits
*/
void
nr_polar_rm_deinterleaving_cb
(
const
int16_t
*
in
,
int16_t
*
out
,
const
uint16_t
E
)
{
int
T
=
ceil
((
sqrt
(
8
*
E
+
1
)
-
1
)
/
2
);
int
v_tab
[
T
][
T
];
int
k
=
0
;
for
(
int
i
=
0
;
i
<
T
;
i
++
)
{
memset
(
v_tab
[
i
],
0
,
T
*
sizeof
(
int
));
for
(
int
j
=
0
;
j
<
T
-
i
;
j
++
)
{
if
(
k
<
E
)
{
v_tab
[
i
][
j
]
=
k
+
1
;
}
k
++
;
}
}
int
v
[
T
][
T
];
k
=
0
;
for
(
int
j
=
0
;
j
<
T
;
j
++
)
{
for
(
int
i
=
0
;
i
<
T
-
j
;
i
++
)
{
if
(
k
<
E
&&
v_tab
[
i
][
j
]
!=
0
)
{
v
[
i
][
j
]
=
in
[
k
];
k
++
;
}
else
{
v
[
i
][
j
]
=
INT_MAX
;
}
}
}
k
=
0
;
memset
(
out
,
0
,
E
*
sizeof
(
int16_t
));
for
(
int
i
=
0
;
i
<
T
;
i
++
)
{
for
(
int
j
=
0
;
j
<
T
-
i
;
j
++
)
{
if
(
v
[
i
][
j
]
!=
INT_MAX
)
{
out
[
k
]
=
v
[
i
][
j
];
k
++
;
}
}
}
}
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
)
int16_t
*
output
,
const
uint16_t
*
rmp
,
const
uint16_t
K
,
const
uint16_t
N
,
const
uint16_t
E
,
const
uint8_t
i_bil
)
{
if
(
E
>=
N
)
{
//repetition
memset
((
void
*
)
output
,
0
,
N
*
sizeof
(
int16_t
));
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
)
output
[
rmp
[
i
]]
+=
input
[
i
];
if
(
i_bil
==
1
)
{
nr_polar_rm_deinterleaving_cb
(
input
,
input
,
E
);
}
if
(
E
>=
N
)
{
// repetition
memset
((
void
*
)
output
,
0
,
N
*
sizeof
(
int16_t
));
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
)
output
[
rmp
[
i
]]
+=
input
[
i
];
}
else
{
if
(
(
K
/
(
double
)
E
)
<=
(
7
.
0
/
16
)
)
memset
((
void
*
)
output
,
0
,
N
*
sizeof
(
int16_t
));
//puncturing
else
{
//shortening
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
32767
;
//instead of INFINITY, to prevent [-Woverflow]
if
((
K
/
(
double
)
E
)
<=
(
7
.
0
/
16
))
memset
((
void
*
)
output
,
0
,
N
*
sizeof
(
int16_t
));
// puncturing
else
{
// shortening
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
32767
;
// instead of INFINITY, to prevent [-Woverflow]
}
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
)
output
[
rmp
[
i
]]
=
input
[
i
];
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
)
output
[
rmp
[
i
]]
=
input
[
i
];
}
}
openair1/PHY/CODING/nr_polar_init.c
View file @
92ba679b
...
...
@@ -49,9 +49,9 @@ static void nr_polar_delete_list(t_nrPolar_params * polarParams) {
delete_decoder_tree
(
polarParams
);
//From build_polar_tables()
for
(
int
k
=
0
;
k
<
polarParams
->
K
+
polarParams
->
n_pc
;
k
++
)
if
(
polarParams
->
G_N_tab
[
k
])
free
(
polarParams
->
G_N_tab
[
k
]);
for
(
int
n
=
0
;
n
<
polarParams
->
N
;
n
++
)
if
(
polarParams
->
G_N_tab
[
n
])
free
(
polarParams
->
G_N_tab
[
n
]);
free
(
polarParams
->
G_N_tab
);
free
(
polarParams
->
rm_tab
);
if
(
polarParams
->
crc_generator_matrix
)
...
...
@@ -71,6 +71,7 @@ static void nr_polar_delete_list(t_nrPolar_params * polarParams) {
free
(
polarParams
->
deinterleaving_pattern
);
free
(
polarParams
->
rate_matching_pattern
);
free
(
polarParams
->
information_bit_pattern
);
free
(
polarParams
->
parity_check_bit_pattern
);
free
(
polarParams
->
Q_I_N
);
free
(
polarParams
->
Q_F_N
);
free
(
polarParams
->
Q_PC_N
);
...
...
@@ -234,6 +235,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
newPolarInitNode
->
N
,
newPolarInitNode
->
encoderLength
);
newPolarInitNode
->
information_bit_pattern
=
malloc
(
sizeof
(
uint8_t
)
*
newPolarInitNode
->
N
);
newPolarInitNode
->
parity_check_bit_pattern
=
malloc
(
sizeof
(
uint8_t
)
*
newPolarInitNode
->
N
);
newPolarInitNode
->
Q_I_N
=
malloc
(
sizeof
(
int16_t
)
*
(
newPolarInitNode
->
K
+
newPolarInitNode
->
n_pc
));
newPolarInitNode
->
Q_F_N
=
malloc
(
sizeof
(
int16_t
)
*
(
newPolarInitNode
->
N
+
1
));
// Last element shows the final array index assigned a value.
newPolarInitNode
->
Q_PC_N
=
malloc
(
sizeof
(
int16_t
)
*
(
newPolarInitNode
->
n_pc
));
...
...
@@ -242,14 +244,18 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
newPolarInitNode
->
Q_F_N
[
i
]
=
-
1
;
// Empty array.
nr_polar_info_bit_pattern
(
newPolarInitNode
->
information_bit_pattern
,
newPolarInitNode
->
parity_check_bit_pattern
,
newPolarInitNode
->
Q_I_N
,
newPolarInitNode
->
Q_F_N
,
newPolarInitNode
->
Q_PC_N
,
J
,
newPolarInitNode
->
Q_0_Nminus1
,
newPolarInitNode
->
K
,
newPolarInitNode
->
N
,
newPolarInitNode
->
encoderLength
,
newPolarInitNode
->
n_pc
);
newPolarInitNode
->
n_pc
,
newPolarInitNode
->
n_pc_wm
);
// sort the Q_I_N array in ascending order (first K positions)
qsort
((
void
*
)
newPolarInitNode
->
Q_I_N
,
newPolarInitNode
->
K
,
sizeof
(
int16_t
),
intcmp
);
newPolarInitNode
->
channel_interleaver_pattern
=
malloc
(
sizeof
(
uint16_t
)
*
newPolarInitNode
->
encoderLength
);
...
...
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
View file @
92ba679b
...
...
@@ -49,6 +49,7 @@
#endif
//#define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2)
//#define POLAR_CODING_DEBUG
void
nr_generate_pucch0
(
const
PHY_VARS_NR_UE
*
ue
,
c16_t
**
txdataF
,
...
...
@@ -693,7 +694,19 @@ void nr_generate_pucch2(const PHY_VARS_NR_UE *ue,
/*
* Implementing TS 38.211 Subclause 6.3.2.5.1 scrambling format 2
*/
nr_pucch2_3_4_scrambling
(
M_bit
,
rnti
,
pucch_pdu
->
data_scrambling_id
,
&
b
[
0
],
btilde
);
nr_pucch2_3_4_scrambling
(
M_bit
,
rnti
,
pucch_pdu
->
data_scrambling_id
,
b
,
btilde
);
#ifdef POLAR_CODING_DEBUG
printf
(
"bt:"
);
for
(
int
n
=
0
;
n
<
M_bit
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%u"
,
btilde
[
n
]);
}
printf
(
"
\n
"
);
#endif
/*
* Implementing TS 38.211 Subclause 6.3.2.5.2 modulation format 2
* btilde shall be modulated as described in subclause 5.1 using QPSK
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
View file @
92ba679b
...
...
@@ -1154,9 +1154,6 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
if
(
curr_pucch
->
csi_bits
>
0
&&
!
curr_pucch
->
simultaneous_harqcsi
)
continue
;
// TODO we can't schedule more than 11 bits in PUCCH2 for now
if
(
curr_pucch
->
csi_bits
+
curr_pucch
->
dai_c
>=
10
)
continue
;
// otherwise we can schedule in this active PUCCH
// no need to check VRB occupation because already done when PUCCH has been activated
...
...
openair2/RRC/NR/nr_rrc_config.c
View file @
92ba679b
...
...
@@ -850,7 +850,7 @@ static void config_pucch_resset1(NR_PUCCH_Config_t *pucch_Config, const NR_UE_NR
pucchfmt2
->
interslotFrequencyHopping
=
NULL
;
pucchfmt2
->
additionalDMRS
=
NULL
;
pucchfmt2
->
maxCodeRate
=
calloc
(
1
,
sizeof
(
*
pucchfmt2
->
maxCodeRate
));
*
pucchfmt2
->
maxCodeRate
=
NR_PUCCH_MaxCodeRate_zeroDot
3
5
;
*
pucchfmt2
->
maxCodeRate
=
NR_PUCCH_MaxCodeRate_zeroDot
1
5
;
pucchfmt2
->
nrofSlots
=
NULL
;
pucchfmt2
->
pi2BPSK
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment