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
OpenXG
OpenXG UE
Commits
f3f2d993
Commit
f3f2d993
authored
Oct 28, 2018
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made original polar encoder/decoder work again in polartest.
parent
b12c5569
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
32 deletions
+42
-32
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+2
-2
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+12
-10
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+4
-0
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+24
-20
No files found.
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
f3f2d993
...
...
@@ -369,7 +369,7 @@ int main(int argc, char *argv[]) {
aPrioriArray
);
else
decoderState
=
polar_decoder_int16
(
channelOutput_int16
,
estimatedOutput
,
(
uint64_t
*
)
estimatedOutput
,
currentPtr
);
...
...
@@ -391,7 +391,7 @@ int main(int argc, char *argv[]) {
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]);
}
}
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
f3f2d993
...
...
@@ -256,6 +256,7 @@ int8_t polar_decoder(
//Deinterleaving (ĉ to b)
nr_polar_deinterleaver
(
polarParams
->
nr_polar_CPrime
,
polarParams
->
nr_polar_B
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
//Remove the CRC (â)
for
(
int
j
=
0
;
j
<
polarParams
->
payloadBits
;
j
++
)
polarParams
->
nr_polar_A
[
j
]
=
polarParams
->
nr_polar_B
[
j
];
...
...
@@ -280,13 +281,13 @@ int8_t polar_decoder(
}
int8_t
polar_decoder_aPriori
(
double
*
input
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
uint8_t
listSize
,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
)
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
uint8_t
listSize
,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
)
{
uint8_t
***
bit
=
nr_alloc_uint8_t_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
***
bit
=
nr_alloc_uint8_t_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
**
llrUpdated
=
nr_alloc_uint8_t_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
);
...
...
@@ -509,8 +510,8 @@ int8_t polar_decoder_aPriori(double *input,
nr_polar_deinterleaver
(
polarParams
->
nr_polar_CPrime
,
polarParams
->
nr_polar_B
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
//Remove the CRC (â)
for
(
int
j
=
0
;
j
<
polarParams
->
payloadBits
;
j
++
)
polarParams
->
nr_polar_A
[
j
]
=
polarParams
->
nr_polar_B
[
j
];
for
(
int
j
=
0
;
j
<
polarParams
->
payloadBits
;
j
++
)
polarParams
->
nr_polar_A
[
j
]
=
polarParams
->
nr_polar_B
[
j
];
break
;
}
}
...
...
@@ -528,6 +529,7 @@ int8_t polar_decoder_aPriori(double *input,
* Return bits.
*/
nr_byte2bit_uint8_32_t
(
polarParams
->
nr_polar_A
,
polarParams
->
payloadBits
,
out
);
return
(
0
);
}
...
...
@@ -1064,7 +1066,7 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
}
int8_t
polar_decoder_int16
(
int16_t
*
input
,
uint
8
_t
*
out
,
uint
64
_t
*
out
,
t_nrPolar_params
*
polarParams
)
{
...
...
@@ -1103,7 +1105,7 @@ int8_t polar_decoder_int16(int16_t *input,
#endif
if
((
uint64_t
)(
crc24c
((
uint8_t
*
)
&
B
,
polarParams
->
payloadBits
)
>>
8
)
==
(
B
>>
polarParams
->
payloadBits
))
{
*
((
uint64_t
*
)
out
)
=
B
&
(((
uint64_t
)
1
<<
polarParams
->
payloadBits
)
-
1
);
*
out
=
B
&
(((
uint64_t
)
1
<<
polarParams
->
payloadBits
)
-
1
);
return
(
0
);
}
else
return
(
-
1
);
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
f3f2d993
...
...
@@ -157,6 +157,10 @@ int8_t polar_decoder(double *input,
uint8_t
listSize
,
uint8_t
pathMetricAppr
);
int8_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
,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
f3f2d993
...
...
@@ -45,35 +45,39 @@ void polar_encoder(uint32_t *in,
t_nrPolar_paramsPtr
polarParams
)
{
if
(
polarParams
->
idx
==
0
){
//PBCH
/*
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<<polarParams->payloadBits);
#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_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*/
nr_bit2byte_uint32_8_t
((
uint32_t
*
)
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
/*
* Bytewise operations
*/
//Calculate CRC.
/*
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);
for (uint8_t i = 0; i < polarParams->crcParityBits; i++)
polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2);
//Attach CRC to the Transport Block. (a to b)
for (uint16_t i = 0; i < polarParams->payloadBits; i++)
polarParams->nr_polar_B[i] = polarParams->nr_polar_A[i];
for (uint16_t i = polarParams->payloadBits; i < polarParams->K; i++)
polarParams->nr_polar_B[i]= 0;//
polarParams->nr_polar_crc[i-(polarParams->payloadBits)];
*/
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
);
for
(
uint8_t
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
polarParams
->
nr_polar_crc
[
i
]
=
(
polarParams
->
nr_polar_crc
[
i
]
%
2
);
//Attach CRC to the Transport Block. (a to b)
for
(
uint16_t
i
=
0
;
i
<
polarParams
->
payloadBits
;
i
++
)
polarParams
->
nr_polar_B
[
i
]
=
polarParams
->
nr_polar_A
[
i
];
for
(
uint16_t
i
=
polarParams
->
payloadBits
;
i
<
polarParams
->
K
;
i
++
)
polarParams
->
nr_polar_B
[
i
]
=
polarParams
->
nr_polar_crc
[
i
-
(
polarParams
->
payloadBits
)];
#ifdef DEBUG_POLAR_ENCODER
uint64_t
B2
=
0
;
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
B2
=
B2
|
((
uint64_t
)
polarParams
->
nr_polar_B
[
i
]
<<
i
);
printf
(
"polar_B %llx
\n
"
,
B2
);
#endif
/* for (int j=0;j<polarParams->crcParityBits;j++) {
for (int i=0;i<polarParams->payloadBits;i++)
printf("%1d.%1d+",polarParams->crc_generator_matrix[i][j],polarParams->nr_polar_A[i]);
...
...
@@ -90,13 +94,13 @@ void polar_encoder(uint32_t *in,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
#ifdef DEBUG_POLAR_ENCODER
uint64_t
Cprime
=
0
;
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
{
Cprime
=
Cprime
|
((
uint64_t
)
polarParams
->
nr_polar_CPrime
[
i
]
<<
i
);
if
(
polarParams
->
nr_polar_CPrime
[
i
]
==
1
)
printf
(
"pos %d : %llx
\n
"
,
i
,
Cprime
);
}
#ifdef DEBUG_POLAR_ENCODER
printf
(
"polar_Cprime %llx
\n
"
,
Cprime
);
#endif
//Bit insertion (c' to u)
...
...
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