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
Michael Black
OpenXG-RAN
Commits
96bde322
Commit
96bde322
authored
Nov 28, 2022
by
laurent
Committed by
Robert Schmidt
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code quality
parent
c40d246f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
200 additions
and
250 deletions
+200
-250
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+198
-242
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+2
-8
No files found.
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
View file @
96bde322
...
@@ -232,13 +232,7 @@ void nr_processULSegment(void* arg) {
...
@@ -232,13 +232,7 @@ void nr_processULSegment(void* arg) {
uint8_t
kc
=
rdata
->
Kc
;
uint8_t
kc
=
rdata
->
Kc
;
short
*
ulsch_llr
=
rdata
->
ulsch_llr
;
short
*
ulsch_llr
=
rdata
->
ulsch_llr
;
int
max_ldpc_iterations
=
p_decoderParms
->
numMaxIter
;
int
max_ldpc_iterations
=
p_decoderParms
->
numMaxIter
;
int8_t
llrProcBuf
[
OAI_UL_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
int8_t
llrProcBuf
[
OAI_UL_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
p_decoderParms
->
R
=
nr_get_R_ldpc_decoder
(
rv_index
,
E
,
p_decoderParms
->
BG
,
p_decoderParms
->
Z
,
&
ulsch_harq
->
llrLen
,
ulsch_harq
->
round
);
int16_t
z
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int16_t
z
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int8_t
l
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int8_t
l
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
...
@@ -379,31 +373,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -379,31 +373,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint32_t
frame
,
uint32_t
frame
,
uint8_t
nr_tti_rx
,
uint8_t
nr_tti_rx
,
uint8_t
harq_pid
,
uint8_t
harq_pid
,
uint32_t
G
)
{
uint32_t
G
)
{
uint32_t
A
;
uint32_t
r
;
uint32_t
r_offset
;
uint32_t
offset
;
int
E
;
int8_t
llrProcBuf
[
22
*
384
];
int
ret
=
0
;
int
i
,
j
;
int8_t
enable_ldpc_offload
=
phy_vars_gNB
->
ldpc_offload_flag
;
int16_t
z_ol
[
68
*
384
];
int8_t
l_ol
[
68
*
384
];
__m128i
*
pv_ol128
=
(
__m128i
*
)
&
z_ol
;
__m128i
*
pl_ol128
=
(
__m128i
*
)
&
l_ol
;
int
no_iteration_ldpc
=
2
;
int
length_dec
;
uint8_t
crc_type
;
int
K_bits_F
;
int16_t
z
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int8_t
l
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
__m128i
*
pv
=
(
__m128i
*
)
&
z
;
__m128i
*
pl
=
(
__m128i
*
)
&
l
;
#ifdef PRINT_CRC_CHECK
#ifdef PRINT_CRC_CHECK
prnt_crc_cnt
++
;
prnt_crc_cnt
++
;
#endif
#endif
...
@@ -418,8 +389,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -418,8 +389,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
return
1
;
return
1
;
}
}
uint8_t
dtx_det
=
0
;
uint8_t
dtx_det
=
0
;
t_nrLDPC_dec_params
decParams
;
t_nrLDPC_dec_params
*
p_decParams
=
&
decParams
;
int
Kr
;
int
Kr
;
int
Kr_bytes
;
int
Kr_bytes
;
...
@@ -444,22 +413,22 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -444,22 +413,22 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
dtx_det
=
0
;
dtx_det
=
0
;
A
=
(
harq_process
->
TBS
)
<<
3
;
uint32_t
A
=
(
harq_process
->
TBS
)
<<
3
;
// target_code_rate is in 0.1 units
// target_code_rate is in 0.1 units
float
Coderate
=
(
float
)
pusch_pdu
->
target_code_rate
/
10240
.
0
f
;
float
Coderate
=
(
float
)
pusch_pdu
->
target_code_rate
/
10240
.
0
f
;
LOG_D
(
PHY
,
"ULSCH Decoding, harq_pid %d rnti %x TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d new RX %d
\n
"
,
LOG_D
(
PHY
,
"ULSCH Decoding, harq_pid %d rnti %x TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d new RX %d
\n
"
,
harq_pid
,
ulsch
->
rnti
,
A
,
G
,
mcs
,
n_layers
,
nb_rb
,
Qm
,
Coderate
,
pusch_pdu
->
pusch_data
.
rv_index
,
harq_process
->
round
,
harq_process
->
new_rx
);
harq_pid
,
ulsch
->
rnti
,
A
,
G
,
mcs
,
n_layers
,
nb_rb
,
Qm
,
Coderate
,
pusch_pdu
->
pusch_data
.
rv_index
,
harq_process
->
round
,
harq_process
->
new_rx
);
t_nrLDPC_dec_params
decParams
=
{
0
};
p_decParams
->
BG
=
pusch_pdu
->
maintenance_parms_v3
.
ldpcBaseGraph
;
decParams
.
BG
=
pusch_pdu
->
maintenance_parms_v3
.
ldpcBaseGraph
;
int
kc
;
int
kc
;
if
(
p_decParams
->
BG
==
2
)
{
if
(
decParams
.
BG
==
2
)
{
kc
=
52
;
kc
=
52
;
}
else
{
}
else
{
kc
=
68
;
kc
=
68
;
}
}
NR_gNB_SCH_STATS_t
*
stats
=
NULL
;
NR_gNB_SCH_STATS_t
*
stats
=
NULL
;
int
first_free
=-
1
;
int
first_free
=-
1
;
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NUMBER_OF_NR_SCH_STATS_MAX
;
i
++
)
{
...
@@ -477,8 +446,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -477,8 +446,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
stats
->
rnti
=
ulsch
->
rnti
;
stats
->
rnti
=
ulsch
->
rnti
;
stats
->
round_trials
[
harq_process
->
round
]
++
;
stats
->
round_trials
[
harq_process
->
round
]
++
;
for
(
int
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
for
(
int
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
stats
->
power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_power
[
aarx
]);
stats
->
power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_power
[
aarx
]);
stats
->
noise_power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_noise_power
[
aarx
]);
stats
->
noise_power
[
aarx
]
=
dB_fixed_x10
(
pusch
->
ulsch_noise_power
[
aarx
]);
}
}
if
(
harq_process
->
new_rx
==
0
)
{
if
(
harq_process
->
new_rx
==
0
)
{
stats
->
current_Qm
=
Qm
;
stats
->
current_Qm
=
Qm
;
...
@@ -491,7 +460,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -491,7 +460,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
else
else
harq_process
->
B
=
A
+
16
;
harq_process
->
B
=
A
+
16
;
// [hna] Perform nr_segmenation with input and output set to NULL to calculate only (B, C, K, Z, F)
// [hna] Perform nr_segmenation with input and output set to NULL to calculate only (B, C, K, Z, F)
nr_segmentation
(
NULL
,
nr_segmentation
(
NULL
,
NULL
,
NULL
,
harq_process
->
B
,
harq_process
->
B
,
...
@@ -499,7 +468,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -499,7 +468,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
&
harq_process
->
K
,
&
harq_process
->
K
,
&
harq_process
->
Z
,
// [hna] Z is Zc
&
harq_process
->
Z
,
// [hna] Z is Zc
&
harq_process
->
F
,
&
harq_process
->
F
,
p_decParams
->
BG
);
decParams
.
BG
);
if
(
harq_process
->
C
>
MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER
*
n_layers
)
{
if
(
harq_process
->
C
>
MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER
*
n_layers
)
{
LOG_E
(
PHY
,
"nr_segmentation.c: too many segments %d, B %d
\n
"
,
harq_process
->
C
,
harq_process
->
B
);
LOG_E
(
PHY
,
"nr_segmentation.c: too many segments %d, B %d
\n
"
,
harq_process
->
C
,
harq_process
->
B
);
...
@@ -512,14 +481,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -512,14 +481,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
if
(
!
frame
%
100
)
if
(
!
frame
%
100
)
printf
(
"K %d C %d Z %d
\n
"
,
harq_process
->
K
,
harq_process
->
C
,
harq_process
->
Z
);
printf
(
"K %d C %d Z %d
\n
"
,
harq_process
->
K
,
harq_process
->
C
,
harq_process
->
Z
);
#endif
#endif
decParams
.
Z
=
harq_process
->
Z
;
p_decParams
->
Z
=
harq_process
->
Z
;
decParams
.
numMaxIter
=
ulsch
->
max_ldpc_iterations
;
decParams
.
outMode
=
0
;
p_decParams
->
numMaxIter
=
ulsch
->
max_ldpc_iterations
;
uint32_t
r_offset
=
0
;
p_decParams
->
outMode
=
0
;
r_offset
=
0
;
uint16_t
a_segments
=
MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER
*
n_layers
;
//number of segments to be allocated
uint16_t
a_segments
=
MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER
*
n_layers
;
//number of segments to be allocated
...
@@ -536,217 +503,206 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...
@@ -536,217 +503,206 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
printf
(
"Segmentation: C %d, K %d
\n
"
,
harq_process
->
C
,
harq_process
->
K
);
printf
(
"Segmentation: C %d, K %d
\n
"
,
harq_process
->
C
,
harq_process
->
K
);
#endif
#endif
Kr
=
harq_process
->
K
;
Kr
=
harq_process
->
K
;
Kr_bytes
=
Kr
>>
3
;
Kr_bytes
=
Kr
>>
3
;
offset
=
0
;
//if ((enable_ldpc_offload)&& (dtx_det==0))
uint32_t
offset
=
0
;
if
(
enable_ldpc_offload
){
if
(
phy_vars_gNB
->
ldpc_offload_flag
)
{
int8_t
llrProcBuf
[
22
*
384
];
// if (dtx_det==0) {
// if (dtx_det==0) {
int16_t
z_ol
[
68
*
384
];
if
(
harq_process
->
C
==
1
)
{
int8_t
l_ol
[
68
*
384
];
if
(
A
>
3824
)
crc_type
=
CRC24_A
;
else
crc_type
=
CRC16
;
length_dec
=
harq_process
->
B
;
int16_t
z
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
}
int8_t
l
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
else
{
crc_type
=
CRC24_B
;
length_dec
=
(
harq_process
->
B
+
24
*
harq_process
->
C
)
/
harq_process
->
C
;
}
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
__m128i
*
pv
=
(
__m128i
*
)
&
z
;
E
=
nr_get_E
(
G
,
harq_process
->
C
,
Qm
,
n_layers
,
r
);
__m128i
*
pl
=
(
__m128i
*
)
&
l
;
memset
(
harq_process
->
c
[
r
],
0
,
Kr_bytes
);
int
crc_type
;
int
length_dec
;
p_decParams
->
R
=
nr_get_R_ldpc_decoder
(
pusch_pdu
->
pusch_data
.
rv_index
,
E
,
p_decParams
->
BG
,
p_decParams
->
Z
,
&
harq_process
->
llrLen
,
harq_process
->
round
);
if
((
dtx_det
==
0
)
&&
(
pusch_pdu
->
pusch_data
.
rv_index
==
0
)){
//if (dtx_det==0){
if
(
mcs
>
9
){
memcpy
((
&
z_ol
[
0
]),
ulsch_llr
+
r_offset
,
E
*
sizeof
(
short
));
for
(
i
=
0
,
j
=
0
;
j
<
((
kc
*
harq_process
->
Z
)
>>
4
)
+
1
;
i
+=
2
,
j
++
)
{
pl_ol128
[
j
]
=
_mm_packs_epi16
(
pv_ol128
[
i
],
pv_ol128
[
i
+
1
]);
}
ret
=
nrLDPC_decoder_offload
(
p_decParams
,
harq_pid
,
ULSCH_id
,
r
,
pusch_pdu
->
pusch_data
.
rv_index
,
harq_process
->
F
,
E
,
Qm
,
(
int8_t
*
)
&
pl_ol128
[
0
],
llrProcBuf
,
1
);
if
(
ret
<
0
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: Problem in LDPC decoder offload
\n
"
);
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
return
1
;
}
}
else
{
K_bits_F
=
Kr
-
harq_process
->
F
;
t_nrLDPC_time_stats
procTime
=
{
0
};
t_nrLDPC_time_stats
*
p_procTime
=
&
procTime
;
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
int16_t
harq_e
[
3
*
8448
];
nr_deinterleaving_ldpc
(
E
,
Qm
,
harq_e
,
ulsch_llr
+
r_offset
);
if
(
nr_rate_matching_ldpc_rx
(
pusch_pdu
->
maintenance_parms_v3
.
tbSizeLbrmBytes
,
p_decParams
->
BG
,
p_decParams
->
Z
,
harq_process
->
d
[
r
],
harq_e
,
harq_process
->
C
,
pusch_pdu
->
pusch_data
.
rv_index
,
harq_process
->
new_rx
,
E
,
harq_process
->
F
,
Kr
-
harq_process
->
F
-
2
*
(
p_decParams
->
Z
))
==-
1
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: Problem in rate_matching
\n
"
);
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
return
1
;
}
//set first 2*Z_c bits to zeros
memset
(
&
z
[
0
],
0
,
2
*
harq_process
->
Z
*
sizeof
(
int16_t
));
//set Filler bits
memset
((
&
z
[
0
]
+
K_bits_F
),
127
,
harq_process
->
F
*
sizeof
(
int16_t
));
//Move coded bits before filler bits
memcpy
((
&
z
[
0
]
+
2
*
harq_process
->
Z
),
harq_process
->
d
[
r
],(
K_bits_F
-
2
*
harq_process
->
Z
)
*
sizeof
(
int16_t
));
//skip filler bits
memcpy
((
&
z
[
0
]
+
Kr
),
harq_process
->
d
[
r
]
+
(
Kr
-
2
*
harq_process
->
Z
),(
kc
*
harq_process
->
Z
-
Kr
)
*
sizeof
(
int16_t
));
//Saturate coded bits before decoding into 8 bits values
for
(
i
=
0
,
j
=
0
;
j
<
((
kc
*
harq_process
->
Z
)
>>
4
)
+
1
;
i
+=
2
,
j
++
)
{
pl
[
j
]
=
_mm_packs_epi16
(
pv
[
i
],
pv
[
i
+
1
]);
}
no_iteration_ldpc
=
nrLDPC_decoder
(
p_decParams
,
(
int8_t
*
)
&
pl
[
0
],
llrProcBuf
,
p_procTime
);
}
if
(
harq_process
->
C
==
1
)
{
if
(
A
>
3824
)
for
(
int
m
=
0
;
m
<
Kr
>>
3
;
m
++
)
{
crc_type
=
CRC24_A
;
harq_process
->
c
[
r
][
m
]
=
(
uint8_t
)
llrProcBuf
[
m
];
else
crc_type
=
CRC16
;
length_dec
=
harq_process
->
B
;
}
else
{
crc_type
=
CRC24_B
;
length_dec
=
(
harq_process
->
B
+
24
*
harq_process
->
C
)
/
harq_process
->
C
;
}
}
int
no_iteration_ldpc
=
2
;
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
for
(
int
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
int
E
=
nr_get_E
(
G
,
harq_process
->
C
,
Qm
,
n_layers
,
r
);
memset
(
harq_process
->
c
[
r
],
0
,
Kr_bytes
);
decParams
.
R
=
nr_get_R_ldpc_decoder
(
pusch_pdu
->
pusch_data
.
rv_index
,
E
,
decParams
.
BG
,
decParams
.
Z
,
&
harq_process
->
llrLen
,
harq_process
->
round
);
if
((
dtx_det
==
0
)
&&
(
pusch_pdu
->
pusch_data
.
rv_index
==
0
))
{
// if (dtx_det==0){
if
(
mcs
>
9
)
{
memcpy
((
&
z_ol
[
0
]),
ulsch_llr
+
r_offset
,
E
*
sizeof
(
short
));
__m128i
*
pv_ol128
=
(
__m128i
*
)
&
z_ol
;
__m128i
*
pl_ol128
=
(
__m128i
*
)
&
l_ol
;
for
(
int
i
=
0
,
j
=
0
;
j
<
((
kc
*
harq_process
->
Z
)
>>
4
)
+
1
;
i
+=
2
,
j
++
)
{
pl_ol128
[
j
]
=
_mm_packs_epi16
(
pv_ol128
[
i
],
pv_ol128
[
i
+
1
]);
}
int
ret
=
nrLDPC_decoder_offload
(
&
decParams
,
harq_pid
,
ULSCH_id
,
r
,
pusch_pdu
->
pusch_data
.
rv_index
,
harq_process
->
F
,
E
,
Qm
,
(
int8_t
*
)
&
pl_ol128
[
0
],
llrProcBuf
,
1
);
if
(
ret
<
0
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: Problem in LDPC decoder offload
\n
"
);
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
return
1
;
}
}
else
{
int
K_bits_F
=
Kr
-
harq_process
->
F
;
t_nrLDPC_time_stats
procTime
=
{
0
};
t_nrLDPC_time_stats
*
p_procTime
=
&
procTime
;
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
int16_t
harq_e
[
3
*
8448
];
nr_deinterleaving_ldpc
(
E
,
Qm
,
harq_e
,
ulsch_llr
+
r_offset
);
if
(
nr_rate_matching_ldpc_rx
(
pusch_pdu
->
maintenance_parms_v3
.
tbSizeLbrmBytes
,
decParams
.
BG
,
decParams
.
Z
,
harq_process
->
d
[
r
],
harq_e
,
harq_process
->
C
,
pusch_pdu
->
pusch_data
.
rv_index
,
harq_process
->
new_rx
,
E
,
harq_process
->
F
,
Kr
-
harq_process
->
F
-
2
*
(
decParams
.
Z
))
==
-
1
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: Problem in rate_matching
\n
"
);
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
return
1
;
}
// set first 2*Z_c bits to zeros
memset
(
&
z
[
0
],
0
,
2
*
harq_process
->
Z
*
sizeof
(
int16_t
));
// set Filler bits
memset
((
&
z
[
0
]
+
K_bits_F
),
127
,
harq_process
->
F
*
sizeof
(
int16_t
));
// Move coded bits before filler bits
memcpy
((
&
z
[
0
]
+
2
*
harq_process
->
Z
),
harq_process
->
d
[
r
],
(
K_bits_F
-
2
*
harq_process
->
Z
)
*
sizeof
(
int16_t
));
// skip filler bits
memcpy
((
&
z
[
0
]
+
Kr
),
harq_process
->
d
[
r
]
+
(
Kr
-
2
*
harq_process
->
Z
),
(
kc
*
harq_process
->
Z
-
Kr
)
*
sizeof
(
int16_t
));
// Saturate coded bits before decoding into 8 bits values
for
(
int
i
=
0
,
j
=
0
;
j
<
((
kc
*
harq_process
->
Z
)
>>
4
)
+
1
;
i
+=
2
,
j
++
)
{
pl
[
j
]
=
_mm_packs_epi16
(
pv
[
i
],
pv
[
i
+
1
]);
}
no_iteration_ldpc
=
nrLDPC_decoder
(
&
decParams
,
(
int8_t
*
)
pl
,
llrProcBuf
,
p_procTime
);
}
for
(
int
m
=
0
;
m
<
Kr
>>
3
;
m
++
)
{
harq_process
->
c
[
r
][
m
]
=
(
uint8_t
)
llrProcBuf
[
m
];
}
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
#ifdef PRINT_CRC_CHECK
#ifdef PRINT_CRC_CHECK
LOG_I
(
PHY
,
"Segment %d CRC OK
\n
"
,
r
);
LOG_I
(
PHY
,
"Segment %d CRC OK
\n
"
,
r
);
#endif
#endif
no_iteration_ldpc
=
2
;
no_iteration_ldpc
=
2
;
}
else
{
}
else
{
#ifdef PRINT_CRC_CHECK
#ifdef PRINT_CRC_CHECK
LOG_I
(
PHY
,
"segment %d CRC NOK
\n
"
,
r
);
LOG_I
(
PHY
,
"segment %d CRC NOK
\n
"
,
r
);
#endif
#endif
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
}
//}
r_offset
+=
E
;
/*for (int k=0;k<8;k++)
{
printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
printf("llrprocbuf [%d] = %x adr %p\n", k, llrProcBuf[k], llrProcBuf+k);
}
*/
}
else
{
dtx_det
=
0
;
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
}
bool
decodeSuccess
=
(
no_iteration_ldpc
<=
ulsch
->
max_ldpc_iterations
);
if
(
decodeSuccess
)
{
memcpy
(
harq_process
->
b
+
offset
,
harq_process
->
c
[
r
],
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
harq_process
->
processedSegments
++
;
}
else
{
LOG_D
(
PHY
,
"uplink segment error %d/%d
\n
"
,
r
,
harq_process
->
C
);
LOG_D
(
PHY
,
"ULSCH %d in error
\n
"
,
ULSCH_id
);
break
;
// don't even attempt to decode other segments
}
}
}
//}
r_offset
+=
E
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING
,
0
)
;
/*for (int k=0;k<8;k++)
if
((
harq_process
->
processedSegments
==
(
harq_process
->
C
)))
{
{
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting ACK for slot %d TBS %d
\n
"
,
phy_vars_gNB
->
Mod_id
,
harq_process
->
slot
,
harq_process
->
TBS
);
printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
harq_process
->
status
=
SCH_IDLE
;
printf("llrprocbuf [%d] = %x adr %p\n", k, llrProcBuf[k], llrProcBuf+k);
harq_process
->
round
=
0
;
}
ulsch
->
harq_mask
&=
~
(
1
<<
harq_pid
);
*/
}
else
{
dtx_det
=
0
;
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
}
bool
decodeSuccess
=
(
no_iteration_ldpc
<=
ulsch
->
max_ldpc_iterations
);
if
(
decodeSuccess
)
{
memcpy
(
harq_process
->
b
+
offset
,
harq_process
->
c
[
r
],
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
harq_process
->
processedSegments
++
;
}
else
{
LOG_D
(
PHY
,
"uplink segment error %d/%d
\n
"
,
r
,
harq_process
->
C
);
LOG_D
(
PHY
,
"ULSCH %d in error
\n
"
,
ULSCH_id
);
break
;
//don't even attempt to decode other segments
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING
,
0
);
LOG_D
(
PHY
,
"ULSCH received ok
\n
"
);
nr_fill_indication
(
phy_vars_gNB
,
harq_process
->
frame
,
harq_process
->
slot
,
ULSCH_id
,
harq_pid
,
0
,
0
);
if
((
harq_process
->
processedSegments
==
(
harq_process
->
C
)))
{
}
else
{
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting ACK for slot %d TBS %d
\n
"
,
LOG_D
(
PHY
,
phy_vars_gNB
->
Mod_id
,
harq_process
->
slot
,
harq_process
->
TBS
);
"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d)
\n
"
,
harq_process
->
status
=
SCH_IDLE
;
phy_vars_gNB
->
Mod_id
,
harq_process
->
round
=
0
;
harq_process
->
frame
,
ulsch
->
harq_mask
&=
~
(
1
<<
harq_pid
);
harq_process
->
slot
,
harq_pid
,
LOG_D
(
PHY
,
"ULSCH received ok
\n
"
);
harq_process
->
status
,
nr_fill_indication
(
phy_vars_gNB
,
harq_process
->
frame
,
harq_process
->
slot
,
ULSCH_id
,
harq_pid
,
0
,
0
);
harq_process
->
round
,
harq_process
->
TBS
);
}
else
{
harq_process
->
handled
=
1
;
LOG_D
(
PHY
,
"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d
\n
"
,
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
phy_vars_gNB
->
Mod_id
,
harq_process
->
frame
,
harq_process
->
slot
,
LOG_D
(
PHY
,
"ULSCH %d in error
\n
"
,
ULSCH_id
);
harq_pid
,
harq_process
->
status
,
harq_process
->
round
,
harq_process
->
TBS
,
r
);
nr_fill_indication
(
phy_vars_gNB
,
harq_process
->
frame
,
harq_process
->
slot
,
ULSCH_id
,
harq_pid
,
1
,
0
);
harq_process
->
handled
=
1
;
}
no_iteration_ldpc
=
ulsch
->
max_ldpc_iterations
+
1
;
ulsch
->
last_iteration_cnt
=
no_iteration_ldpc
;
LOG_D
(
PHY
,
"ULSCH %d in error
\n
"
,
ULSCH_id
);
nr_fill_indication
(
phy_vars_gNB
,
harq_process
->
frame
,
harq_process
->
slot
,
ULSCH_id
,
harq_pid
,
1
,
0
);
}
ulsch
->
last_iteration_cnt
=
no_iteration_ldpc
;
}
}
else
{
else
{
dtx_det
=
0
;
dtx_det
=
0
;
void
(
*
nr_processULSegment_ptr
)(
void
*
)
=
&
nr_processULSegment
;
for
(
int
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
int
E
=
nr_get_E
(
G
,
harq_process
->
C
,
Qm
,
n_layers
,
r
);
union
ldpcReqUnion
id
=
{.
s
=
{
ulsch
->
rnti
,
frame
,
nr_tti_rx
,
0
,
0
}};
E
=
nr_get_E
(
G
,
harq_process
->
C
,
Qm
,
n_layers
,
r
);
notifiedFIFO_elt_t
*
req
=
newNotifiedFIFO_elt
(
sizeof
(
ldpcDecode_t
),
id
.
p
,
&
phy_vars_gNB
->
respDecode
,
&
nr_processULSegment
);
union
ldpcReqUnion
id
=
{.
s
=
{
ulsch
->
rnti
,
frame
,
nr_tti_rx
,
0
,
0
}};
ldpcDecode_t
*
rdata
=
(
ldpcDecode_t
*
)
NotifiedFifoData
(
req
);
notifiedFIFO_elt_t
*
req
=
newNotifiedFIFO_elt
(
sizeof
(
ldpcDecode_t
),
id
.
p
,
&
phy_vars_gNB
->
respDecode
,
nr_processULSegment_ptr
);
decParams
.
R
=
nr_get_R_ldpc_decoder
(
pusch_pdu
->
pusch_data
.
rv_index
,
E
,
decParams
.
BG
,
decParams
.
Z
,
&
harq_process
->
llrLen
,
harq_process
->
round
);
ldpcDecode_t
*
rdata
=
(
ldpcDecode_t
*
)
NotifiedFifoData
(
req
);
rdata
->
gNB
=
phy_vars_gNB
;
rdata
->
ulsch_harq
=
harq_process
;
rdata
->
gNB
=
phy_vars_gNB
;
rdata
->
decoderParms
=
decParams
;
rdata
->
ulsch_harq
=
harq_process
;
rdata
->
ulsch_llr
=
ulsch_llr
;
rdata
->
decoderParms
=
decParams
;
rdata
->
Kc
=
kc
;
rdata
->
ulsch_llr
=
ulsch_llr
;
rdata
->
harq_pid
=
harq_pid
;
rdata
->
Kc
=
kc
;
rdata
->
segment_r
=
r
;
rdata
->
harq_pid
=
harq_pid
;
rdata
->
nbSegments
=
harq_process
->
C
;
rdata
->
segment_r
=
r
;
rdata
->
E
=
E
;
rdata
->
nbSegments
=
harq_process
->
C
;
rdata
->
A
=
A
;
rdata
->
E
=
E
;
rdata
->
Qm
=
Qm
;
rdata
->
A
=
A
;
rdata
->
r_offset
=
r_offset
;
rdata
->
Qm
=
Qm
;
rdata
->
Kr_bytes
=
Kr_bytes
;
rdata
->
r_offset
=
r_offset
;
rdata
->
rv_index
=
pusch_pdu
->
pusch_data
.
rv_index
;
rdata
->
Kr_bytes
=
Kr_bytes
;
rdata
->
offset
=
offset
;
rdata
->
rv_index
=
pusch_pdu
->
pusch_data
.
rv_index
;
rdata
->
ulsch
=
ulsch
;
rdata
->
offset
=
offset
;
rdata
->
ulsch_id
=
ULSCH_id
;
rdata
->
ulsch
=
ulsch
;
rdata
->
tbslbrm
=
pusch_pdu
->
maintenance_parms_v3
.
tbSizeLbrmBytes
;
rdata
->
ulsch_id
=
ULSCH_id
;
pushTpool
(
&
phy_vars_gNB
->
threadPool
,
req
);
rdata
->
tbslbrm
=
pusch_pdu
->
maintenance_parms_v3
.
tbSizeLbrmBytes
;
phy_vars_gNB
->
nbDecode
++
;
pushTpool
(
&
phy_vars_gNB
->
threadPool
,
req
);
LOG_D
(
PHY
,
"Added a block to decode, in pipe: %d
\n
"
,
phy_vars_gNB
->
nbDecode
);
phy_vars_gNB
->
nbDecode
++
;
r_offset
+=
E
;
LOG_D
(
PHY
,
"Added a block to decode, in pipe: %d
\n
"
,
phy_vars_gNB
->
nbDecode
);
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
r_offset
+=
E
;
//////////////////////////////////////////////////////////////////////////////////////////
offset
+=
(
Kr_bytes
-
(
harq_process
->
F
>>
3
)
-
((
harq_process
->
C
>
1
)
?
3
:
0
));
}
//////////////////////////////////////////////////////////////////////////////////////////
}
}
}
return
1
;
return
1
;
}
}
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
View file @
96bde322
...
@@ -155,14 +155,7 @@ void nr_processDLSegment(void* arg) {
...
@@ -155,14 +155,7 @@ void nr_processDLSegment(void* arg) {
uint32_t
Tbslbrm
=
rdata
->
Tbslbrm
;
uint32_t
Tbslbrm
=
rdata
->
Tbslbrm
;
short
*
dlsch_llr
=
rdata
->
dlsch_llr
;
short
*
dlsch_llr
=
rdata
->
dlsch_llr
;
rdata
->
decodeIterations
=
dlsch
->
max_ldpc_iterations
+
1
;
rdata
->
decodeIterations
=
dlsch
->
max_ldpc_iterations
+
1
;
int8_t
llrProcBuf
[
OAI_UL_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
int8_t
llrProcBuf
[
OAI_UL_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
p_decoderParms
->
R
=
nr_get_R_ldpc_decoder
(
rdata
->
rv_index
,
E
,
p_decoderParms
->
BG
,
p_decoderParms
->
Z
,
&
harq_process
->
llrLen
,
harq_process
->
DLround
);
int16_t
z
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int16_t
z
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int8_t
l
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
int8_t
l
[
68
*
384
+
16
]
__attribute__
((
aligned
(
16
)));
...
@@ -447,6 +440,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...
@@ -447,6 +440,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
//printf("start rx segment %d\n",r);
//printf("start rx segment %d\n",r);
E
=
nr_get_E
(
G
,
harq_process
->
C
,
dlsch
->
dlsch_config
.
qamModOrder
,
dlsch
->
Nl
,
r
);
E
=
nr_get_E
(
G
,
harq_process
->
C
,
dlsch
->
dlsch_config
.
qamModOrder
,
dlsch
->
Nl
,
r
);
decParams
.
R
=
nr_get_R_ldpc_decoder
(
dlsch
->
dlsch_config
.
rv
,
E
,
decParams
.
BG
,
decParams
.
Z
,
&
harq_process
->
llrLen
,
harq_process
->
DLround
);
union
ldpcReqUnion
id
=
{.
s
=
{
dlsch
->
rnti
,
frame
,
nr_slot_rx
,
0
,
0
}};
union
ldpcReqUnion
id
=
{.
s
=
{
dlsch
->
rnti
,
frame
,
nr_slot_rx
,
0
,
0
}};
notifiedFIFO_elt_t
*
req
=
newNotifiedFIFO_elt
(
sizeof
(
ldpcDecode_ue_t
),
id
.
p
,
&
nf
,
nr_processDLSegment_ptr
);
notifiedFIFO_elt_t
*
req
=
newNotifiedFIFO_elt
(
sizeof
(
ldpcDecode_ue_t
),
id
.
p
,
&
nf
,
nr_processDLSegment_ptr
);
ldpcDecode_ue_t
*
rdata
=
(
ldpcDecode_ue_t
*
)
NotifiedFifoData
(
req
);
ldpcDecode_ue_t
*
rdata
=
(
ldpcDecode_ue_t
*
)
NotifiedFifoData
(
req
);
...
...
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