Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
Michael Black
OpenXG UE
Commits
d7e537fa
Commit
d7e537fa
authored
Mar 08, 2019
by
yilmazt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working short block coding and various warning removals in --phy_simulators
parent
83345534
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
762 additions
and
598 deletions
+762
-598
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+11
-2
openair1/PHY/CODING/TESTBENCH/ldpctest.c
openair1/PHY/CODING/TESTBENCH/ldpctest.c
+4
-4
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+39
-44
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
+169
-0
openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
+3
-3
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+19
-289
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+57
-70
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+122
-154
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+7
-7
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
+27
-15
openair1/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
openair1/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
+117
-0
openair1/PHY/CODING/nrSmallBlock/encodeSmall.c
openair1/PHY/CODING/nrSmallBlock/encodeSmall.c
+0
-0
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
+44
-0
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
+134
-0
openair1/PHY/CODING/nr_polar_init.c
openair1/PHY/CODING/nr_polar_init.c
+9
-10
No files found.
cmake_targets/CMakeLists.txt
View file @
d7e537fa
...
...
@@ -1143,15 +1143,19 @@ set(PHY_POLARSRC
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_sequence_pattern.c
)
set
(
PHY_SMALLBLOCKSRC
${
OPENAIR1_DIR
}
/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
)
set
(
PHY_TURBOIF
${
OPENAIR1_DIR
}
/PHY/CODING/coding_load.c
)
)
set
(
PHY_LDPCSRC
${
OPENAIR1_DIR
}
/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
)
)
add_library
(
coding MODULE
${
PHY_TURBOSRC
}
)
...
...
@@ -1326,6 +1330,7 @@ set(PHY_SRC_UE
${
OPENAIR1_DIR
}
/PHY/TOOLS/time_meas.c
${
OPENAIR1_DIR
}
/PHY/TOOLS/lut.c
${
PHY_POLARSRC
}
${
PHY_SMALLBLOCKSRC
}
${
PHY_LDPCSRC
}
)
...
...
@@ -1372,6 +1377,7 @@ set(PHY_SRC_UE
${
OPENAIR1_DIR
}
/PHY/INIT/nr_init_ue.c
# ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c
${
PHY_POLARSRC
}
${
PHY_SMALLBLOCKSRC
}
${
PHY_LDPCSRC
}
)
...
...
@@ -2558,6 +2564,9 @@ target_link_libraries (dlsim_tm4
add_executable
(
polartest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/polartest.c
)
target_link_libraries
(
polartest SIMU PHY PHY_NR PHY_COMMON m
${
ATLAS_LIBRARIES
}
)
add_executable
(
smallblocktest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/smallblocktest.c
)
target_link_libraries
(
smallblocktest SIMU PHY PHY_NR PHY_COMMON m
${
ATLAS_LIBRARIES
}
)
add_executable
(
ldpctest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/ldpctest.c
)
target_link_libraries
(
ldpctest SIMU PHY PHY_NR m
${
ATLAS_LIBRARIES
}
)
...
...
openair1/PHY/CODING/TESTBENCH/ldpctest.c
View file @
d7e537fa
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
d7e537fa
...
...
@@ -62,7 +62,6 @@ int main(int argc, char *argv[]) {
int16_t
nBitError
=
0
;
// -1 = Decoding failed (All list entries have failed the CRC checks).
uint32_t
decoderState
=
0
,
blockErrorState
=
0
;
//0 = Success, -1 = Decoding failed, 1 = Block Error.
uint16_t
testLength
=
0
,
coderLength
=
0
,
blockErrorCumulative
=
0
,
bitErrorCumulative
=
0
;
double
timeEncoderCumulative
=
0
,
timeDecoderCumulative
=
0
;
uint8_t
aggregation_level
=
8
,
decoderListSize
=
8
,
pathMetricAppr
=
0
,
matlabDebug
=
0
;
while
((
arguments
=
getopt
(
argc
,
argv
,
"s:d:f:c:i:l:a:hqgm"
))
!=
-
1
)
...
...
@@ -217,7 +216,7 @@ int main(int argc, char *argv[]) {
memset
(
dci_estimation
,
0
,
sizeof
(
uint32_t
)
*
4
);
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
]);
nr_bit2byte_uint32_8
_t
(
encoder_output
,
currentPtrDCI
->
encoderLength
,
encoder_outputByte
);
nr_bit2byte_uint32_8
(
encoder_output
,
currentPtrDCI
->
encoderLength
,
encoder_outputByte
);
printf
(
"[polartest] encoder_outputByte: "
);
for
(
int
i
=
0
;
i
<
currentPtrDCI
->
encoderLength
;
i
++
)
printf
(
"%d-"
,
encoder_outputByte
[
i
]);
printf
(
"
\n
"
);
...
...
@@ -257,7 +256,7 @@ int main(int argc, char *argv[]) {
uint32_t
testInputcrc2
=
0x00291880
;
uint8_t
testInputCRC2
[
8
];
nr_crc_bit2bit_uint32_8
_t
(
testInputCRC
,
32
,
testInputCRC2
);
nr_crc_bit2bit_uint32_8
(
testInputCRC
,
32
,
testInputCRC2
);
printf
(
"testInputCRC2: [0]->%x
\t
[1]->%x
\t
[2]->%x
\t
[3]->%x
\n
"
" [4]->%x
\t
[5]->%x
\t
[6]->%x
\t
[7]->%x
\n
"
,
testInputCRC2
[
0
],
testInputCRC2
[
1
],
testInputCRC2
[
2
],
testInputCRC2
[
3
],
...
...
@@ -420,11 +419,11 @@ int main(int argc, char *argv[]) {
uint8_t
nr_pbch_interleaver
[
NR_POLAR_PBCH_PAYLOAD_BITS
];
memset
((
void
*
)
nr_pbch_interleaver
,
0
,
NR_POLAR_PBCH_PAYLOAD_BITS
);
nr_init_pbch_interleaver
(
nr_pbch_interleaver
);
for
(
int
i
=
0
;
i
<=
31
;
i
++
)
/*
for (int i=0; i<=31;i++)
printf("nr_pbch_interleaver[%d]=%d\n",i,nr_pbch_interleaver[i]);
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
printf
(
"nr_pbch_interleaver_operation[%d]=%d
\n
"
,
i
,(
*
(
nr_pbch_interleaver
+
i
)));
printf("nr_pbch_interleaver_operation[%d]=%d\n",i,(*(nr_pbch_interleaver+i)));
*/
start_meas
(
&
timeEncoder
);
...
...
@@ -438,25 +437,28 @@ int main(int argc, char *argv[]) {
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
//Bit-to-byte:
nr_bit2byte_uint32_8
_t
(
encoderOutput
,
coderLength
,
encoderOutputByte
);
nr_bit2byte_uint32_8
(
encoderOutput
,
coderLength
,
encoderOutputByte
);
//BPSK modulation
for
(
int
i
=
0
;
i
<
coderLength
;
i
++
)
{
if
(
encoderOutputByte
[
i
]
==
0
)
modulatedInput
[
i
]
=
1
/
sqrt
(
2
);
modulatedInput
[
i
]
=
1
;
//modulatedInput[i]=1/sqrt(2);
else
modulatedInput
[
i
]
=
(
-
1
)
/
sqrt
(
2
);
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
2
*
SNR_lin
)));
modulatedInput
[
i
]
=
(
-
1
);
//modulatedInput[i]=((-1)/sqrt(2));
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
SNR_lin
)));
//channelOutput[i] = modulatedInput[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin)));
if
(
decoder_int16
==
1
)
{
if
(
channelOutput
[
i
]
>
15
)
channelOutput_int16
[
i
]
=
127
;
else
if
(
channelOutput
[
i
]
<
-
16
)
channelOutput_int16
[
i
]
=
-
128
;
else
channelOutput_int16
[
i
]
=
(
int16_t
)
(
8
*
channelOutput
[
i
]);
if
(
channelOutput
[
i
]
>
15
)
channelOutput_int16
[
i
]
=
127
;
else
if
(
channelOutput
[
i
]
<
-
16
)
channelOutput_int16
[
i
]
=
-
128
;
else
channelOutput_int16
[
i
]
=
(
int16_t
)
(
8
*
channelOutput
[
i
]);
}
}
start_meas
(
&
timeDecoder
);
...
...
@@ -466,44 +468,38 @@ int main(int argc, char *argv[]) {
NR_POLAR_DECODER_LISTSIZE,
aPrioriArray,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);*/
if
(
decoder_int16
==
0
)
if
(
decoder_int16
==
1
)
decoderState
=
polar_decoder_int16
(
channelOutput_int16
,
(
uint64_t
*
)
estimatedOutput
,
currentPtr
);
else
decoderState
=
polar_decoder_aPriori
(
channelOutput
,
estimatedOutput
,
currentPtr
,
estimatedOutput
,
currentPtr
,
NR_POLAR_DECODER_LISTSIZE
,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION
,
aPrioriArray
);
else
decoderState
=
polar_decoder_int16
(
channelOutput_int16
,
(
uint64_t
*
)
estimatedOutput
,
currentPtr
);
stop_meas
(
&
timeDecoder
);
/*printf("testInput: [0]->0x%08x\n", testInput[0]);
printf("estimatedOutput: [0]->0x%08x\n", estimatedOutput[0]);*/
//calculate errors
if
(
decoderState
!=
0
)
{
blockErrorState
=-
1
;
nBitError
=-
1
;
}
else
{
for
(
int
j
=
0
;
j
<
currentPtr
->
payloadBits
;
j
++
)
{
if
(((
estimatedOutput
[
0
]
>>
j
)
&
1
)
!=
((
testInput
[
0
]
>>
j
)
&
1
))
nBitError
++
;
if
(((
estimatedOutput
[
0
]
>>
j
)
&
1
)
!=
((
testInput
[
0
]
>>
j
)
&
1
))
nBitError
++
;
// printf("bit %d: %d => %d\n",j,(testInput[0]>>j)&1,(estimatedOutput[0]>>j)&1);
}
if
(
nBitError
>
0
)
{
blockErrorState
=
1
;
//
printf("Error: Input %x, Output %x\n",testInput[0],estimatedOutput[0]);
//
printf("Error: Input %x, Output %x\n",testInput[0],estimatedOutput[0]);
}
}
//Iteration times are in microseconds.
timeEncoderCumulative
+=
(
timeEncoder
.
diff
/
(
cpu_freq_GHz
*
1000
.
0
));
timeDecoderCumulative
+=
(
timeDecoder
.
diff
/
(
cpu_freq_GHz
*
1000
.
0
));
fprintf
(
logFile
,
",%f,%d,%d,%f,%f
\n
"
,
SNR
,
nBitError
,
blockErrorState
,
(
timeEncoder
.
diff
/
(
cpu_freq_GHz
*
1000
.
0
)),
(
timeDecoder
.
diff
/
(
cpu_freq_GHz
*
1000
.
0
)));
...
...
@@ -521,17 +517,16 @@ int main(int argc, char *argv[]) {
}
//Calculate error statistics for the SNR.
printf
(
"[ListSize=%d, Appr=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%
9.3fus, t_Decoder=%9.3
fus
\n
"
,
printf
(
"[ListSize=%d, Appr=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%
12.6fus, t_Decoder=%12.6
fus
\n
"
,
decoderListSize
,
pathMetricAppr
,
SNR
,
((
double
)
blockErrorCumulative
/
iterations
),
((
double
)
bitErrorCumulative
/
(
iterations
*
testLength
)),
(
double
)
timeEncoder
.
diff
/
timeEncoder
.
trials
/
(
cpu_freq_GHz
*
1000
.
0
),(
double
)
timeDecoder
.
diff
/
timeDecoder
.
trials
/
(
cpu_freq_GHz
*
1000
.
0
));
//(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations
);
(
double
)
timeEncoder
.
diff
/
timeEncoder
.
trials
/
(
cpu_freq_GHz
*
1000
.
0
),
(
double
)
timeDecoder
.
diff
/
timeDecoder
.
trials
/
(
cpu_freq_GHz
*
1000
.
0
)
);
if
(
blockErrorCumulative
==
0
&&
bitErrorCumulative
==
0
)
break
;
blockErrorCumulative
=
0
;
bitErrorCumulative
=
0
;
timeEncoderCumulative
=
0
;
timeDecoderCumulative
=
0
;
}
print_meas
(
&
timeEncoder
,
"polar_encoder"
,
NULL
,
NULL
);
...
...
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
0 → 100644
View file @
d7e537fa
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
#include "SIMULATION/TOOLS/sim.h"
#include <getopt.h>
//#define DEBUG_SMALLBLOCKTEST
signed
char
quantize
(
double
D
,
double
x
,
unsigned
char
B
)
{
double
qxd
;
short
maxlev
;
qxd
=
floor
(
x
/
D
);
maxlev
=
1
<<
(
B
-
1
);
//(char)(pow(2,B-1));
if
(
qxd
<=
-
maxlev
)
qxd
=
-
maxlev
;
else
if
(
qxd
>=
maxlev
)
qxd
=
maxlev
-
1
;
return
((
char
)
qxd
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
time_stats_t
timeEncoder
,
timeDecoder
;
opp_enabled
=
1
;
cpu_freq_GHz
=
get_cpu_freq_GHz
();
reset_meas
(
&
timeEncoder
);
reset_meas
(
&
timeDecoder
);
randominit
(
0
);
int
arguments
,
iterations
=
1000
,
matlabDebug
=
0
,
messageLength
=
11
;
uint32_t
testInput
,
encoderOutput
,
codingDifference
,
nBitError
=
0
,
blockErrorState
=
0
,
blockErrorCumulative
=
0
,
bitErrorCumulative
=
0
;
uint16_t
estimatedOutput
;
double
SNRstart
=
-
20
.
0
,
SNRstop
=
5
.
0
,
SNRinc
=
0
.
5
;
//dB
double
SNR
,
SNR_lin
,
sigma
;
double
modulatedInput
[
NR_SMALL_BLOCK_CODED_BITS
],
channelOutput
[
NR_SMALL_BLOCK_CODED_BITS
];
int16_t
channelOutput_int16
[
NR_SMALL_BLOCK_CODED_BITS
];
int8_t
channelOutput_int8
[
NR_SMALL_BLOCK_CODED_BITS
];
unsigned
char
qbits
=
8
;
while
((
arguments
=
getopt
(
argc
,
argv
,
"s:d:f:l:i:mhg"
))
!=
-
1
)
switch
(
arguments
)
{
case
's'
:
SNRstart
=
atof
(
optarg
);
break
;
case
'd'
:
SNRinc
=
atof
(
optarg
);
break
;
case
'f'
:
SNRstop
=
atof
(
optarg
);
break
;
case
'l'
:
messageLength
=
atoi
(
optarg
);
break
;
case
'i'
:
iterations
=
atoi
(
optarg
);
break
;
case
'm'
:
matlabDebug
=
1
;
//#define DEBUG_POLAR_MATLAB
break
;
case
'g'
:
iterations
=
1
;
SNRstart
=
-
6
.
0
;
SNRstop
=
-
6
.
0
;
messageLength
=
11
;
break
;
case
'h'
:
printf
(
"./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations -m Matlab Debug
\n
"
);
exit
(
-
1
);
default:
perror
(
"[smallblocktest.c] Problem at argument parsing with getopt"
);
exit
(
-
1
);
}
uint16_t
mask
=
0x07ff
>>
(
11
-
messageLength
);
for
(
SNR
=
SNRstart
;
SNR
<=
SNRstop
;
SNR
+=
SNRinc
)
{
printf
(
"SNR %f
\n
"
,
SNR
);
SNR_lin
=
pow
(
10
,
SNR
/
10
.
0
);
sigma
=
1
.
0
/
sqrt
(
SNR_lin
);
for
(
int
itr
=
1
;
itr
<=
iterations
;
itr
++
)
{
//Generate random test input of length "messageLength"
testInput
=
0
;
for
(
int
i
=
1
;
i
<
messageLength
;
i
++
)
{
testInput
|=
(
((
uint32_t
)
(
rand
()
%
2
))
&
1
);
testInput
<<=
1
;
}
testInput
|=
(
((
uint32_t
)
(
rand
()
%
2
))
&
1
);
//Encoding
start_meas
(
&
timeEncoder
);
encoderOutput
=
encodeSmallBlock
((
uint16_t
*
)
&
testInput
,
(
uint8_t
)
messageLength
);
stop_meas
(
&
timeEncoder
);
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
i
++
)
{
//BPSK modulation
if
((
encoderOutput
>>
i
)
&
1
)
{
modulatedInput
[
i
]
=-
1
;
}
else
{
modulatedInput
[
i
]
=
1
;
}
//AWGN
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
SNR_lin
)
)
);
//Quantization
channelOutput_int8
[
i
]
=
quantize
(
sigma
/
16
.
0
,
channelOutput
[
i
],
qbits
);
}
//Decoding
start_meas
(
&
timeDecoder
);
estimatedOutput
=
decodeSmallBlock
(
channelOutput_int8
,
(
uint8_t
)
messageLength
);
stop_meas
(
&
timeDecoder
);
#ifdef DEBUG_SMALLBLOCKTEST
printf
(
"[smallblocktest] Input = 0x%x, Output = 0x%x, DecoderOutput = 0x%x
\n
"
,
testInput
,
encoderOutput
,
estimatedOutput
);
for
(
int
i
=
0
;
i
<
32
;
i
++
)
printf
(
"[smallblocktest] Input[%d] = %d, Output[%d] = %d, Mask[%d] = %d
\n
"
,
i
,
(
testInput
>>
i
)
&
1
,
i
,
(
estimatedOutput
>>
i
)
&
1
,
i
,
(
mask
>>
i
)
&
1
);
#endif
//Error Calculation
estimatedOutput
&=
mask
;
codingDifference
=
((
uint32_t
)
estimatedOutput
)
^
testInput
;
// Count the # of 1's in codingDifference by Brian Kernighan’s algorithm.
//for (int i=0;i<32;i++)
//printf("[smallblocktest] Input[%d] = %d, Output[%d] = %d, codingDifference[%d]=%d, Mask[%d] = %d, bitError = %d\n", i, (testInput>>i)&1, i, (estimatedOutput>>i)&1, i, (codingDifference>>i)&1, i, (mask>>i)&1, nBitError);
for
(
nBitError
=
0
;
codingDifference
;
nBitError
++
)
codingDifference
&=
codingDifference
-
1
;
blockErrorState
=
(
nBitError
>
0
)
?
1
:
0
;
blockErrorCumulative
+=
blockErrorState
;
bitErrorCumulative
+=
nBitError
;
nBitError
=
0
;
blockErrorState
=
0
;
}
//Error statistics for the SNR; iteration times are in nanoseconds and microseconds, respectively.
printf
(
"[smallblocktest] SNR=%+7.3f, BER=%9.6f, BLER=%9.6f, t_Encoder=%9.3fns, t_Decoder=%7.3fus
\n
"
,
SNR
,
((
double
)
bitErrorCumulative
/
(
iterations
*
messageLength
)),
((
double
)
blockErrorCumulative
/
iterations
),
((
double
)
timeEncoder
.
diff
/
timeEncoder
.
trials
)
/
(
cpu_freq_GHz
),
((
double
)
timeDecoder
.
diff
/
timeDecoder
.
trials
)
/
(
cpu_freq_GHz
*
1000
.
0
));
blockErrorCumulative
=
0
;
bitErrorCumulative
=
0
;
}
print_meas
(
&
timeEncoder
,
"smallblock_encoder"
,
NULL
,
NULL
);
print_meas
(
&
timeDecoder
,
"smallblock_decoder"
,
NULL
,
NULL
);
return
(
0
);
}
openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
View file @
d7e537fa
...
...
@@ -21,7 +21,7 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void
nr_bit2byte_uint32_8
_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
)
{
void
nr_bit2byte_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
)
{
uint8_t
arrayInd
=
ceil
(
arraySize
/
32
.
0
);
for
(
int
i
=
0
;
i
<
(
arrayInd
-
1
);
i
++
)
{
for
(
int
j
=
0
;
j
<
32
;
j
++
)
{
...
...
@@ -32,7 +32,7 @@ void nr_bit2byte_uint32_8_t(uint32_t *in, uint16_t arraySize, uint8_t *out) {
for
(
int
j
=
0
;
j
<
arraySize
-
((
arrayInd
-
1
)
*
32
);
j
++
)
out
[
j
+
((
arrayInd
-
1
)
*
32
)]
=
(
in
[(
arrayInd
-
1
)]
>>
j
)
&
1
;
}
void
nr_byte2bit_uint8_32
_t
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
)
{
void
nr_byte2bit_uint8_32
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
)
{
uint8_t
arrayInd
=
ceil
(
arraySize
/
32
.
0
);
for
(
int
i
=
0
;
i
<
arrayInd
;
i
++
)
{
out
[
i
]
=
0
;
...
...
@@ -44,7 +44,7 @@ void nr_byte2bit_uint8_32_t(uint8_t *in, uint16_t arraySize, uint32_t *out) {
}
}
void
nr_crc_bit2bit_uint32_8
_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
)
{
void
nr_crc_bit2bit_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
)
{
out
[
0
]
=
0xff
;
out
[
1
]
=
0xff
;
out
[
2
]
=
0xff
;
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
d7e537fa
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
View file @
d7e537fa
...
...
@@ -73,7 +73,6 @@ void updateBit(uint8_t ***bit,
uint16_t
xlen
,
uint8_t
ylen
)
{
uint16_t
offset
=
(
xlen
/
(
pow
(
2
,(
ylen
-
col
)))
);
for
(
uint8_t
i
=
0
;
i
<
listSize
;
i
++
)
{
...
...
@@ -107,7 +106,6 @@ void updatePathMetric(double *pathMetric,
}
}
void
updatePathMetric2
(
double
*
pathMetric
,
double
***
llr
,
uint8_t
listSize
,
...
...
@@ -139,10 +137,7 @@ void updatePathMetric2(double *pathMetric,
}
free
(
tempPM
);
}
}
void
computeLLR
(
double
***
llr
,
uint16_t
row
,
...
...
@@ -161,8 +156,6 @@ void computeLLR(double ***llr,
}
else
{
//eq. (8a)
llr
[
row
][
col
][
i
]
=
log
((
exp
(
a
+
b
)
+
1
)
/
(
exp
(
a
)
+
exp
(
b
)));
}
}
void
updateCrcChecksum
(
uint8_t
**
crcChecksum
,
...
...
@@ -191,9 +184,16 @@ void updateCrcChecksum2(uint8_t **crcChecksum,
}
}
void
build_decoder_tree
(
t_nrPolar_params
*
polarParams
)
{
polarParams
->
tree
.
num_nodes
=
0
;
polarParams
->
tree
.
root
=
add_nodes
(
polarParams
->
n
,
0
,
polarParams
);
#ifdef DEBUG_NEW_IMPL
printf
(
"root : left %p, right %p
\n
"
,
polarParams
->
tree
.
root
->
left
,
polarParams
->
tree
.
root
->
right
);
#endif
}
decoder_node_t
*
new_decoder_node
(
int
first_leaf_index
,
int
level
)
{
decoder_node_t
*
new_decoder_node
(
int
first_leaf_index
,
int
level
)
{
decoder_node_t
*
node
=
(
decoder_node_t
*
)
malloc
(
sizeof
(
decoder_node_t
));
...
...
@@ -208,32 +208,34 @@ decoder_node_t *new_decoder_node(int first_leaf_index,int level) {
node
->
beta
=
(
int16_t
*
)
malloc16
(
node
->
Nv
*
sizeof
(
int16_t
));
memset
((
void
*
)
node
->
beta
,
-
1
,
node
->
Nv
*
sizeof
(
int16_t
));
return
(
node
);
}
decoder_node_t
*
add_nodes
(
int
level
,
int
first_leaf_index
,
t_nrPolar_params
*
pp
)
{
decoder_node_t
*
add_nodes
(
int
level
,
int
first_leaf_index
,
t_nrPolar_params
*
polarParams
)
{
int
all_frozen_below
=
1
;
int
all_frozen_below
=
1
;
int
Nv
=
1
<<
level
;
decoder_node_t
*
new_node
=
new_decoder_node
(
first_leaf_index
,
level
);
decoder_node_t
*
new_node
=
new_decoder_node
(
first_leaf_index
,
level
);
#ifdef DEBUG_NEW_IMPL
printf
(
"New node %d order %d, level %d
\n
"
,
p
p
->
tree
.
num_nodes
,
Nv
,
level
);
printf
(
"New node %d order %d, level %d
\n
"
,
p
olarParams
->
tree
.
num_nodes
,
Nv
,
level
);
#endif
p
p
->
tree
.
num_nodes
++
;
p
olarParams
->
tree
.
num_nodes
++
;
if
(
level
==
0
)
{
#ifdef DEBUG_NEW_IMPL
printf
(
"leaf %d (%s)
\n
"
,
first_leaf_index
,
pp
->
information_bit_pattern
[
first_leaf_index
]
==
1
?
"information or crc"
:
"frozen"
);
printf
(
"leaf %d (%s)
\n
"
,
first_leaf_index
,
polarParams
->
information_bit_pattern
[
first_leaf_index
]
==
1
?
"information or crc"
:
"frozen"
);
#endif
new_node
->
leaf
=
1
;
new_node
->
all_frozen
=
p
p
->
information_bit_pattern
[
first_leaf_index
]
==
0
?
1
:
0
;
new_node
->
all_frozen
=
p
olarParams
->
information_bit_pattern
[
first_leaf_index
]
==
0
?
1
:
0
;
return
new_node
;
// this is a leaf node
}
for
(
int
i
=
0
;
i
<
Nv
;
i
++
)
{
if
(
pp
->
information_bit_pattern
[
i
+
first_leaf_index
]
>
0
)
all_frozen_below
=
0
;
if
(
polarParams
->
information_bit_pattern
[
i
+
first_leaf_index
]
>
0
)
all_frozen_below
=
0
;
}
if
(
all_frozen_below
==
0
)
new_node
->
left
=
add_nodes
(
level
-
1
,
first_leaf_index
,
pp
);
if
(
all_frozen_below
==
0
)
new_node
->
left
=
add_nodes
(
level
-
1
,
first_leaf_index
,
polarParams
);
else
{
#ifdef DEBUG_NEW_IMPL
printf
(
"aggregating frozen bits %d ... %d at level %d (%s)
\n
"
,
first_leaf_index
,
first_leaf_index
+
Nv
-
1
,
level
,((
first_leaf_index
/
Nv
)
&
1
)
==
0
?
"left"
:
"right"
);
...
...
@@ -241,22 +243,14 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) {
new_node
->
leaf
=
1
;
new_node
->
all_frozen
=
1
;
}
if
(
all_frozen_below
==
0
)
new_node
->
right
=
add_nodes
(
level
-
1
,
first_leaf_index
+
(
Nv
/
2
),
pp
);
if
(
all_frozen_below
==
0
)
new_node
->
right
=
add_nodes
(
level
-
1
,
first_leaf_index
+
(
Nv
/
2
),
polarParams
);
#ifdef DEBUG_NEW_IMPL
printf
(
"new_node (%d): first_leaf_index %d, left %p, right %p
\n
"
,
Nv
,
first_leaf_index
,
new_node
->
left
,
new_node
->
right
);
#endif
return
(
new_node
);
}
void
build_decoder_tree
(
t_nrPolar_params
*
pp
)
{
pp
->
tree
.
num_nodes
=
0
;
pp
->
tree
.
root
=
add_nodes
(
pp
->
n
,
0
,
pp
);
#ifdef DEBUG_NEW_IMPL
printf
(
"root : left %p, right %p
\n
"
,
pp
->
tree
.
root
->
left
,
pp
->
tree
.
root
->
right
);
#endif
return
(
new_node
);
}
#if defined(__arm__) || defined(__aarch64__)
...
...
@@ -271,7 +265,7 @@ void build_decoder_tree(t_nrPolar_params *pp) {
#define _mm_subs_pi16(a,b) vsub_s16(a,b)
#endif
void
applyFtoleft
(
t_nrPolar_params
*
pp
,
decoder_node_t
*
node
)
{
void
applyFtoleft
(
t_nrPolar_params
*
pp
,
decoder_node_t
*
node
)
{
int16_t
*
alpha_v
=
node
->
alpha
;
int16_t
*
alpha_l
=
node
->
left
->
alpha
;
int16_t
*
betal
=
node
->
left
->
beta
;
...
...
@@ -463,11 +457,7 @@ void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
}
}
int16_t
all1
[
16
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
int16_t
all1
[
16
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
void
computeBeta
(
t_nrPolar_params
*
pp
,
decoder_node_t
*
node
)
{
...
...
@@ -504,13 +494,11 @@ void computeBeta(t_nrPolar_params *pp,decoder_node_t *node) {
int
ssr4len
=
node
->
Nv
/
2
/
8
;
register
__m128i
allones
=*
((
__m128i
*
)
all1
);
for
(
int
i
=
0
;
i
<
sse4len
;
i
++
)
{
((
__m256i
*
)
betav
)[
i
]
=
_mm_or_si128
(
_mm_cmpeq_epi16
(((
__m128i
*
)
betar
)[
i
],
((
__m128i
*
)
betal
)[
i
]),
allones
));
((
__m256i
*
)
betav
)[
i
]
=
_mm_or_si128
(
_mm_cmpeq_epi16
(((
__m128i
*
)
betar
)[
i
],
((
__m128i
*
)
betal
)[
i
]),
allones
));
}
}
else
if
(
sse4mod
==
4
)
{
((
__m64
*
)
betav
)[
0
]
=
_mm_or_si64
(
_mm_cmpeq_pi16
(((
__m64
*
)
betar
)[
0
],
((
__m64
*
)
betal
)[
0
]),
*
((
__m64
*
)
all1
));
((
__m64
*
)
betav
)[
0
]
=
_mm_or_si64
(
_mm_cmpeq_pi16
(((
__m64
*
)
betar
)[
0
],
((
__m64
*
)
betal
)[
0
]),
*
((
__m64
*
)
all1
));
}
else
#endif
...
...
@@ -522,20 +510,19 @@ void computeBeta(t_nrPolar_params *pp,decoder_node_t *node) {
}
else
memcpy
((
void
*
)
&
betav
[
0
],
betar
,(
node
->
Nv
/
2
)
*
sizeof
(
int16_t
));
memcpy
((
void
*
)
&
betav
[
node
->
Nv
/
2
],
betar
,(
node
->
Nv
/
2
)
*
sizeof
(
int16_t
));
}
void
generic_polar_decoder
(
t_nrPolar_params
*
pp
,
decoder_node_t
*
node
)
{
void
generic_polar_decoder
(
t_nrPolar_params
*
polarParams
,
decoder_node_t
*
node
)
{
// Apply F to left
applyFtoleft
(
p
p
,
node
);
applyFtoleft
(
p
olarParams
,
node
);
// if left is not a leaf recurse down to the left
if
(
node
->
left
->
leaf
==
0
)
generic_polar_decoder
(
pp
,
node
->
left
);
if
(
node
->
left
->
leaf
==
0
)
generic_polar_decoder
(
polarParams
,
node
->
left
);
applyGtoright
(
p
p
,
node
);
if
(
node
->
right
->
leaf
==
0
)
generic_polar_decoder
(
p
p
,
node
->
right
);
applyGtoright
(
p
olarParams
,
node
);
if
(
node
->
right
->
leaf
==
0
)
generic_polar_decoder
(
p
olarParams
,
node
->
right
);
computeBeta
(
p
p
,
node
);
computeBeta
(
p
olarParams
,
node
);
}
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
d7e537fa
...
...
@@ -54,8 +54,7 @@
#define NR_POLAR_AGGREGATION_LEVEL_8_PRIME 163 //uint16_t
#define NR_POLAR_AGGREGATION_LEVEL_16_PRIME 167 //uint16_t
static
const
uint8_t
nr_polar_subblock_interleaver_pattern
[
32
]
=
{
0
,
1
,
2
,
4
,
3
,
5
,
6
,
7
,
8
,
16
,
9
,
17
,
10
,
18
,
11
,
19
,
12
,
20
,
13
,
21
,
14
,
22
,
15
,
23
,
24
,
25
,
26
,
28
,
27
,
29
,
30
,
31
};
static
const
uint8_t
nr_polar_subblock_interleaver_pattern
[
32
]
=
{
0
,
1
,
2
,
4
,
3
,
5
,
6
,
7
,
8
,
16
,
9
,
17
,
10
,
18
,
11
,
19
,
12
,
20
,
13
,
21
,
14
,
22
,
15
,
23
,
24
,
25
,
26
,
28
,
27
,
29
,
30
,
31
};
#define Nmax 1024
#define nmax 10
...
...
@@ -158,10 +157,6 @@ int8_t polar_decoder(double *input,
uint8_t
listSize
,
uint8_t
pathMetricAppr
);
uint32_t
polar_decoder_int16
(
int16_t
*
input
,
uint64_t
*
out
,
t_nrPolar_params
*
polarParams
);
int8_t
polar_decoder_aPriori
(
double
*
input
,
uint32_t
*
output
,
t_nrPolar_paramsPtr
polarParams
,
...
...
@@ -169,15 +164,6 @@ int8_t polar_decoder_aPriori(double *input,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
);
int8_t
polar_decoder_aPriori_timing
(
double
*
input
,
uint32_t
*
output
,
t_nrPolar_paramsPtr
polarParams
,
uint8_t
listSize
,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
,
double
cpuFreqGHz
,
FILE
*
logFile
);
int8_t
polar_decoder_dci
(
double
*
input
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
...
...
@@ -185,11 +171,28 @@ int8_t polar_decoder_dci(double *input,
uint8_t
pathMetricAppr
,
uint16_t
n_RNTI
);
void
generic_polar_decoder
(
t_nrPolar_params
*
,
decoder_node_t
*
);
uint32_t
polar_decoder_int16
(
int16_t
*
input
,
uint64_t
*
out
,
t_nrPolar_params
*
polarParams
);
void
generic_polar_decoder
(
t_nrPolar_params
*
,
decoder_node_t
*
);
void
applyFtoleft
(
t_nrPolar_params
*
polarParams
,
decoder_node_t
*
node
);
void
applyGtoright
(
t_nrPolar_params
*
polarParams
,
decoder_node_t
*
node
);
void
computeBeta
(
t_nrPolar_params
*
polarParams
,
decoder_node_t
*
node
);
void
build_decoder_tree
(
t_nrPolar_params
*
polarParams
);
decoder_node_t
*
new_decoder_node
(
int
first_leaf_index
,
int
level
);
decoder_node_t
*
add_nodes
(
int
level
,
int
first_leaf_index
,
t_nrPolar_params
*
polarParams
);
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
,
...
...
@@ -244,9 +247,7 @@ void nr_polar_rate_matching_int16(int16_t *input,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_interleaving_pattern
(
uint16_t
K
,
uint8_t
I_IL
,
uint16_t
*
PI_k_
);
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
,
int16_t
*
Q_I_N
,
...
...
@@ -263,17 +264,11 @@ void nr_polar_info_bit_extraction(uint8_t *input,
uint8_t
*
pattern
,
uint16_t
size
);
void
nr_bit2byte_uint32_8_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_bit2byte_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_byte2bit_uint8_32_t
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
);
void
nr_byte2bit_uint8_32
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
);
void
nr_crc_bit2bit_uint32_8_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_crc_bit2bit_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
...
...
@@ -289,45 +284,28 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(uint8_t *matrix1,
uint16_t
row
,
uint16_t
col
);
uint8_t
***
nr_alloc_uint8_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
**
nr_alloc_uint8_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
);
uint8_t
**
nr_alloc_uint8_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
);
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
**
nr_alloc_double_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
);
double
**
nr_alloc_double_2D_array
(
uint16_t
xlen
,
uint16_t
ylen
);
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
);
void
nr_free_double_2D_array
(
double
**
input
,
uint16_t
xlen
);
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_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_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_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
nr_sort_asc_int16_1D_array_ind
(
int32_t
*
matrix
,
int
*
ind
,
int
len
);
void
nr_free_double_2D_array
(
double
**
input
,
uint16_t
xlen
);
void
updateLLR
(
double
***
llr
,
uint8_t
**
llrU
,
uint8_t
***
bit
,
...
...
@@ -386,24 +364,14 @@ uint8_t **crc11_generator_matrix(uint16_t payloadSizeBits);
uint8_t
**
crc6_generator_matrix
(
uint16_t
payloadSizeBits
);
//Also nr_polar_rate_matcher
static
inline
void
nr_polar_interleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
*
pattern
,
uint16_t
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
output
[
i
]
=
input
[
pattern
[
i
]];
static
inline
void
nr_polar_interleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
*
pattern
,
uint16_t
size
){
for
(
int
i
=
0
;
i
<
size
;
i
++
)
output
[
i
]
=
input
[
pattern
[
i
]];
}
static
inline
void
nr_polar_deinterleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
*
pattern
,
uint16_t
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
static
inline
void
nr_polar_deinterleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
*
pattern
,
uint16_t
size
){
for
(
int
i
=
0
;
i
<
size
;
i
++
)
output
[
pattern
[
i
]]
=
input
[
i
];
}
}
void
build_decoder_tree
(
t_nrPolar_params
*
pp
);
#endif
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
d7e537fa
...
...
@@ -33,7 +33,7 @@
//#define DEBUG_POLAR_ENCODER
//#define DEBUG_POLAR_ENCODER_DCI
//#define DEBUG_POLAR_ENCODER_TIMING
#define DEBUG_POLAR_MATLAB
//
#define DEBUG_POLAR_MATLAB
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "assertions.h"
...
...
@@ -51,9 +51,9 @@ void polar_encoder(uint32_t *in,
#ifdef DEBUG_POLAR_ENCODER
printf("polar_B %llx (crc %x)\n",B,crc24c((uint8_t*)in,polarParams->payloadBits)>>8);
#endif
nr_bit2byte_uint32_8
_t
((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*/
nr_bit2byte_uint32_8((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*/
nr_bit2byte_uint32_8
_t
((
uint32_t
*
)
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
nr_bit2byte_uint32_8
((
uint32_t
*
)
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
/*
* Bytewise operations
*/
...
...
@@ -147,7 +147,7 @@ nr_bit2byte_uint32_8_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*
for
(
int
i
=
0
;
i
<
polarParams
->
encoderLength
;
i
++
)
printf
(
"f[%d]=%d
\n
"
,
i
,
polarParams
->
nr_polar_E
[
i
]);
#endif
nr_byte2bit_uint8_32
_t
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
nr_byte2bit_uint8_32
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
}
void
polar_encoder_dci
(
uint32_t
*
in
,
...
...
@@ -163,7 +163,7 @@ void polar_encoder_dci(uint32_t *in,
* Bytewise operations
*/
//(a to a')
nr_bit2byte_uint32_8
_t
(
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
nr_bit2byte_uint32_8
(
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
for
(
int
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
polarParams
->
nr_polar_APrime
[
i
]
=
1
;
for
(
int
i
=
0
;
i
<
polarParams
->
payloadBits
;
i
++
)
polarParams
->
nr_polar_APrime
[
i
+
(
polarParams
->
crcParityBits
)]
=
polarParams
->
nr_polar_A
[
i
];
#ifdef DEBUG_POLAR_ENCODER_DCI
...
...
@@ -202,7 +202,7 @@ void polar_encoder_dci(uint32_t *in,
}
/* //(a to a')
nr_crc_bit2bit_uint32_8
_t
(in, polarParams->payloadBits, polarParams->nr_polar_aPrime);
nr_crc_bit2bit_uint32_8(in, polarParams->payloadBits, polarParams->nr_polar_aPrime);
//Parity bits computation (p)
polarParams->crcBit = crc24c(polarParams->nr_polar_aPrime, (polarParams->payloadBits+polarParams->crcParityBits));
#ifdef DEBUG_POLAR_ENCODER_DCI
...
...
@@ -273,7 +273,7 @@ void polar_encoder_dci(uint32_t *in,
/*
* Return bits.
*/
nr_byte2bit_uint8_32
_t
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
nr_byte2bit_uint8_32
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
#ifdef DEBUG_POLAR_ENCODER_DCI
printf
(
"[polar_encoder_dci] E: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
encoderLength
;
i
++
)
printf
(
"%d-"
,
polarParams
->
nr_polar_E
[
i
]);
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
View file @
d7e537fa
...
...
@@ -256,8 +256,13 @@ void nr_polar_info_bit_extraction(uint8_t *input,
}
void
nr_polar_rate_matching_pattern
(
uint16_t
*
rmp
,
uint16_t
*
J
,
const
uint8_t
*
P_i_
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
){
void
nr_polar_rate_matching_pattern
(
uint16_t
*
rmp
,
uint16_t
*
J
,
const
uint8_t
*
P_i_
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
)
{
uint8_t
i
;
uint16_t
*
d
,
*
y
,
ind
;
d
=
(
uint16_t
*
)
malloc
(
sizeof
(
uint16_t
)
*
N
);
...
...
@@ -293,8 +298,13 @@ void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P
}
void
nr_polar_rate_matching
(
double
*
input
,
double
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
){
void
nr_polar_rate_matching
(
double
*
input
,
double
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
)
{
if
(
E
>=
N
)
{
//repetition
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
){
...
...
@@ -311,11 +321,15 @@ void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16
output
[
rmp
[
i
]]
=
input
[
i
];
}
}
}
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
)
{
if
(
E
>=
N
)
{
//repetition
for
(
int
i
=
0
;
i
<=
N
-
1
;
i
++
)
output
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<=
E
-
1
;
i
++
){
...
...
@@ -332,6 +346,4 @@ void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp
output
[
rmp
[
i
]]
=
input
[
i
];
}
}
}
openair1/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
0 → 100644
View file @
d7e537fa
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*!\file PHY/CODING/nrSmallBlock/decodeSmallBlock.c
* \brief
* \author Turker Yilmaz
* \date 2019
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \note
* \warning
*/
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
#include "assertions.h"
#include "PHY/sse_intrin.h"
//#define DEBUG_DECODESMALLBLOCK
uint16_t
decodeSmallBlock
(
int8_t
*
in
,
uint8_t
len
){
uint16_t
out
=
0
;
AssertFatal
(
len
>=
3
&&
len
<=
11
,
"[decodeSmallBlock] Message Length = %d (Small Block Coding is only defined for input lengths 3 to 11)"
,
len
);
if
(
len
<
7
)
{
int16_t
Rhat
[
NR_SMALL_BLOCK_CODED_BITS
]
=
{
0
},
Rhatabs
[
NR_SMALL_BLOCK_CODED_BITS
]
=
{
0
};
uint16_t
maxVal
;
uint8_t
maxInd
=
0
;
for
(
int
j
=
0
;
j
<
NR_SMALL_BLOCK_CODED_BITS
;
++
j
)
for
(
int
k
=
0
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
)
Rhat
[
j
]
+=
in
[
k
]
*
hadamard32InterleavedTransposed
[
j
][
k
];
#if defined(__AVX2__)
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
i
+=
16
)
{
__m256i
a15_a0
=
_mm256_loadu_si256
((
__m256i
*
)
&
Rhat
[
i
]);
a15_a0
=
_mm256_abs_epi16
(
a15_a0
);
_mm256_storeu_si256
((
__m256i
*
)(
&
Rhatabs
[
i
]),
a15_a0
);
}
#else
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
i
+=
8
)
{
__m128i
a7_a0
=
_mm_loadu_si128
((
__m128i
*
)
&
Rhat
[
i
]);
a7_a0
=
_mm_abs_epi16
(
a7_a0
);
_mm_storeu_si128
((
__m128i
*
)(
&
Rhatabs
[
i
]),
a7_a0
);
}
#endif
maxVal
=
Rhatabs
[
0
];
for
(
int
k
=
1
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
){
if
(
Rhatabs
[
k
]
>
maxVal
){
maxVal
=
Rhatabs
[
k
];
maxInd
=
k
;
}
}
out
=
properOrderedBasis
[
maxInd
]
|
(
(
Rhat
[
maxInd
]
>
0
)
?
(
uint16_t
)
0
:
(
uint16_t
)
1
);
#ifdef DEBUG_DECODESMALLBLOCK
for
(
int
k
=
0
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
)
printf
(
"[decodeSmallBlock]Rhat[%d]=%d %d %d %d
\n
"
,
k
,
Rhat
[
k
],
maxVal
,
maxInd
,
((
uint32_t
)
out
>>
k
)
&
1
);
printf
(
"[decodeSmallBlock]0x%x 0x%x
\n
"
,
out
,
properOrderedBasis
[
maxInd
]);
#endif
}
else
{
int8_t
Dmatrix
[
NR_SMALL_BLOCK_CODED_BITS
][
NR_SMALL_BLOCK_CODED_BITS
]
=
{
0
};
int16_t
DmatrixFHT
[
NR_SMALL_BLOCK_CODED_BITS
][
NR_SMALL_BLOCK_CODED_BITS
]
=
{
0
};
uint16_t
maxVal
;
uint8_t
maxRow
=
0
,
maxCol
=
0
;
for
(
int
j
=
0
;
j
<
NR_SMALL_BLOCK_CODED_BITS
;
++
j
)
for
(
int
k
=
0
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
)
Dmatrix
[
j
][
k
]
=
in
[
k
]
*
maskD
[
j
][
k
];
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
++
i
)
for
(
int
j
=
0
;
j
<
NR_SMALL_BLOCK_CODED_BITS
;
++
j
)
for
(
int
k
=
0
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
)
DmatrixFHT
[
i
][
j
]
+=
Dmatrix
[
i
][
k
]
*
hadamard32InterleavedTransposed
[
j
][
k
];
maxVal
=
abs
(
DmatrixFHT
[
0
][
0
]);
for
(
int
i
=
0
;
i
<
NR_SMALL_BLOCK_CODED_BITS
;
++
i
)
for
(
int
j
=
0
;
j
<
NR_SMALL_BLOCK_CODED_BITS
;
++
j
)
if
(
abs
(
DmatrixFHT
[
i
][
j
])
>
maxVal
){
maxVal
=
abs
(
DmatrixFHT
[
i
][
j
]);
maxRow
=
i
;
maxCol
=
j
;
}
out
=
properOrderedBasisExtended
[
maxRow
]
|
properOrderedBasis
[
maxCol
]
|
(
(
DmatrixFHT
[
maxRow
][
maxCol
]
>
0
)
?
(
uint16_t
)
0
:
(
uint16_t
)
1
);
#ifdef DEBUG_DECODESMALLBLOCK
for
(
int
k
=
0
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
)
printf
(
"[decodeSmallBlock]maxRow = %d maxCol = %d out[%d]=%d
\n
"
,
maxRow
,
maxCol
,
k
,
((
uint32_t
)
out
>>
k
)
&
1
);
#endif
}
return
out
;
}
openair1/PHY/CODING/nrSmallBlock/encodeSmall.c
deleted
100644 → 0
View file @
83345534
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
0 → 100644
View file @
d7e537fa
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*!\file PHY/CODING/nrSmallBlock/encodeSmallBlock.c
* \brief
* \author Turker Yilmaz
* \date 2019
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \note
* \warning
*/
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
//input = [0 ... 0 c_K-1 ... c_2 c_1 c_0]
//output = [d_31 d_30 ... d_2 d_1 d_0]
uint32_t
encodeSmallBlock
(
uint16_t
*
in
,
uint8_t
len
){
uint32_t
out
=
0
;
for
(
uint16_t
i
=
0
;
i
<
len
;
i
++
)
if
((
*
in
&
(
1
<<
i
))
>
0
)
out
^=
nrSmallBlockBasis
[
i
];
return
out
;
}
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
0 → 100644
View file @
d7e537fa
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*!\file PHY/CODING/nrSmallBlock/nr_small_block_defs.h
* \brief
* \author Turker Yilmaz
* \date 2019
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \note
* \warning
*/
#ifndef __NR_SMALL_BLOCK_DEFS__H__
#define __NR_SMALL_BLOCK_DEFS__H__
#include <math.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define NR_SMALL_BLOCK_CODED_BITS 32
#define L1d_CLS 64
uint32_t
encodeSmallBlock
(
uint16_t
*
in
,
uint8_t
len
);
uint16_t
decodeSmallBlock
(
int8_t
*
in
,
uint8_t
len
);
static
const
uint32_t
nrSmallBlockBasis
[
11
]
=
{
0xFFFFFFFF
,
0x4BA5A933
,
0x7D910E5A
,
0x6D26339C
,
0x71C7C3E0
,
0x7E0FFC00
,
0x731D8E64
,
0x6B44F5B0
,
0x7DC218EC
,
0x4DA1B746
,
0x42F0FFFF
};
static
const
uint16_t
properOrderedBasis
[
32
]
=
{
0x0000
,
0x0002
,
0x0004
,
0x0006
,
0x0008
,
0x000A
,
0x000C
,
0x000E
,
0x0010
,
0x0012
,
0x0014
,
0x0016
,
0x0018
,
0x001A
,
0x001C
,
0x001E
,
0x0020
,
0x0022
,
0x0024
,
0x0026
,
0x0028
,
0x002A
,
0x002C
,
0x002E
,
0x0030
,
0x0032
,
0x0034
,
0x0036
,
0x0038
,
0x003A
,
0x003C
,
0x003E
};
static
const
uint16_t
properOrderedBasisExtended
[
32
]
=
{
0x0000
,
0x0040
,
0x0080
,
0x00C0
,
0x0100
,
0x0140
,
0x0180
,
0x01C0
,
0x0200
,
0x0240
,
0x0280
,
0x02C0
,
0x0300
,
0x0340
,
0x0380
,
0x03C0
,
0x0400
,
0x0440
,
0x0480
,
0x04C0
,
0x0500
,
0x0540
,
0x0580
,
0x05C0
,
0x0600
,
0x0640
,
0x0680
,
0x06C0
,
0x0700
,
0x0740
,
0x0780
,
0x07C0
};
static
const
int8_t
hadamard32InterleavedTransposed
[
32
][
32
]
__attribute__
((
aligned
(
32
)))
=
{
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
},
{
-
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
1
,
1
,
-
1
,
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
1
},
{
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
},
{
-
1
,
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
1
},
{
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
1
,
1
,
1
,
-
1
,
-
1
,
1
,
1
,
-
1
,
1
,
1
,
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,
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
1
,
-
1
,
-
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
},
{
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
1
,
1
,
1
,},
{
-
1
,
1
,
1
,
1
,
1
,
1
,
1
,
-
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
1
,
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
1
}
};
#endif
openair1/PHY/CODING/nr_polar_init.c
View file @
d7e537fa
...
...
@@ -63,7 +63,8 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
if
(
newPolarInitNode
!=
NULL
)
{
newPolarInitNode
->
idx
=
(
messageType
*
messageLength
*
aggregation_prime
);
newPolarInitNode
->
nextPtr
=
NULL
;
newPolarInitNode
->
nextPtr
=
(
t_nrPolar_params
*
)
NULL
;
//printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level);
if
(
messageType
==
0
)
{
//PBCH
...
...
@@ -186,9 +187,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
currentPtr
=
currentPtr
->
nextPtr
;
}
currentPtr
->
nextPtr
=
newPolarInitNode
;
printf
(
"Adding new polarParams entry to list index %d,%p
\n
"
,
newPolarInitNode
->
idx
,
currentPtr
->
nextPtr
);
printf
(
"Adding new polarParams entry to list index %d,%p
\n
"
,
newPolarInitNode
->
idx
,
currentPtr
->
nextPtr
);
return
;
}
...
...
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