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
promise
OpenXG-RAN
Commits
1da3a24c
Commit
1da3a24c
authored
Oct 30, 2018
by
yilmazt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warning removals.
parent
c660a1e5
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
288 additions
and
353 deletions
+288
-353
openair1/PHY/CODING/TESTBENCH/ldpctest.c
openair1/PHY/CODING/TESTBENCH/ldpctest.c
+4
-3
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+27
-40
openair1/PHY/CODING/coding_defs.h
openair1/PHY/CODING/coding_defs.h
+1
-1
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
+17
-17
openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
...ir1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
+9
-9
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+40
-40
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+130
-111
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+9
-83
openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c
...air1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c
+43
-43
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
+1
-1
openair1/PHY/CODING/nr_compute_tbs.c
openair1/PHY/CODING/nr_compute_tbs.c
+1
-1
openair1/PHY/CODING/nr_segmentation.c
openair1/PHY/CODING/nr_segmentation.c
+1
-1
openair1/PHY/INIT/nr_parms.c
openair1/PHY/INIT/nr_parms.c
+3
-1
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+1
-1
openair1/PHY/NR_TRANSPORT/nr_pbch.c
openair1/PHY/NR_TRANSPORT/nr_pbch.c
+1
-1
No files found.
openair1/PHY/CODING/TESTBENCH/ldpctest.c
View file @
1da3a24c
...
@@ -259,6 +259,7 @@ int test_ldpc(short No_iteration,
...
@@ -259,6 +259,7 @@ int test_ldpc(short No_iteration,
//estimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
//estimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
n_iter
=
nrLDPC_decoder
(
&
decParams
,
(
int8_t
*
)
channel_output_fixed
,
(
int8_t
*
)
estimated_output
,
NULL
);
n_iter
=
nrLDPC_decoder
(
&
decParams
,
(
int8_t
*
)
channel_output_fixed
,
(
int8_t
*
)
estimated_output
,
NULL
);
printf
(
"nrLDPC_decoder n_iter=%d
\n
"
,
n_iter
);
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
...
@@ -268,9 +269,9 @@ int test_ldpc(short No_iteration,
...
@@ -268,9 +269,9 @@ int test_ldpc(short No_iteration,
{
{
if
(
estimated_output
[
i
]
!=
test_input
[
0
][
i
])
if
(
estimated_output
[
i
]
!=
test_input
[
0
][
i
])
{
{
printf
(
"error pos %d (%d, %d)
\n
"
,
i
,
estimated_output
[
i
],
test_input
[
0
][
i
]);
printf
(
"error pos %d (%d, %d)
\n
"
,
i
,
estimated_output
[
i
],
test_input
[
0
][
i
]);
*
errors
=
(
*
errors
)
+
1
;
*
errors
=
(
*
errors
)
+
1
;
break
;
break
;
}
}
}
}
...
...
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
1da3a24c
...
@@ -18,11 +18,8 @@ int main(int argc, char *argv[]) {
...
@@ -18,11 +18,8 @@ int main(int argc, char *argv[]) {
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
time_stats_t
timeEncoder
,
timeDecoder
;
time_stats_t
timeEncoder
,
timeDecoder
;
time_stats_t
polar_decoder_init
,
polar_rate_matching
,
decoding
,
bit_extraction
,
deinterleaving
;
time_stats_t
path_metric
,
sorting
,
update_LLR
;
opp_enabled
=
1
;
opp_enabled
=
1
;
int
decoder_int16
=
0
;
int
decoder_int16
=
0
;
int
generate_optim_code
=
0
;
cpu_freq_GHz
=
get_cpu_freq_GHz
();
cpu_freq_GHz
=
get_cpu_freq_GHz
();
reset_meas
(
&
timeEncoder
);
reset_meas
(
&
timeEncoder
);
reset_meas
(
&
timeDecoder
);
reset_meas
(
&
timeDecoder
);
...
@@ -71,20 +68,20 @@ int main(int argc, char *argv[]) {
...
@@ -71,20 +68,20 @@ int main(int argc, char *argv[]) {
pathMetricAppr
=
(
uint8_t
)
atoi
(
optarg
);
pathMetricAppr
=
(
uint8_t
)
atoi
(
optarg
);
break
;
break
;
case
'q'
:
case
'q'
:
decoder_int16
=
1
;
decoder_int16
=
1
;
break
;
break
;
case
'g'
:
case
'g'
:
generate_optim_code
=
1
;
iterations
=
1
;
iterations
=
1
;
SNRstart
=
-
6
.
0
;
SNRstart
=
-
6
.
0
;
SNRstop
=
-
6
.
0
;
SNRstop
=-
6
.
0
;
decoder_int16
=
1
;
decoder_int16
=
1
;
break
;
break
;
case
'h'
:
case
'h'
:
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
exit
(
-
1
);
exit
(
-
1
);
default:
default:
perror
(
"[polartest.c] Problem at argument parsing with getopt"
);
perror
(
"[polartest.c] Problem at argument parsing with getopt"
);
...
@@ -141,18 +138,18 @@ int main(int argc, char *argv[]) {
...
@@ -141,18 +138,18 @@ int main(int argc, char *argv[]) {
uint8_t
testArrayLength
=
ceil
(
testLength
/
32
.
0
);
uint8_t
testArrayLength
=
ceil
(
testLength
/
32
.
0
);
uint8_t
coderArrayLength
=
ceil
(
coderLength
/
32
.
0
);
uint8_t
coderArrayLength
=
ceil
(
coderLength
/
32
.
0
);
uint32_t
*
testInput
=
malloc
(
sizeof
(
uint32_t
)
*
testArrayLength
)
;
//generate randomly
uint32_t
testInput
[
testArrayLength
]
;
//generate randomly
uint32_t
*
encoderOutput
=
malloc
(
sizeof
(
uint32_t
)
*
coderArrayLength
)
;
uint32_t
encoderOutput
[
coderArrayLength
]
;
uint32_t
*
estimatedOutput
=
malloc
(
sizeof
(
uint32_t
)
*
testArrayLength
)
;
//decoder output
uint32_t
estimatedOutput
[
testArrayLength
]
;
//decoder output
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
uint8_t
*
encoderOutputByte
=
malloc
(
sizeof
(
uint8_t
)
*
coderLength
)
;
uint8_t
encoderOutputByte
[
coderLength
]
;
double
*
modulatedInput
=
malloc
(
sizeof
(
double
)
*
coderLength
)
;
//channel input
double
modulatedInput
[
coderLength
]
;
//channel input
double
*
channelOutput
=
malloc
(
sizeof
(
double
)
*
coderLength
);
//add noise
double
channelOutput
[
coderLength
];
//add noise
int16_t
*
channelOutput_int16
;
i
f
(
decoder_int16
==
1
)
channelOutput_int16
=
(
int16_t
*
)
malloc
(
sizeof
(
int16_t
)
*
coderLength
)
;
i
nt16_t
channelOutput_int16
[
coderLength
]
;
t_nrPolar_paramsPtr
nrPolar_params
=
NULL
,
currentPtr
=
NULL
;
t_nrPolar_paramsPtr
nrPolar_params
=
NULL
,
currentPtr
=
NULL
;
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
...
@@ -203,6 +200,8 @@ int main(int argc, char *argv[]) {
...
@@ -203,6 +200,8 @@ int main(int argc, char *argv[]) {
rnti
);
rnti
);
printf
(
"dci_estimation: [0]->0x%08x
\t
[1]->0x%08x
\t
[2]->0x%08x
\t
[3]->0x%08x
\n
"
,
printf
(
"dci_estimation: [0]->0x%08x
\t
[1]->0x%08x
\t
[2]->0x%08x
\t
[3]->0x%08x
\n
"
,
dci_estimation
[
0
],
dci_estimation
[
1
],
dci_estimation
[
2
],
dci_estimation
[
3
]);
dci_estimation
[
0
],
dci_estimation
[
1
],
dci_estimation
[
2
],
dci_estimation
[
3
]);
free
(
encoder_outputByte
);
free
(
channel_output
);
return
0
;
return
0
;
#endif
#endif
...
@@ -262,7 +261,7 @@ int main(int argc, char *argv[]) {
...
@@ -262,7 +261,7 @@ int main(int argc, char *argv[]) {
uint8_t
nr_polar_A
[
32
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
};
uint8_t
nr_polar_A
[
32
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
};
uint8_t
nr_polar_crc
[
24
];
uint8_t
nr_polar_crc
[
24
];
uint8_t
**
crc_generator_matrix
=
crc24c_generator_matrix
(
32
);
uint8_t
**
crc_generator_matrix
=
crc24c_generator_matrix
(
32
);
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
nr_polar_A
,
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
nr_polar_A
,
crc_generator_matrix
,
crc_generator_matrix
,
nr_polar_crc
,
nr_polar_crc
,
32
,
32
,
...
@@ -318,15 +317,12 @@ int main(int argc, char *argv[]) {
...
@@ -318,15 +317,12 @@ int main(int argc, char *argv[]) {
for (int i=0; i<32; i++)
for (int i=0; i<32; i++)
printf("%d\n",(testInput[0]>>i)&1);*/
printf("%d\n",(testInput[0]>>i)&1);*/
start_meas
(
&
timeEncoder
);
start_meas
(
&
timeEncoder
);
if
(
decoder_int16
==
0
)
if
(
decoder_int16
==
0
)
polar_encoder
(
testInput
,
encoderOutput
,
currentPtr
);
polar_encoder
(
testInput
,
encoderOutput
,
currentPtr
);
else
else
polar_encoder_fast
((
uint64_t
*
)
testInput
,
(
uint64_t
*
)
encoderOutput
,
0
,
currentPtr
);
polar_encoder_fast
((
uint64_t
*
)
testInput
,
encoderOutput
,
0
,
currentPtr
);
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0, currentPtr);
stop_meas
(
&
timeEncoder
);
stop_meas
(
&
timeEncoder
);
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
...
@@ -428,14 +424,5 @@ int main(int argc, char *argv[]) {
...
@@ -428,14 +424,5 @@ int main(int argc, char *argv[]) {
print_meas
(
&
timeDecoder
,
"polar_decoder"
,
NULL
,
NULL
);
print_meas
(
&
timeDecoder
,
"polar_decoder"
,
NULL
,
NULL
);
fclose
(
logFile
);
fclose
(
logFile
);
//Bit
free
(
testInput
);
free
(
encoderOutput
);
free
(
estimatedOutput
);
//Byte
free
(
encoderOutputByte
);
free
(
modulatedInput
);
free
(
channelOutput
);
return
(
0
);
return
(
0
);
}
}
openair1/PHY/CODING/coding_defs.h
View file @
1da3a24c
...
@@ -337,7 +337,7 @@ void ccodedab_init_inv(void);
...
@@ -337,7 +337,7 @@ void ccodedab_init_inv(void);
/*!\fn void crcTableInit(void)
/*!\fn void crcTableInit(void)
\brief This function initializes the different crc tables.*/
\brief This function initializes the different crc tables.*/
//
void crcTableInit (void);
void
crcTableInit
(
void
);
...
...
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
View file @
1da3a24c
...
@@ -201,7 +201,13 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
...
@@ -201,7 +201,13 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
{
short
Kb
,
Zc
,
nrows
,
ncols
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
;
int
i
,
i1
;
int
no_punctured_columns
,
removed_bit
;
int
no_punctured_columns
,
removed_bit
;
...
@@ -211,13 +217,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
...
@@ -211,13 +217,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int
simd_size
;
int
simd_size
;
//determine number of bits in codeword
//determine number of bits in codeword
if
(
BG
==
1
)
if
(
BG
==
2
)
{
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
{
{
nrows
=
42
;
//parity check bits
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
ncols
=
10
;
// info bits
...
@@ -251,7 +251,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
...
@@ -251,7 +251,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
#endif
#endif
if
((
Zc
&
31
)
>
0
)
simd_size
=
16
;
if
((
Zc
&
31
)
>
0
)
simd_size
=
16
;
else
simd_size
=
32
;
else
simd_size
=
32
;
unsigned
char
c
[
22
*
Zc
]
__attribute__
((
aligned
(
32
)));
//padded input, unpacked, max size
unsigned
char
c
[
22
*
Zc
]
__attribute__
((
aligned
(
32
)));
//padded input, unpacked, max size
unsigned
char
d
[
46
*
Zc
]
__attribute__
((
aligned
(
32
)));
//coded parity part output, unpacked, max size
unsigned
char
d
[
46
*
Zc
]
__attribute__
((
aligned
(
32
)));
//coded parity part output, unpacked, max size
...
@@ -316,7 +316,13 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
...
@@ -316,7 +316,13 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
{
short
Kb
,
Zc
,
nrows
,
ncols
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
,
j
;
int
i
,
i1
,
j
;
int
no_punctured_columns
,
removed_bit
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
//Table of possible lifting sizes
...
@@ -343,13 +349,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
...
@@ -343,13 +349,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
AssertFatal
(
n_segments
>
0
&&
n_segments
<=
8
,
"0 < n_segments %d <= 8
\n
"
,
n_segments
);
AssertFatal
(
n_segments
>
0
&&
n_segments
<=
8
,
"0 < n_segments %d <= 8
\n
"
,
n_segments
);
//determine number of bits in codeword
//determine number of bits in codeword
if
(
BG
==
1
)
if
(
BG
==
2
)
{
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
{
{
nrows
=
42
;
//parity check bits
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
ncols
=
10
;
// info bits
...
...
openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
View file @
1da3a24c
...
@@ -367,7 +367,13 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
...
@@ -367,7 +367,13 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
unsigned
char
d
[
68
*
384
];
//coded output, unpacked, max size
unsigned
char
d
[
68
*
384
];
//coded output, unpacked, max size
unsigned
char
channel_temp
,
temp
;
unsigned
char
channel_temp
,
temp
;
short
*
Gen_shift_values
,
*
no_shift_values
,
*
pointer_shift_values
;
short
*
Gen_shift_values
,
*
no_shift_values
,
*
pointer_shift_values
;
short
Zc
,
Kb
,
nrows
,
ncols
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
,
i2
,
i3
,
i4
,
i5
,
temp_prime
,
var
;
int
i
,
i1
,
i2
,
i3
,
i4
,
i5
,
temp_prime
,
var
;
int
no_punctured_columns
,
removed_bit
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
//Table of possible lifting sizes
...
@@ -378,13 +384,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
...
@@ -378,13 +384,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
int
indlist2
[
1000
];
int
indlist2
[
1000
];
//determine number of bits in codeword
//determine number of bits in codeword
if
(
BG
==
1
)
if
(
BG
==
2
)
{
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
{
{
nrows
=
42
;
//parity check bits
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
ncols
=
10
;
// info bits
...
@@ -415,7 +415,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
...
@@ -415,7 +415,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
return
(
-
1
);
return
(
-
1
);
}
}
int
K
=
ncols
*
Zc
;
//int K = ncols*Zc; //unused variable
Gen_shift_values
=
choose_generator_matrix
(
BG
,
Zc
);
Gen_shift_values
=
choose_generator_matrix
(
BG
,
Zc
);
if
(
Gen_shift_values
==
NULL
)
{
if
(
Gen_shift_values
==
NULL
)
{
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
1da3a24c
...
@@ -48,11 +48,11 @@ int8_t polar_decoder(
...
@@ -48,11 +48,11 @@ int8_t polar_decoder(
{
{
//Assumes no a priori knowledge.
//Assumes no a priori knowledge.
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
...
@@ -231,9 +231,9 @@ int8_t polar_decoder(
...
@@ -231,9 +231,9 @@ int8_t polar_decoder(
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -267,11 +267,11 @@ int8_t polar_decoder(
...
@@ -267,11 +267,11 @@ int8_t polar_decoder(
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
/*
* Return bits.
* Return bits.
...
@@ -287,11 +287,11 @@ int8_t polar_decoder_aPriori(double *input,
...
@@ -287,11 +287,11 @@ int8_t polar_decoder_aPriori(double *input,
uint8_t
pathMetricAppr
,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
)
double
*
aPrioriPayload
)
{
{
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
...
@@ -484,9 +484,9 @@ int8_t polar_decoder_aPriori(double *input,
...
@@ -484,9 +484,9 @@ int8_t polar_decoder_aPriori(double *input,
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -519,11 +519,11 @@ int8_t polar_decoder_aPriori(double *input,
...
@@ -519,11 +519,11 @@ int8_t polar_decoder_aPriori(double *input,
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
/*
* Return bits.
* Return bits.
...
@@ -546,11 +546,11 @@ int8_t polar_decoder_aPriori_timing(double *input,
...
@@ -546,11 +546,11 @@ int8_t polar_decoder_aPriori_timing(double *input,
FILE
*
logFile
)
FILE
*
logFile
)
{
{
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
...
@@ -742,9 +742,9 @@ int8_t polar_decoder_aPriori_timing(double *input,
...
@@ -742,9 +742,9 @@ int8_t polar_decoder_aPriori_timing(double *input,
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -777,11 +777,11 @@ int8_t polar_decoder_aPriori_timing(double *input,
...
@@ -777,11 +777,11 @@ int8_t polar_decoder_aPriori_timing(double *input,
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
/*
* Return bits.
* Return bits.
...
@@ -799,11 +799,11 @@ int8_t polar_decoder_dci(double *input,
...
@@ -799,11 +799,11 @@ int8_t polar_decoder_dci(double *input,
uint16_t
n_RNTI
)
uint16_t
n_RNTI
)
{
{
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
uint8_t
extended_crc_scrambling_pattern
[
polarParams
->
crcParityBits
];
uint8_t
extended_crc_scrambling_pattern
[
polarParams
->
crcParityBits
];
...
@@ -991,9 +991,9 @@ int8_t polar_decoder_dci(double *input,
...
@@ -991,9 +991,9 @@ int8_t polar_decoder_dci(double *input,
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -1026,11 +1026,11 @@ int8_t polar_decoder_dci(double *input,
...
@@ -1026,11 +1026,11 @@ int8_t polar_decoder_dci(double *input,
free
(
d_tilde
);
free
(
d_tilde
);
free
(
pathMetric
);
free
(
pathMetric
);
free
(
crcState
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
/*
* Return bits.
* Return bits.
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
1da3a24c
...
@@ -145,11 +145,10 @@ void polar_encoder_dci(uint32_t *in,
...
@@ -145,11 +145,10 @@ void polar_encoder_dci(uint32_t *in,
t_nrPolar_paramsPtr
polarParams
,
t_nrPolar_paramsPtr
polarParams
,
uint16_t
n_RNTI
);
uint16_t
n_RNTI
);
void
polar_encoder_timing
(
uint32_t
*
in
,
void
polar_encoder_fast
(
uint64_t
*
A
,
uint32_t
*
out
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
int32_t
crcmask
,
double
cpuFreqGHz
,
t_nrPolar_paramsPtr
polarParams
);
FILE
*
logFile
);
int8_t
polar_decoder
(
double
*
input
,
int8_t
polar_decoder
(
double
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
...
@@ -184,7 +183,12 @@ int8_t polar_decoder_dci(double *input,
...
@@ -184,7 +183,12 @@ int8_t polar_decoder_dci(double *input,
uint8_t
pathMetricAppr
,
uint8_t
pathMetricAppr
,
uint16_t
n_RNTI
);
uint16_t
n_RNTI
);
void
generic_polar_decoder
(
t_nrPolar_params
*
,
decoder_node_t
*
);
void
generic_polar_decoder
(
t_nrPolar_params
*
,
decoder_node_t
*
);
void
build_decoder_tree
(
t_nrPolar_params
*
pp
);
void
build_polar_tables
(
t_nrPolar_paramsPtr
polarParams
);
void
init_polar_deinterleaver_table
(
t_nrPolar_params
*
polarParams
);
void
nr_polar_init
(
t_nrPolar_paramsPtr
*
polarParams
,
void
nr_polar_init
(
t_nrPolar_paramsPtr
*
polarParams
,
int8_t
messageType
,
int8_t
messageType
,
...
@@ -210,150 +214,165 @@ const uint16_t* nr_polar_sequence_pattern(uint8_t n);
...
@@ -210,150 +214,165 @@ const uint16_t* nr_polar_sequence_pattern(uint8_t n);
* @param E
* @param E
* @param n_max */
* @param n_max */
uint32_t
nr_polar_output_length
(
uint16_t
K
,
uint32_t
nr_polar_output_length
(
uint16_t
K
,
uint16_t
E
,
uint16_t
E
,
uint8_t
n_max
);
uint8_t
n_max
);
void
nr_polar_channel_interleaver_pattern
(
uint16_t
*
cip
,
void
nr_polar_channel_interleaver_pattern
(
uint16_t
*
cip
,
uint8_t
I_BIL
,
uint8_t
I_BIL
,
uint16_t
E
);
uint16_t
E
);
void
nr_polar_rate_matching_pattern
(
uint16_t
*
rmp
,
void
nr_polar_rate_matching_pattern
(
uint16_t
*
rmp
,
uint16_t
*
J
,
uint16_t
*
J
,
const
uint8_t
*
P_i_
,
const
uint8_t
*
P_i_
,
uint16_t
K
,
uint16_t
K
,
uint16_t
N
,
uint16_t
N
,
uint16_t
E
);
uint16_t
E
);
void
nr_polar_rate_matching
(
double
*
input
,
void
nr_polar_rate_matching
(
double
*
input
,
double
*
output
,
double
*
output
,
uint16_t
*
rmp
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
K
,
uint16_t
N
,
uint16_t
N
,
uint16_t
E
);
uint16_t
E
);
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_interleaving_pattern
(
uint16_t
K
,
void
nr_polar_interleaving_pattern
(
uint16_t
K
,
uint8_t
I_IL
,
uint8_t
I_IL
,
uint16_t
*
PI_k_
);
uint16_t
*
PI_k_
);
void
nr_polar_info_bit_pattern
(
uint8_t
*
ibp
,
void
nr_polar_info_bit_pattern
(
uint8_t
*
ibp
,
int16_t
*
Q_I_N
,
int16_t
*
Q_I_N
,
int16_t
*
Q_F_N
,
int16_t
*
Q_F_N
,
uint16_t
*
J
,
uint16_t
*
J
,
const
uint16_t
*
Q_0_Nminus1
,
const
uint16_t
*
Q_0_Nminus1
,
uint16_t
K
,
uint16_t
K
,
uint16_t
N
,
uint16_t
N
,
uint16_t
E
,
uint16_t
E
,
uint8_t
n_PC
);
uint8_t
n_PC
);
void
nr_polar_info_bit_extraction
(
uint8_t
*
input
,
void
nr_polar_info_bit_extraction
(
uint8_t
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
uint8_t
*
pattern
,
uint8_t
*
pattern
,
uint16_t
size
);
uint16_t
size
);
void
nr_bit2byte_uint32_8_t
(
uint32_t
*
in
,
void
nr_bit2byte_uint32_8_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint16_t
arraySize
,
uint8_t
*
out
);
uint8_t
*
out
);
void
nr_byte2bit_uint8_32_t
(
uint8_t
*
in
,
void
nr_byte2bit_uint8_32_t
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint16_t
arraySize
,
uint32_t
*
out
);
uint32_t
*
out
);
void
nr_crc_bit2bit_uint32_8_t
(
uint32_t
*
in
,
void
nr_crc_bit2bit_uint32_8_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint16_t
arraySize
,
uint8_t
*
out
);
uint8_t
*
out
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
uint16_t
N
,
uint16_t
N
,
uint16_t
K
,
uint16_t
K
,
int16_t
*
Q_I_N
,
int16_t
*
Q_I_N
,
int16_t
*
Q_PC_N
,
int16_t
*
Q_PC_N
,
uint8_t
n_PC
);
uint8_t
n_PC
);
void
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
uint8_t
*
matrix1
,
void
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
uint8_t
*
matrix1
,
uint8_t
**
matrix2
,
uint8_t
**
matrix2
,
uint8_t
*
output
,
uint8_t
*
output
,
uint16_t
row
,
uint16_t
row
,
uint16_t
col
);
uint16_t
col
);
uint8_t
***
nr_alloc_uint8_
t_
3D_array
(
uint16_t
xlen
,
uint8_t
***
nr_alloc_uint8_3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
ylen
,
uint16_t
zlen
);
uint16_t
zlen
);
uint8_t
**
nr_alloc_uint8_
t_
2D_array
(
uint16_t
xlen
,
uint8_t
**
nr_alloc_uint8_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
);
uint16_t
ylen
);
double
***
nr_alloc_double_3D_array
(
uint16_t
xlen
,
double
***
nr_alloc_double_3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
ylen
,
uint16_t
zlen
);
uint16_t
zlen
);
void
nr_free_uint8_t_3D_array
(
uint8_t
***
input
,
uint16_t
xlen
,
uint16_t
ylen
);
void
nr_free_uint8_t_2D_array
(
uint8_t
**
input
,
double
**
nr_alloc_double_2D_array
(
uint16_t
xlen
,
uint16_t
x
len
);
uint16_t
y
len
);
void
nr_free_double_3D_array
(
double
***
input
,
void
nr_free_double_3D_array
(
double
***
input
,
uint16_t
xlen
,
uint16_t
xlen
,
uint16_t
ylen
);
uint16_t
ylen
);
void
nr_free_double_2D_array
(
double
**
input
,
uint16_t
xlen
);
void
nr_free_uint8_3D_array
(
uint8_t
***
input
,
uint16_t
xlen
,
uint16_t
ylen
);
void
nr_free_uint8_2D_array
(
uint8_t
**
input
,
uint16_t
xlen
);
void
nr_sort_asc_double_1D_array_ind
(
double
*
matrix
,
uint8_t
*
ind
,
uint8_t
len
);
void
nr_sort_asc_int16_1D_array_ind
(
int32_t
*
matrix
,
int
*
ind
,
int
len
);
void
updateLLR
(
double
***
llr
,
void
updateLLR
(
double
***
llr
,
uint8_t
**
llrU
,
uint8_t
**
llrU
,
uint8_t
***
bit
,
uint8_t
***
bit
,
uint8_t
**
bitU
,
uint8_t
**
bitU
,
uint8_t
listSize
,
uint8_t
listSize
,
uint16_t
row
,
uint16_t
row
,
uint16_t
col
,
uint16_t
col
,
uint16_t
xlen
,
uint16_t
xlen
,
uint8_t
ylen
,
uint8_t
ylen
,
uint8_t
approximation
);
uint8_t
approximation
);
void
updateBit
(
uint8_t
***
bit
,
void
updateBit
(
uint8_t
***
bit
,
uint8_t
**
bitU
,
uint8_t
**
bitU
,
uint8_t
listSize
,
uint8_t
listSize
,
uint16_t
row
,
uint16_t
row
,
uint16_t
col
,
uint16_t
col
,
uint16_t
xlen
,
uint16_t
xlen
,
uint8_t
ylen
);
uint8_t
ylen
);
void
updatePathMetric
(
double
*
pathMetric
,
void
updatePathMetric
(
double
*
pathMetric
,
double
***
llr
,
double
***
llr
,
uint8_t
listSize
,
uint8_t
listSize
,
uint8_t
bitValue
,
uint8_t
bitValue
,
uint16_t
row
,
uint16_t
row
,
uint8_t
approximation
);
uint8_t
approximation
);
void
updatePathMetric2
(
double
*
pathMetric
,
void
updatePathMetric2
(
double
*
pathMetric
,
double
***
llr
,
double
***
llr
,
uint8_t
listSize
,
uint8_t
listSize
,
uint16_t
row
,
uint16_t
row
,
uint8_t
approximation
);
uint8_t
approximation
);
void
computeLLR
(
double
***
llr
,
void
computeLLR
(
double
***
llr
,
uint16_t
row
,
uint16_t
row
,
uint16_t
col
,
uint16_t
col
,
uint8_t
i
,
uint8_t
i
,
uint16_t
offset
,
uint16_t
offset
,
uint8_t
approximation
);
uint8_t
approximation
);
void
updateCrcChecksum
(
uint8_t
**
crcChecksum
,
void
updateCrcChecksum
(
uint8_t
**
crcChecksum
,
uint8_t
**
crcGen
,
uint8_t
**
crcGen
,
uint8_t
listSize
,
uint8_t
listSize
,
uint32_t
i2
,
uint32_t
i2
,
uint8_t
len
);
uint8_t
len
);
void
updateCrcChecksum2
(
uint8_t
**
crcChecksum
,
void
updateCrcChecksum2
(
uint8_t
**
crcChecksum
,
uint8_t
**
crcGen
,
uint8_t
**
crcGen
,
uint8_t
listSize
,
uint8_t
listSize
,
uint32_t
i2
,
uint32_t
i2
,
uint8_t
len
);
uint8_t
len
);
void
nr_sort_asc_double_1D_array_ind
(
double
*
matrix
,
uint8_t
*
ind
,
uint8_t
len
);
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
);
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
);
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
1da3a24c
...
@@ -21,11 +21,11 @@
...
@@ -21,11 +21,11 @@
/*!\file PHY/CODING/nrPolar_tools/nr_polar_encoder.c
/*!\file PHY/CODING/nrPolar_tools/nr_polar_encoder.c
* \brief
* \brief
* \author Turker Yilmaz
* \author
Raymond Knopp,
Turker Yilmaz
* \date 2018
* \date 2018
* \version 0.1
* \version 0.1
* \company EURECOM
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \email
raymond.knopp@eurecom.fr,
turker.yilmaz@eurecom.fr
* \note
* \note
* \warning
* \warning
*/
*/
...
@@ -58,7 +58,7 @@ nr_bit2byte_uint32_8_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*
...
@@ -58,7 +58,7 @@ nr_bit2byte_uint32_8_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*
*/
*/
//Calculate CRC.
//Calculate CRC.
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
polarParams
->
nr_polar_A
,
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
polarParams
->
nr_polar_A
,
polarParams
->
crc_generator_matrix
,
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
nr_polar_crc
,
polarParams
->
payloadBits
,
polarParams
->
payloadBits
,
...
@@ -116,7 +116,7 @@ nr_bit2byte_uint32_8_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*
...
@@ -116,7 +116,7 @@ nr_bit2byte_uint32_8_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*
/* memset(polarParams->nr_polar_U,0,polarParams->N);
/* memset(polarParams->nr_polar_U,0,polarParams->N);
polarParams->nr_polar_U[247]=1;
polarParams->nr_polar_U[247]=1;
polarParams->nr_polar_U[253]=1;*/
polarParams->nr_polar_U[253]=1;*/
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
polarParams
->
nr_polar_U
,
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
polarParams
->
nr_polar_U
,
polarParams
->
G_N
,
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
,
...
@@ -177,7 +177,7 @@ void polar_encoder_dci(uint32_t *in,
...
@@ -177,7 +177,7 @@ void polar_encoder_dci(uint32_t *in,
printf
(
"
\n
"
);
printf
(
"
\n
"
);
#endif
#endif
//Calculate CRC.
//Calculate CRC.
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
polarParams
->
nr_polar_APrime
,
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
polarParams
->
nr_polar_APrime
,
polarParams
->
crc_generator_matrix
,
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
nr_polar_crc
,
polarParams
->
K
,
polarParams
->
K
,
...
@@ -254,7 +254,7 @@ void polar_encoder_dci(uint32_t *in,
...
@@ -254,7 +254,7 @@ void polar_encoder_dci(uint32_t *in,
polarParams
->
n_pc
);
polarParams
->
n_pc
);
//Encoding (u to d)
//Encoding (u to d)
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
polarParams
->
nr_polar_U
,
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
polarParams
->
nr_polar_U
,
polarParams
->
G_N
,
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
,
...
@@ -284,79 +284,6 @@ void polar_encoder_dci(uint32_t *in,
...
@@ -284,79 +284,6 @@ void polar_encoder_dci(uint32_t *in,
#endif
#endif
}
}
void
polar_encoder_timing
(
uint32_t
*
in
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
double
cpuFreqGHz
,
FILE
*
logFile
)
{
//Initiate timing.
time_stats_t
timeEncoderCRCByte
,
timeEncoderCRCBit
,
timeEncoderInterleaver
,
timeEncoderBitInsertion
,
timeEncoder1
,
timeEncoder2
,
timeEncoderRateMatching
,
timeEncoderByte2Bit
;
reset_meas
(
&
timeEncoderCRCByte
);
reset_meas
(
&
timeEncoderCRCBit
);
reset_meas
(
&
timeEncoderInterleaver
);
reset_meas
(
&
timeEncoderBitInsertion
);
reset_meas
(
&
timeEncoder1
);
reset_meas
(
&
timeEncoder2
);
reset_meas
(
&
timeEncoderRateMatching
);
reset_meas
(
&
timeEncoderByte2Bit
);
uint16_t
n_RNTI
=
0x0000
;
start_meas
(
&
timeEncoderCRCByte
);
nr_crc_bit2bit_uint32_8_t
(
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_aPrime
);
//(a to a')
polarParams
->
crcBit
=
crc24c
(
polarParams
->
nr_polar_aPrime
,
(
polarParams
->
payloadBits
+
polarParams
->
crcParityBits
));
//Parity bits computation (p)
uint8_t
arrayInd
=
ceil
(
polarParams
->
payloadBits
/
8
.
0
);
//(a to b)
for
(
int
i
=
0
;
i
<
arrayInd
-
1
;
i
++
)
for
(
int
j
=
0
;
j
<
8
;
j
++
)
polarParams
->
nr_polar_B
[
j
+
(
i
*
8
)]
=
((
polarParams
->
nr_polar_aPrime
[
3
+
i
]
>>
(
7
-
j
))
&
1
);
for
(
int
i
=
0
;
i
<
((
polarParams
->
payloadBits
)
%
8
);
i
++
)
polarParams
->
nr_polar_B
[
i
+
(
arrayInd
-
1
)
*
8
]
=
((
polarParams
->
nr_polar_aPrime
[
3
+
(
arrayInd
-
1
)]
>>
(
7
-
i
))
&
1
);
for
(
int
i
=
0
;
i
<
8
;
i
++
)
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
i
]
=
((
polarParams
->
crcBit
)
>>
(
31
-
i
))
&
1
;
for
(
int
i
=
0
;
i
<
16
;
i
++
)
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
8
+
i
]
=
(
(((
polarParams
->
crcBit
)
>>
(
23
-
i
))
&
1
)
+
((
n_RNTI
>>
(
15
-
i
))
&
1
)
)
%
2
;
//Scrambling (b to c)
stop_meas
(
&
timeEncoderCRCByte
);
start_meas
(
&
timeEncoderCRCBit
);
nr_bit2byte_uint32_8_t
(
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
nr_matrix_multiplication_uint8_t_1D_uint8_t_2D
(
polarParams
->
nr_polar_A
,
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
payloadBits
,
polarParams
->
crcParityBits
);
//Calculate CRC.
for
(
uint8_t
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
polarParams
->
nr_polar_crc
[
i
]
=
(
polarParams
->
nr_polar_crc
[
i
]
%
2
);
for
(
uint16_t
i
=
0
;
i
<
polarParams
->
payloadBits
;
i
++
)
polarParams
->
nr_polar_B
[
i
]
=
polarParams
->
nr_polar_A
[
i
];
//Attach CRC to the Transport Block. (a to b)
for
(
uint16_t
i
=
polarParams
->
payloadBits
;
i
<
polarParams
->
K
;
i
++
)
polarParams
->
nr_polar_B
[
i
]
=
polarParams
->
nr_polar_crc
[
i
-
(
polarParams
->
payloadBits
)];
stop_meas
(
&
timeEncoderCRCBit
);
start_meas
(
&
timeEncoderInterleaver
);
//Interleaving (c to c')
nr_polar_interleaver
(
polarParams
->
nr_polar_B
,
polarParams
->
nr_polar_CPrime
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
stop_meas
(
&
timeEncoderInterleaver
);
start_meas
(
&
timeEncoderBitInsertion
);
//Bit insertion (c' to u)
nr_polar_bit_insertion
(
polarParams
->
nr_polar_CPrime
,
polarParams
->
nr_polar_U
,
polarParams
->
N
,
polarParams
->
K
,
polarParams
->
Q_I_N
,
polarParams
->
Q_PC_N
,
polarParams
->
n_pc
);
stop_meas
(
&
timeEncoderBitInsertion
);
start_meas
(
&
timeEncoder1
);
//Encoding (u to d)
nr_matrix_multiplication_uint8_t_1D_uint8_t_2D
(
polarParams
->
nr_polar_U
,
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
);
stop_meas
(
&
timeEncoder1
);
start_meas
(
&
timeEncoder2
);
for
(
uint16_t
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
polarParams
->
nr_polar_D
[
i
]
=
(
polarParams
->
nr_polar_D
[
i
]
%
2
);
stop_meas
(
&
timeEncoder2
);
start_meas
(
&
timeEncoderRateMatching
);
//Rate matching //Sub-block interleaving (d to y) and Bit selection (y to e)
nr_polar_interleaver
(
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_E
,
polarParams
->
rate_matching_pattern
,
polarParams
->
encoderLength
);
stop_meas
(
&
timeEncoderRateMatching
);
start_meas
(
&
timeEncoderByte2Bit
);
//Return bits.
nr_byte2bit_uint8_32_t
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
stop_meas
(
&
timeEncoderByte2Bit
);
fprintf
(
logFile
,
",%f,%f,%f,%f,%f,%f,%f,%f
\n
"
,
(
timeEncoderCRCByte
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoderCRCBit
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoderInterleaver
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoderBitInsertion
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoder1
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoder2
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoderRateMatching
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)),
(
timeEncoderByte2Bit
.
diff_now
/
(
cpuFreqGHz
*
1000
.
0
)));
}
static
inline
void
polar_rate_matching
(
t_nrPolar_paramsPtr
polarParams
,
void
*
in
,
void
*
out
)
__attribute__
((
always_inline
));
static
inline
void
polar_rate_matching
(
t_nrPolar_paramsPtr
polarParams
,
void
*
in
,
void
*
out
)
__attribute__
((
always_inline
));
static
inline
void
polar_rate_matching
(
t_nrPolar_paramsPtr
polarParams
,
void
*
in
,
void
*
out
)
{
static
inline
void
polar_rate_matching
(
t_nrPolar_paramsPtr
polarParams
,
void
*
in
,
void
*
out
)
{
...
@@ -368,7 +295,6 @@ static inline void polar_rate_matching(t_nrPolar_paramsPtr polarParams,void *in,
...
@@ -368,7 +295,6 @@ static inline void polar_rate_matching(t_nrPolar_paramsPtr polarParams,void *in,
}
}
void
build_polar_tables
(
t_nrPolar_paramsPtr
polarParams
)
{
void
build_polar_tables
(
t_nrPolar_paramsPtr
polarParams
)
{
// build table b -> c'
// build table b -> c'
...
@@ -440,19 +366,19 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) {
...
@@ -440,19 +366,19 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) {
}
}
iplast
=
ip
;
iplast
=
ip
;
}
}
AssertFatal
(
mingroupsize
==
8
||
mingroupsize
==
16
,
"mingroupsize %d, needs to be handled
\n
"
);
AssertFatal
(
mingroupsize
==
8
||
mingroupsize
==
16
,
"mingroupsize %d, needs to be handled
\n
"
,
mingroupsize
);
polarParams
->
groupsize
=
mingroupsize
;
polarParams
->
groupsize
=
mingroupsize
;
int
shift
=
3
;
int
shift
=
3
;
if
(
mingroupsize
==
16
)
shift
=
4
;
if
(
mingroupsize
==
16
)
shift
=
4
;
polarParams
->
rm_tab
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
polarParams
->
encoderLength
/
mingroupsize
);
polarParams
->
rm_tab
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
polarParams
->
encoderLength
/
mingroupsize
);
// rerun again to create groups
// rerun again to create groups
int
tcnt
;
int
tcnt
=
0
;
for
(
int
outpos
=
0
;
outpos
<
polarParams
->
encoderLength
;
outpos
+=
mingroupsize
,
tcnt
++
)
for
(
int
outpos
=
0
;
outpos
<
polarParams
->
encoderLength
;
outpos
+=
mingroupsize
,
tcnt
++
)
polarParams
->
rm_tab
[
tcnt
]
=
polarParams
->
rate_matching_pattern
[
outpos
]
>>
shift
;
polarParams
->
rm_tab
[
tcnt
]
=
polarParams
->
rate_matching_pattern
[
outpos
]
>>
shift
;
}
}
void
polar_encoder_fast
(
int64_t
*
A
,
void
polar_encoder_fast
(
u
int64_t
*
A
,
uint32_t
*
out
,
uint32_t
*
out
,
int32_t
crcmask
,
int32_t
crcmask
,
t_nrPolar_paramsPtr
polarParams
)
{
t_nrPolar_paramsPtr
polarParams
)
{
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c
View file @
1da3a24c
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void
nr_matrix_multiplication_uint8_
t_1D_uint8_t
_2D
(
uint8_t
*
matrix1
,
uint8_t
**
matrix2
,
void
nr_matrix_multiplication_uint8_
1D_uint8
_2D
(
uint8_t
*
matrix1
,
uint8_t
**
matrix2
,
uint8_t
*
output
,
uint16_t
row
,
uint16_t
col
)
{
uint8_t
*
output
,
uint16_t
row
,
uint16_t
col
)
{
for
(
uint16_t
i
=
0
;
i
<
col
;
i
++
)
{
for
(
uint16_t
i
=
0
;
i
<
col
;
i
++
)
{
...
@@ -43,12 +43,12 @@ void nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(uint8_t *matrix1, uint8_t **
...
@@ -43,12 +43,12 @@ void nr_matrix_multiplication_uint8_t_1D_uint8_t_2D(uint8_t *matrix1, uint8_t **
}
}
}
}
uint8_t
***
nr_alloc_uint8_
t_
3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
zlen
)
{
uint8_t
***
nr_alloc_uint8_3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
zlen
)
{
uint8_t
***
output
;
uint8_t
***
output
;
int
i
,
j
;
int
i
,
j
;
if
((
output
=
malloc
(
xlen
*
sizeof
(
*
output
)))
==
NULL
)
{
if
((
output
=
malloc
(
xlen
*
sizeof
(
*
output
)))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_
t_
3D_array] Problem at 1D allocation"
);
perror
(
"[nr_alloc_uint8_3D_array] Problem at 1D allocation"
);
return
NULL
;
return
NULL
;
}
}
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
i
=
0
;
i
<
xlen
;
i
++
)
...
@@ -57,8 +57,8 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen
...
@@ -57,8 +57,8 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
i
=
0
;
i
<
xlen
;
i
++
)
if
((
output
[
i
]
=
malloc
(
ylen
*
sizeof
*
output
[
i
]))
==
NULL
)
{
if
((
output
[
i
]
=
malloc
(
ylen
*
sizeof
*
output
[
i
]))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_
t_
3D_array] Problem at 2D allocation"
);
perror
(
"[nr_alloc_uint8_3D_array] Problem at 2D allocation"
);
nr_free_uint8_
t_
3D_array
(
output
,
xlen
,
ylen
);
nr_free_uint8_3D_array
(
output
,
xlen
,
ylen
);
return
NULL
;
return
NULL
;
}
}
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
i
=
0
;
i
<
xlen
;
i
++
)
...
@@ -69,14 +69,39 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen
...
@@ -69,14 +69,39 @@ uint8_t ***nr_alloc_uint8_t_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
j
=
0
;
j
<
ylen
;
j
++
)
for
(
j
=
0
;
j
<
ylen
;
j
++
)
if
((
output
[
i
][
j
]
=
malloc
(
zlen
*
sizeof
*
output
[
i
][
j
]))
==
NULL
)
{
if
((
output
[
i
][
j
]
=
malloc
(
zlen
*
sizeof
*
output
[
i
][
j
]))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_
t_
3D_array] Problem at 3D allocation"
);
perror
(
"[nr_alloc_uint8_3D_array] Problem at 3D allocation"
);
nr_free_uint8_
t_
3D_array
(
output
,
xlen
,
ylen
);
nr_free_uint8_3D_array
(
output
,
xlen
,
ylen
);
return
NULL
;
return
NULL
;
}
}
return
output
;
return
output
;
}
}
uint8_t
**
nr_alloc_uint8_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
)
{
uint8_t
**
output
;
int
i
,
j
;
if
((
output
=
malloc
(
xlen
*
sizeof
(
*
output
)))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_2D_array] Problem at 1D allocation"
);
return
NULL
;
}
for
(
i
=
0
;
i
<
xlen
;
i
++
)
output
[
i
]
=
NULL
;
for
(
i
=
0
;
i
<
xlen
;
i
++
)
if
((
output
[
i
]
=
malloc
(
ylen
*
sizeof
*
output
[
i
]))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_2D_array] Problem at 2D allocation"
);
nr_free_uint8_2D_array
(
output
,
xlen
);
return
NULL
;
}
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
j
=
0
;
j
<
ylen
;
j
++
)
output
[
i
][
j
]
=
0
;
return
output
;
}
double
***
nr_alloc_double_3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
zlen
)
{
double
***
nr_alloc_double_3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
zlen
)
{
double
***
output
;
double
***
output
;
int
i
,
j
;
int
i
,
j
;
...
@@ -137,31 +162,6 @@ double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) {
...
@@ -137,31 +162,6 @@ double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) {
return
output
;
return
output
;
}
}
uint8_t
**
nr_alloc_uint8_t_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
)
{
uint8_t
**
output
;
int
i
,
j
;
if
((
output
=
malloc
(
xlen
*
sizeof
(
*
output
)))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_t_2D_array] Problem at 1D allocation"
);
return
NULL
;
}
for
(
i
=
0
;
i
<
xlen
;
i
++
)
output
[
i
]
=
NULL
;
for
(
i
=
0
;
i
<
xlen
;
i
++
)
if
((
output
[
i
]
=
malloc
(
ylen
*
sizeof
*
output
[
i
]))
==
NULL
)
{
perror
(
"[nr_alloc_uint8_t_2D_array] Problem at 2D allocation"
);
nr_free_uint8_t_2D_array
(
output
,
xlen
);
return
NULL
;
}
for
(
i
=
0
;
i
<
xlen
;
i
++
)
for
(
j
=
0
;
j
<
ylen
;
j
++
)
output
[
i
][
j
]
=
0
;
return
output
;
}
void
nr_free_double_3D_array
(
double
***
input
,
uint16_t
xlen
,
uint16_t
ylen
)
{
void
nr_free_double_3D_array
(
double
***
input
,
uint16_t
xlen
,
uint16_t
ylen
)
{
int
i
,
j
;
int
i
,
j
;
...
@@ -174,7 +174,16 @@ void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
...
@@ -174,7 +174,16 @@ void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
free
(
input
);
free
(
input
);
}
}
void
nr_free_uint8_t_3D_array
(
uint8_t
***
input
,
uint16_t
xlen
,
uint16_t
ylen
)
{
void
nr_free_double_2D_array
(
double
**
input
,
uint16_t
xlen
)
{
int
i
;
for
(
i
=
0
;
i
<
xlen
;
i
++
)
{
free
(
input
[
i
]);
}
free
(
input
);
}
void
nr_free_uint8_3D_array
(
uint8_t
***
input
,
uint16_t
xlen
,
uint16_t
ylen
)
{
int
i
,
j
;
int
i
,
j
;
for
(
i
=
0
;
i
<
xlen
;
i
++
)
{
for
(
i
=
0
;
i
<
xlen
;
i
++
)
{
...
@@ -186,20 +195,11 @@ void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
...
@@ -186,20 +195,11 @@ void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
free
(
input
);
free
(
input
);
}
}
void
nr_free_uint8_
t_
2D_array
(
uint8_t
**
input
,
uint16_t
xlen
)
{
void
nr_free_uint8_2D_array
(
uint8_t
**
input
,
uint16_t
xlen
)
{
for
(
int
i
=
0
;
i
<
xlen
;
i
++
)
free
(
input
[
i
]);
for
(
int
i
=
0
;
i
<
xlen
;
i
++
)
free
(
input
[
i
]);
free
(
input
);
free
(
input
);
}
}
void
nr_free_double_2D_array
(
double
**
input
,
uint16_t
xlen
)
{
int
i
;
for
(
i
=
0
;
i
<
xlen
;
i
++
)
{
free
(
input
[
i
]);
}
free
(
input
);
}
// Modified Bubble Sort.
// Modified Bubble Sort.
void
nr_sort_asc_double_1D_array_ind
(
double
*
matrix
,
uint8_t
*
ind
,
uint8_t
len
)
{
void
nr_sort_asc_double_1D_array_ind
(
double
*
matrix
,
uint8_t
*
ind
,
uint8_t
len
)
{
int
swaps
;
int
swaps
;
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
View file @
1da3a24c
...
@@ -325,7 +325,7 @@ void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp
...
@@ -325,7 +325,7 @@ void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp
if
(
(
K
/
(
double
)
E
)
<=
(
7
.
0
/
16
)
)
{
//puncturing
if
(
(
K
/
(
double
)
E
)
<=
(
7
.
0
/
16
)
)
{
//puncturing
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
0
;
}
else
{
//shortening
}
else
{
//shortening
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
INFINITY
;
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
++
){
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
){
...
...
openair1/PHY/CODING/nr_compute_tbs.c
View file @
1da3a24c
...
@@ -68,7 +68,7 @@ uint32_t nr_compute_tbs(uint8_t mcs,
...
@@ -68,7 +68,7 @@ uint32_t nr_compute_tbs(uint8_t mcs,
uint8_t
Nl
)
uint8_t
Nl
)
{
{
uint16_t
nbp_re
,
nb_re
,
nb_dmrs_prb
,
nb_rb_oh
,
Ninfo
,
Np_info
,
n
,
Qm
,
R
,
C
;
uint16_t
nbp_re
,
nb_re
,
nb_dmrs_prb
,
nb_rb_oh
,
Ninfo
,
Np_info
,
n
,
Qm
,
R
,
C
;
uint32_t
nr_tbs
;
uint32_t
nr_tbs
=
0
;
//Initialization to remove [-Wmaybe-uninitialized]
nb_rb_oh
=
0
;
//set to 0 if not configured by higher layer
nb_rb_oh
=
0
;
//set to 0 if not configured by higher layer
Qm
=
Mcsindextable1
[
mcs
][
0
];
Qm
=
Mcsindextable1
[
mcs
][
0
];
...
...
openair1/PHY/CODING/nr_segmentation.c
View file @
1da3a24c
...
@@ -39,7 +39,7 @@ int32_t nr_segmentation(unsigned char *input_buffer,
...
@@ -39,7 +39,7 @@ int32_t nr_segmentation(unsigned char *input_buffer,
unsigned
int
*
F
)
unsigned
int
*
F
)
{
{
unsigned
int
L
,
Bprime
,
Bprime_by_C
,
Z
,
r
,
Kb
,
k
,
s
,
crc
,
Kprime
;
unsigned
int
L
,
Bprime
,
Bprime_by_C
,
Z
,
r
,
Kb
,
k
,
s
,
Kprime
;
//crc
if
(
B
<=
8448
)
{
if
(
B
<=
8448
)
{
L
=
0
;
L
=
0
;
...
...
openair1/PHY/INIT/nr_parms.c
View file @
1da3a24c
...
@@ -174,11 +174,13 @@ int nr_init_frame_parms0(
...
@@ -174,11 +174,13 @@ int nr_init_frame_parms0(
}
}
int
nr_init_frame_parms
(
nfapi_nr_config_request_t
*
config
,
int
nr_init_frame_parms
(
nfapi_nr_config_request_t
*
config
,
NR_DL_FRAME_PARMS
*
fp
)
{
NR_DL_FRAME_PARMS
*
fp
)
{
nr_init_frame_parms0
(
fp
,
nr_init_frame_parms0
(
fp
,
config
->
subframe_config
.
numerology_index_mu
.
value
,
config
->
subframe_config
.
numerology_index_mu
.
value
,
config
->
subframe_config
.
dl_cyclic_prefix_type
.
value
);
config
->
subframe_config
.
dl_cyclic_prefix_type
.
value
);
return
0
;
}
}
int
nr_init_frame_parms_ue
(
NR_DL_FRAME_PARMS
*
fp
,
int
nr_init_frame_parms_ue
(
NR_DL_FRAME_PARMS
*
fp
,
...
...
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
View file @
1da3a24c
...
@@ -687,7 +687,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
...
@@ -687,7 +687,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
int
dlsch_encoding
(
PHY_VARS_eNB
*
eNB
,
int
dlsch_encoding
(
PHY_VARS_eNB
*
eNB
,
unsigned
char
*
a
,
unsigned
char
*
a
,
uint8_t
num_pdcch_symbols
,
uint8_t
num_pdcch_symbols
,
LTE_eNB_DLSCH_t
*
dlsch
,
LTE_eNB_DLSCH_t
*
dlsch
,
int
frame
,
int
frame
,
...
...
openair1/PHY/NR_TRANSPORT/nr_pbch.c
View file @
1da3a24c
...
@@ -265,7 +265,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -265,7 +265,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#endif
#endif
// Payload interleaving
// Payload interleaving
uint32_t
in
=
0
,
out
=
0
;
uint32_t
in
=
0
;
//
, out=0;
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
;
i
++
)
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
;
i
++
)
in
|=
(
uint32_t
)(
pbch
->
pbch_a
[
i
]
<<
((
3
-
i
)
<<
3
));
in
|=
(
uint32_t
)(
pbch
->
pbch_a
[
i
]
<<
((
3
-
i
)
<<
3
));
...
...
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