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
canghaiwuhen
OpenXG-RAN
Commits
a780c31d
Commit
a780c31d
authored
Oct 10, 2018
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes to integrate fixed-point polar decoder
parent
80060d9e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
18 deletions
+29
-18
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+27
-16
openair1/PHY/defs_nr_UE.h
openair1/PHY/defs_nr_UE.h
+2
-2
No files found.
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
a780c31d
...
@@ -399,7 +399,7 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
...
@@ -399,7 +399,7 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
int
i
;
int
i
;
uint8_t
reset
,
offset
;
uint8_t
reset
,
offset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint32_t
x1
,
x2
,
s
=
0
;
double
*
demod_pbch_e
=
pbch
->
demod_pbch_e
;
int16_t
*
demod_pbch_e
=
pbch
->
llr
;
uint32_t
*
pbch_a_prime
=
(
uint32_t
*
)
pbch
->
pbch_a_prime
;
uint32_t
*
pbch_a_prime
=
(
uint32_t
*
)
pbch
->
pbch_a_prime
;
uint32_t
*
pbch_a_interleaved
=
(
uint32_t
*
)
pbch
->
pbch_a_interleaved
;
uint32_t
*
pbch_a_interleaved
=
(
uint32_t
*
)
pbch
->
pbch_a_interleaved
;
uint32_t
unscrambling_mask
=
0x100006D
;
uint32_t
unscrambling_mask
=
0x100006D
;
...
@@ -481,7 +481,7 @@ void nr_pbch_alamouti(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -481,7 +481,7 @@ void nr_pbch_alamouti(NR_DL_FRAME_PARMS *frame_parms,
}
}
void
nr_pbch_quantize
(
int
8
_t
*
pbch_llr8
,
void
nr_pbch_quantize
(
int
16
_t
*
pbch_llr8
,
int16_t
*
pbch_llr
,
int16_t
*
pbch_llr
,
uint16_t
len
)
uint16_t
len
)
{
{
...
@@ -498,10 +498,11 @@ void nr_pbch_quantize(int8_t *pbch_llr8,
...
@@ -498,10 +498,11 @@ void nr_pbch_quantize(int8_t *pbch_llr8,
}
}
}
}
/*
unsigned char sign(int8_t x) {
unsigned char sign(int8_t x) {
return (unsigned char)x >> 7;
return (unsigned char)x >> 7;
}
}
*/
uint8_t
pbch_deinterleaving_pattern
[
32
]
=
{
28
,
0
,
31
,
30
,
1
,
29
,
25
,
27
,
22
,
2
,
24
,
3
,
4
,
5
,
6
,
7
,
18
,
21
,
20
,
8
,
9
,
10
,
11
,
19
,
26
,
12
,
13
,
14
,
15
,
16
,
23
,
17
};
uint8_t
pbch_deinterleaving_pattern
[
32
]
=
{
28
,
0
,
31
,
30
,
1
,
29
,
25
,
27
,
22
,
2
,
24
,
3
,
4
,
5
,
6
,
7
,
18
,
21
,
20
,
8
,
9
,
10
,
11
,
19
,
26
,
12
,
13
,
14
,
15
,
16
,
23
,
17
};
...
@@ -533,18 +534,27 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -533,18 +534,27 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
uint8_t
ssb_index
=
0
;
uint8_t
ssb_index
=
0
;
//uint16_t crc;
//uint16_t crc;
//short nr_demod_table[8] = {0,0,0,1,1,0,1,1};
//short nr_demod_table[8] = {0,0,0,1,1,0,1,1};
double
nr_demod_table
[
8
]
=
{
0
.
707
,
0
.
707
,
-
0
.
707
,
0
.
707
,
0
.
707
,
-
0
.
707
,
-
0
.
707
,
-
0
.
707
};
//
double nr_demod_table[8] = {0.707,0.707,-0.707,0.707,0.707,-0.707,-0.707,-0.707};
double
*
demod_pbch_e
=
malloc
(
sizeof
(
double
)
*
864
);
//int16_t *demod_pbch_e; // = malloc (sizeof(int16_t
) * 864);
unsigned
short
idx_demod
=
0
;
unsigned
short
idx_demod
=
0
;
int8_t
decoderState
=
0
;
int8_t
decoderState
=
0
;
uint8_t
decoderListSize
=
8
,
pathMetricAppr
=
0
;
uint8_t
decoderListSize
=
8
,
pathMetricAppr
=
0
;
double
aPrioriArray
[
frame_parms
->
pbch_polar_params
.
payloadBits
];
// assume no a priori knowledge available about the payload.
time_stats_t
polar_decoder_init
,
polar_rate_matching
,
decoding
,
bit_extraction
,
deinterleaving
;
time_stats_t
path_metric
,
sorting
,
update_LLR
;
memset
(
&
pbch_a
[
0
],
0
,
sizeof
(
uint8_t
)
*
NR_POLAR_PBCH_PAYLOAD_BITS
);
memset
(
&
pbch_a
[
0
],
0
,
sizeof
(
uint8_t
)
*
NR_POLAR_PBCH_PAYLOAD_BITS
);
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
//printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
for
(
int
i
=
0
;
i
<
frame_parms
->
pbch_polar_params
.
payloadBits
;
i
++
)
aPrioriArray
[
i
]
=
NAN
;
reset_meas
(
&
polar_decoder_init
);
reset_meas
(
&
polar_rate_matching
);
reset_meas
(
&
decoding
);
reset_meas
(
&
bit_extraction
);
reset_meas
(
&
deinterleaving
);
reset_meas
(
&
sorting
);
reset_meas
(
&
path_metric
);
reset_meas
(
&
update_LLR
);
int
subframe_rx
=
proc
->
subframe_rx
;
int
subframe_rx
=
proc
->
subframe_rx
;
...
@@ -597,14 +607,14 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -597,14 +607,14 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
nr_ue_pbch_vars->rxdataF_comp,
nr_ue_pbch_vars->rxdataF_comp,
symbol);*/
symbol);*/
/*
if (mimo_mode == ALAMOUTI) {
if (mimo_mode == ALAMOUTI) {
nr_pbch_alamouti(frame_parms,nr_ue_pbch_vars->rxdataF_comp,symbol);
nr_pbch_alamouti(frame_parms,nr_ue_pbch_vars->rxdataF_comp,symbol);
} else if (mimo_mode != SISO) {
} else if (mimo_mode != SISO) {
msg("[PBCH][RX] Unsupported MIMO mode\n");
msg("[PBCH][RX] Unsupported MIMO mode\n");
return(-1);
return(-1);
}
}
*/
if
(
symbol
==
6
)
{
if
(
symbol
==
6
)
{
nr_pbch_quantize
(
pbch_e_rx
,
nr_pbch_quantize
(
pbch_e_rx
,
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
symbol
*
240
]),
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
symbol
*
240
]),
...
@@ -623,7 +633,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -623,7 +633,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
}
}
pbch_e_rx
=
nr_ue_pbch_vars
->
llr
;
pbch_e_rx
=
nr_ue_pbch_vars
->
llr
;
demod_pbch_e
=
nr_ue_pbch_vars
->
demod_pbch_e
;
//
demod_pbch_e = nr_ue_pbch_vars->demod_pbch_e;
pbch_a
=
nr_ue_pbch_vars
->
pbch_a
;
pbch_a
=
nr_ue_pbch_vars
->
pbch_a
;
pbch_a_prime
=
nr_ue_pbch_vars
->
pbch_a_prime
;
pbch_a_prime
=
nr_ue_pbch_vars
->
pbch_a_prime
;
...
@@ -634,7 +644,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -634,7 +644,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
for
(
int
cnt
=
0
;
cnt
<
8
;
cnt
++
)
for
(
int
cnt
=
0
;
cnt
<
8
;
cnt
++
)
printf
(
"pbch rx llr %d rxdata_comp %d addr %p
\n
"
,
*
(
pbch_e_rx
+
cnt
),
p
[
cnt
],
&
p
[
0
]);
printf
(
"pbch rx llr %d rxdata_comp %d addr %p
\n
"
,
*
(
pbch_e_rx
+
cnt
),
p
[
cnt
],
&
p
[
0
]);
//#endif
//#endif
/*
for (i=0; i<NR_POLAR_PBCH_E/2; i++){
for (i=0; i<NR_POLAR_PBCH_E/2; i++){
idx_demod = (sign(pbch_e_rx[i<<1])&1) ^ ((sign(pbch_e_rx[(i<<1)+1])&1)<<1);
idx_demod = (sign(pbch_e_rx[i<<1])&1) ^ ((sign(pbch_e_rx[(i<<1)+1])&1)<<1);
demod_pbch_e[i<<1] = nr_demod_table[(idx_demod)<<1];
demod_pbch_e[i<<1] = nr_demod_table[(idx_demod)<<1];
...
@@ -646,19 +656,20 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -646,19 +656,20 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
printf("demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);}
printf("demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);}
#endif
#endif
}
}
*/
//un-scrambling
//un-scrambling
M
=
NR_POLAR_PBCH_E
;
M
=
NR_POLAR_PBCH_E
;
nushift
=
(
Lmax
==
4
)
?
ssb_index
&
3
:
ssb_index
&
7
;
nushift
=
(
Lmax
==
4
)
?
ssb_index
&
3
:
ssb_index
&
7
;
nr_pbch_unscrambling
(
nr_ue_pbch_vars
,
frame_parms
->
Nid_cell
,
nushift
,
M
,
NR_POLAR_PBCH_E
,
0
);
nr_pbch_unscrambling
(
nr_ue_pbch_vars
,
frame_parms
->
Nid_cell
,
nushift
,
M
,
NR_POLAR_PBCH_E
,
0
);
/*
//#ifdef DEBUG_PBCH
//#ifdef DEBUG_PBCH
for (i=0; i<16; i++){
for (i=0; i<16; i++){
printf("unscrambling demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);}
printf("unscrambling demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);}
//#endif
//#endif
*/
//polar decoding de-rate matching
//polar decoding de-rate matching
decoderState
=
polar_decoder
(
demod_pbch_e
,
pbch_a_b
,
&
frame_parms
->
pbch_polar_params
,
decoderListSize
,
aPrioriArray
,
pathMetricAppr
);
decoderState
=
polar_decoder
_int8_new
(
pbch_e_rx
,
pbch_a_b
,
&
frame_parms
->
pbch_polar_params
,
decoderListSize
,
&
polar_decoder_init
,
&
polar_rate_matching
,
&
decoding
,
&
bit_extraction
,
&
deinterleaving
,
&
sorting
,
&
path_metric
,
&
update_LLR
,
0
);
printf
(
"polar decoder state %d
\n
"
,
decoderState
);
printf
(
"polar decoder state %d
\n
"
,
decoderState
);
if
(
decoderState
==
-
1
)
if
(
decoderState
==
-
1
)
return
(
decoderState
);
return
(
decoderState
);
...
...
openair1/PHY/defs_nr_UE.h
View file @
a780c31d
...
@@ -924,10 +924,10 @@ typedef struct {
...
@@ -924,10 +924,10 @@ typedef struct {
uint8_t
pbch_a_interleaved
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a_interleaved
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a_prime
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a_prime
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_e
[
NR_POLAR_PBCH_E
];
uint8_t
pbch_e
[
NR_POLAR_PBCH_E
];
double
demod_pbch_e
[
NR_POLAR_PBCH_E
];
int16_t
demod_pbch_e
[
NR_POLAR_PBCH_E
];
/// \brief Pointer to PBCH llrs.
/// \brief Pointer to PBCH llrs.
/// - first index: ? [0..1919] (hard coded)
/// - first index: ? [0..1919] (hard coded)
int
8
_t
*
llr
;
int
16
_t
*
llr
;
/// \brief Pointer to PBCH decoded output.
/// \brief Pointer to PBCH decoded output.
/// - first index: ? [0..63] (hard coded)
/// - first index: ? [0..63] (hard coded)
uint8_t
*
decoded_output
;
uint8_t
*
decoded_output
;
...
...
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