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
c33ef4e7
Commit
c33ef4e7
authored
Aug 22, 2018
by
yilmazt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polar coding update 2of2
parent
7be0f5e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
35 deletions
+62
-35
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+2
-2
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+2
-9
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+45
-10
openair1/PHY/CODING/nr_polar_init.c
openair1/PHY/CODING/nr_polar_init.c
+3
-2
openair1/PHY/NR_TRANSPORT/nr_dci.c
openair1/PHY/NR_TRANSPORT/nr_dci.c
+10
-12
No files found.
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
c33ef4e7
...
...
@@ -175,7 +175,7 @@ int main(int argc, char *argv[]) {
printf
(
"testInput: [0]->0x%08x
\t
[1]->0x%08x
\t
[2]->0x%08x
\t
[3]->0x%08x
\n
"
,
testInput
[
0
],
testInput
[
1
],
testInput
[
2
],
testInput
[
3
]);
return
(
0
);
currentPtr
=
nr_polar_params
(
nrPolar_params
,
polarMessageType
,
testLength
);
currentPtr
=
nr_polar_params
(
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
polar_encoder
(
testInput
,
encoderOutput
,
currentPtr
);
printf
(
"AFTER POLAR ENCODING
\n
"
);
printf
(
"testInput: [0]->0x%08x
\t
[1]->0x%08x
\t
[2]->0x%08x
\t
[3]->0x%08x
\n
"
,
...
...
@@ -185,7 +185,7 @@ int main(int argc, char *argv[]) {
return
(
0
);
#endif
currentPtr
=
nr_polar_params
(
nrPolar_params
,
polarMessageType
,
testLength
);
currentPtr
=
nr_polar_params
(
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
// We assume no a priori knowledge available about the payload.
double
aPrioriArray
[
currentPtr
->
payloadBits
];
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
c33ef4e7
...
...
@@ -109,7 +109,7 @@ void polar_encoder(uint32_t *input,
void
polar_encoder_dci
(
uint32_t
*
in
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
uint
32
_t
n_RNTI
);
uint
16
_t
n_RNTI
);
int8_t
polar_decoder
(
double
*
input
,
uint32_t
*
output
,
...
...
@@ -297,14 +297,7 @@ uint8_t **crc11_generator_matrix(uint16_t payloadSizeBits);
uint8_t
**
crc6_generator_matrix
(
uint16_t
payloadSizeBits
);
static
inline
void
nr_polar_rate_matcher
(
uint8_t
*
input
,
unsigned
char
*
output
,
uint16_t
*
pattern
,
uint16_t
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
output
[
i
]
=
input
[
pattern
[
i
]];
}
//Also nr_polar_rate_matcher
static
inline
void
nr_polar_interleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
*
pattern
,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
c33ef4e7
...
...
@@ -30,6 +30,8 @@
* \warning
*/
#define DEBUG_POLAR_ENCODER_DCI
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void
polar_encoder
(
uint32_t
*
in
,
...
...
@@ -85,10 +87,10 @@ void polar_encoder(uint32_t *in,
//Rate matching
//Sub-block interleaving (d to y) and Bit selection (y to e)
nr_polar_
rate_match
er
(
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_E
,
polarParams
->
rate_matching_pattern
,
polarParams
->
encoderLength
);
nr_polar_
interleav
er
(
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_E
,
polarParams
->
rate_matching_pattern
,
polarParams
->
encoderLength
);
/*
* Return bits.
...
...
@@ -99,12 +101,38 @@ void polar_encoder(uint32_t *in,
void
polar_encoder_dci
(
uint32_t
*
in
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
uint32_t
n_RNTI
)
{
//(a to a')
uint16_t
n_RNTI
)
{
#ifdef DEBUG_POLAR_ENCODER_DCI
printf
(
"[polar_encoder_dci] in: [0]->0x%08x
\t
[1]->0x%08x
\t
[2]->0x%08x
\t
[3]->0x%08x
\n
"
,
in
[
0
],
in
[
1
],
in
[
2
],
in
[
3
]);
#endif
//(a to a')
nr_crc_bit2bit_uint32_8_t
(
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
printf
(
"[polar_encoder_dci] crc: 0x%08x
\n
"
,
polarParams
->
crcBit
);
#endif
//(a to b)
//Using "nr_polar_aPrime" to hold "nr_polar_b".
uint8_t
arrayInd
=
ceil
(
polarParams
->
payloadBits
/
32
.
0
);
for
(
int
j
=
0
;
j
<
arrayInd
-
1
;
j
++
)
{
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
polarParams
->
nr_polar_B
[
i
+
j
*
32
]
=
(
in
[
j
]
>>
i
)
&
1
;
}
}
for
(
int
i
=
0
;
i
<
((
polarParams
->
payloadBits
)
%
32
);
i
++
)
{
polarParams
->
nr_polar_B
[
i
+
(
arrayInd
-
1
)
*
32
]
=
(
in
[(
arrayInd
-
1
)]
>>
i
)
&
1
;
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
i
]
=
((
polarParams
->
crcBit
)
>>
(
31
-
i
))
&
1
;
}
//Scrambling
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
;
}
//Interleaving (c to c')
nr_polar_interleaver
(
polarParams
->
nr_polar_B
,
...
...
@@ -132,13 +160,20 @@ void polar_encoder_dci(uint32_t *in,
//Rate matching
//Sub-block interleaving (d to y) and Bit selection (y to e)
nr_polar_
rate_match
er
(
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_E
,
polarParams
->
rate_matching_pattern
,
polarParams
->
encoderLength
);
nr_polar_
interleav
er
(
polarParams
->
nr_polar_D
,
polarParams
->
nr_polar_E
,
polarParams
->
rate_matching_pattern
,
polarParams
->
encoderLength
);
/*
* Return bits.
*/
nr_byte2bit_uint8_32_t
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
#ifdef DEBUG_POLAR_ENCODER_DCI
uint8_t
outputInd
=
ceil
(
polarParams
->
encoderLength
/
32
.
0
);
printf
(
"[polar_encoder_dci] out: "
);
for
(
int
i
=
0
;
i
<
outputInd
;
i
++
)
{
printf
(
"[%d]->0x%08x
\t
"
,
i
,
out
[
i
]);
}
#endif
}
openair1/PHY/CODING/nr_polar_init.c
View file @
c33ef4e7
...
...
@@ -201,9 +201,10 @@ t_nrPolar_paramsPtr nr_polar_params (t_nrPolar_paramsPtr polarParams,
uint16_t
nr_polar_aggregation_prime
(
uint8_t
aggregation_level
)
{
if
(
aggregation_level
==
1
)
return
NR_POLAR_AGGREGATION_LEVEL_1_PRIME
;
if
(
aggregation_level
==
0
)
return
0
;
else
if
(
aggregation_level
==
1
)
return
NR_POLAR_AGGREGATION_LEVEL_1_PRIME
;
else
if
(
aggregation_level
==
2
)
return
NR_POLAR_AGGREGATION_LEVEL_2_PRIME
;
else
if
(
aggregation_level
==
4
)
return
NR_POLAR_AGGREGATION_LEVEL_4_PRIME
;
else
if
(
aggregation_level
==
8
)
return
NR_POLAR_AGGREGATION_LEVEL_8_PRIME
;
else
return
NR_POLAR_AGGREGATION_LEVEL_16_PRIME
;
else
return
NR_POLAR_AGGREGATION_LEVEL_16_PRIME
;
//aggregation_level == 16
}
openair1/PHY/NR_TRANSPORT/nr_dci.c
View file @
c33ef4e7
...
...
@@ -34,7 +34,7 @@
//#define DEBUG_PDCCH_DMRS
//#define DEBUG_DCI
#define DEBUG_POLAR_PARAMS
//
#define DEBUG_POLAR_PARAMS
extern
short
nr_mod_table
[
NR_MOD_TABLE_SIZE_SHORT
];
...
...
@@ -203,30 +203,28 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
/// DCI payload processing
// CRC attachment + Scrambling + Channel coding + Rate matching
uint32_t
scrambled_payload
[
NR_MAX_DCI_SIZE_DWORD
];
uint
32
_t
n_RNTI
=
(
pdcch_params
.
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
pdcch_params
.
rnti
:
0
;
//
nr_polar_init(nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
//
t_nrPolar_paramsPtr currentPtr = nr_polar_params(*nrPolar_params, NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
//polar_encoder_dci(dci_alloc.dci_pdu, scrambled_payload
, currentPtr, n_RNTI);
uint32_t
encoder_output
[
NR_MAX_DCI_SIZE_DWORD
];
uint
16
_t
n_RNTI
=
(
pdcch_params
.
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
pdcch_params
.
rnti
:
0
;
nr_polar_init
(
nrPolar_params
,
NR_POLAR_DCI_MESSAGE_TYPE
,
dci_alloc
.
size
,
dci_alloc
.
L
);
t_nrPolar_paramsPtr
currentPtr
=
nr_polar_params
(
*
nrPolar_params
,
NR_POLAR_DCI_MESSAGE_TYPE
,
dci_alloc
.
size
,
dci_alloc
.
L
);
polar_encoder_dci
(
dci_alloc
.
dci_pdu
,
encoder_output
,
currentPtr
,
n_RNTI
);
#ifdef DEBUG_POLAR_PARAMS
printf
(
"
\n\n
Int = %d
\t
Hex = 0x%08x
\n\n
"
,
n_RNTI
,
n_RNTI
);
/*printf("DCI PDU: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
dci_alloc.dci_pdu[0], dci_alloc.dci_pdu[1], dci_alloc.dci_pdu[2], dci_alloc.dci_pdu[3]);
printf("Encoded Payload: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n",
scrambled_payload[0], scrambled_payload[1], scrambled_payload[2], scrambled_payload[3]);*/
return
0
;
encoder_output[0], encoder_output[1], encoder_output[2], encoder_output[3]);*/
#endif
// QPSK modulation
int16_t
mod_dci
[
NR_MAX_DCI_SIZE
>>
1
];
for
(
int
i
=
0
;
i
<
encoded_length
>>
1
;
i
++
)
{
idx
=
(((
scrambled_payload
[
i
<<
1
]
>>
(
i
<<
1
))
&
1
)
<<
1
)
^
((
scrambled_payload
[(
i
<<
1
)
+
1
]
>>
((
i
<<
1
)
+
1
))
&
1
);
idx
=
(((
encoder_output
[
i
<<
1
]
>>
(
i
<<
1
))
&
1
)
<<
1
)
^
((
encoder_output
[(
i
<<
1
)
+
1
]
>>
((
i
<<
1
)
+
1
))
&
1
);
mod_dci
[
i
<<
1
]
=
nr_mod_table
[(
NR_MOD_TABLE_QPSK_OFFSET
+
idx
)
<<
1
];
mod_dci
[(
i
<<
1
)
+
1
]
=
nr_mod_table
[((
NR_MOD_TABLE_QPSK_OFFSET
+
idx
)
<<
1
)
+
1
];
#ifdef DEBUG_DCI
printf
(
"i %d idx %d b0-b1 %d-%d mod_dci %d %d
\n
"
,
i
,
idx
,
(((
scrambled_payload
[(
i
<<
1
)
>>
5
])
>>
((
i
<<
1
)
&
0x1f
))
&
1
),
(((
scrambled_payload
[((
i
<<
1
)
+
1
)
>>
5
])
>>
(((
i
<<
1
)
+
1
)
&
0x1f
))
&
1
),
mod_dci
[(
i
<<
1
)],
mod_dci
[(
i
<<
1
)
+
1
]);
printf
(
"i %d idx %d b0-b1 %d-%d mod_dci %d %d
\n
"
,
i
,
idx
,
(((
encoder_output
[(
i
<<
1
)
>>
5
])
>>
((
i
<<
1
)
&
0x1f
))
&
1
),
(((
encoder_output
[((
i
<<
1
)
+
1
)
>>
5
])
>>
(((
i
<<
1
)
+
1
)
&
0x1f
))
&
1
),
mod_dci
[(
i
<<
1
)],
mod_dci
[(
i
<<
1
)
+
1
]);
#endif
}
...
...
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