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
90534fa1
Commit
90534fa1
authored
Sep 18, 2018
by
yilmazt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working polartest
parent
30b6b537
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
489 additions
and
118 deletions
+489
-118
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+128
-111
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+262
-7
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+17
-0
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+82
-0
No files found.
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
90534fa1
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
90534fa1
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
90534fa1
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/CODING/coding_defs.h"
#include "SIMULATION/TOOLS/sim.h"
#define NR_POLAR_DECODER_LISTSIZE 8 //uint8_t
#define NR_POLAR_DECODER_LISTSIZE 8 //uint8_t
#define NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION 0 //uint8_t; 0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12)
#define NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION 0 //uint8_t; 0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12)
...
@@ -111,6 +113,12 @@ void polar_encoder_dci(uint32_t *in,
...
@@ -111,6 +113,12 @@ 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
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
double
cpuFreqGHz
,
FILE
*
logFile
);
int8_t
polar_decoder
(
double
*
input
,
int8_t
polar_decoder
(
double
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
t_nrPolar_paramsPtr
polarParams
,
t_nrPolar_paramsPtr
polarParams
,
...
@@ -124,6 +132,15 @@ int8_t polar_decoder_aPriori(double *input,
...
@@ -124,6 +132,15 @@ int8_t polar_decoder_aPriori(double *input,
uint8_t
pathMetricAppr
,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
);
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
);
void
nr_polar_init
(
t_nrPolar_paramsPtr
*
polarParams
,
void
nr_polar_init
(
t_nrPolar_paramsPtr
*
polarParams
,
int8_t
messageType
,
int8_t
messageType
,
uint16_t
messageLength
,
uint16_t
messageLength
,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
90534fa1
...
@@ -30,10 +30,15 @@
...
@@ -30,10 +30,15 @@
* \warning
* \warning
*/
*/
//#define DEBUG_POLAR_ENCODER
//#define DEBUG_POLAR_ENCODER_DCI
//#define DEBUG_POLAR_ENCODER_DCI
//#define DEBUG_POLAR_ENCODER_TIMING
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
//input [a_31 a_30 ... a_0]
//output [f_31 f_30 ... f_0] [f_63 f_62 ... f_32] ...
void
polar_encoder
(
uint32_t
*
in
,
void
polar_encoder
(
uint32_t
*
in
,
uint32_t
*
out
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
)
t_nrPolar_paramsPtr
polarParams
)
...
@@ -95,6 +100,10 @@ void polar_encoder(uint32_t *in,
...
@@ -95,6 +100,10 @@ void polar_encoder(uint32_t *in,
/*
/*
* Return bits.
* Return bits.
*/
*/
#ifdef DEBUG_POLAR_ENCODER
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_t
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
}
}
...
@@ -187,3 +196,76 @@ void polar_encoder_dci(uint32_t *in,
...
@@ -187,3 +196,76 @@ 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
)));
}
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