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
wangwenhui
OpenXG-RAN
Commits
c660a1e5
Commit
c660a1e5
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
df8b32b8
Changes
4
Show 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 @
c660a1e5
...
...
@@ -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 @
c660a1e5
...
...
@@ -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
];
...
...
@@ -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 @
c660a1e5
...
...
@@ -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 @
c660a1e5
...
...
@@ -45,16 +45,19 @@ 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
,
...
...
@@ -68,12 +71,13 @@ void polar_encoder(uint32_t *in,
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)];
*/
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]);
...
...
@@ -91,12 +95,12 @@ void polar_encoder(uint32_t *in,
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