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
lizhongxiao
OpenXG-RAN
Commits
39fa3e00
Commit
39fa3e00
authored
Mar 04, 2019
by
Hongzhi Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding ldpc decoder code rate adaptation
parent
232efe78
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
56 deletions
+70
-56
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
+1
-1
openair1/PHY/CODING/nr_rate_matching.c
openair1/PHY/CODING/nr_rate_matching.c
+2
-0
openair1/PHY/CODING/nr_segmentation.c
openair1/PHY/CODING/nr_segmentation.c
+1
-1
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+18
-7
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+48
-47
No files found.
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
View file @
39fa3e00
...
...
@@ -54,7 +54,7 @@ int32_t nrLDPC_decoder(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t*
t_nrLDPC_lut
lut
;
t_nrLDPC_lut
*
p_lut
=
&
lut
;
printf
(
"p_procBuf->cnProcBuf = %p
\n
"
,
p_procBuf
->
cnProcBuf
);
//
printf("p_procBuf->cnProcBuf = %p\n", p_procBuf->cnProcBuf);
// Initialize decoder core(s) with correct LUTs
numLLR
=
nrLDPC_init
(
p_decParams
,
p_lut
);
...
...
openair1/PHY/CODING/nr_rate_matching.c
View file @
39fa3e00
...
...
@@ -182,6 +182,7 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
#endif
}
if
(
rvidx
!=
0
){
while
(
k
<
E
)
{
for
(
ind
=
0
;
(
ind
<
Ncb
)
&&
(
k
<
E
);
ind
++
)
{
if
(
soft_input
[
ind
]
!=
NR_NULL
)
{
...
...
@@ -200,6 +201,7 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
#endif
}
}
}
return
0
;
}
openair1/PHY/CODING/nr_segmentation.c
View file @
39fa3e00
...
...
@@ -156,7 +156,7 @@ else
if
(
*
F
>
0
)
{
for
(
k
=
Kprime
>>
3
;
k
<
(
*
K
)
>>
3
;
k
++
)
{
output_buffers
[
r
][
k
]
=
NR_NULL
;
output_buffers
[
r
][
k
]
=
0
;
//printf("r %d filler bits [%d] = %d Kprime %d \n", r,k, output_buffers[r][k], Kprime);
}
}
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
39fa3e00
...
...
@@ -277,17 +277,18 @@ int nr_dlsch_encoding(unsigned char *a,
nfapi_nr_dl_config_dlsch_pdu_rel15_t
rel15
=
dlsch
->
harq_processes
[
harq_pid
]
->
dlsch_pdu
.
dlsch_pdu_rel15
;
uint16_t
nb_rb
=
rel15
.
n_prb
;
uint8_t
nb_symb_sch
=
rel15
.
nb_symbols
;
uint32_t
A
,
Z
;
uint32_t
A
,
Z
,
F
=
0
;
uint32_t
*
pz
=
&
Z
;
uint8_t
mod_order
=
rel15
.
modulation_order
;
uint16_t
Kr
=
0
,
r
,
r_offset
=
0
,
Kr_bytes
;
uint8_t
*
d_tmp
[
MAX_NUM_DLSCH_SEGMENTS
];
uint8_t
kb
,
BG
=
1
;
uint8_t
BG
=
1
;
uint32_t
E
;
uint8_t
Ilbrm
=
0
;
uint32_t
Tbslbrm
=
950984
;
//max tbs
uint8_t
nb_re_dmrs
=
rel15
.
nb_re_dmrs
;
uint16_t
length_dmrs
=
1
;
float
Coderate
=
0
.
0
;
/*
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
...
...
@@ -337,18 +338,20 @@ int nr_dlsch_encoding(unsigned char *a,
pz
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
F
);
kb
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
/
(
*
pz
);
if
(
kb
==
22
){
BG
=
1
;
F
=
dlsch
->
harq_processes
[
harq_pid
]
->
F
;
Coderate
=
(
float
)
A
/
(
float
)
G
;
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
){
BG
=
2
;
}
else
{
BG
=
2
;
BG
=
1
;
}
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
;
Kr_bytes
=
Kr
>>
3
;
//printf("segment Z %d k
b %d k %d Kr %d BG %d\n", *pz,kb
,dlsch->harq_processes[harq_pid]->K,Kr,BG);
//printf("segment Z %d k
%d Kr %d BG %d\n", *pz
,dlsch->harq_processes[harq_pid]->K,Kr,BG);
//start_meas(te_stats);
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
...
...
@@ -393,6 +396,14 @@ int nr_dlsch_encoding(unsigned char *a,
}
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
if
(
dlsch
->
harq_processes
[
harq_pid
]
->
F
>
0
)
{
for
(
int
k
=
(
Kr
-
F
-
2
*
(
*
pz
));
k
<
Kr
-
2
*
(
*
pz
);
k
++
)
{
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
][
k
]
=
NR_NULL
;
//if (k<(Kr-F+8))
//printf("r %d filler bits [%d] = %d \n", r,k, dlsch->harq_processes[harq_pid]->d[r][k]);
}
}
#ifdef DEBUG_DLSCH_CODING
printf
(
"Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...
\n
"
,
r
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
View file @
39fa3e00
...
...
@@ -218,8 +218,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint32_t
A
,
E
;
uint32_t
G
;
uint32_t
ret
,
offset
;
int32_t
no_iteration_ldpc
;
//short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(8448+64)];
int32_t
no_iteration_ldpc
,
length_dec
;
uint32_t
r
,
r_offset
=
0
,
Kr
=
8424
,
Kr_bytes
,
K_bytes_F
,
err_flag
=
0
;
uint8_t
crc_type
;
int8_t
llrProcBuf
[
OAI_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
...
...
@@ -233,17 +232,15 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
int8_t
l
[
68
*
384
];
//__m128i l;
int16_t
inv_d
[
68
*
384
];
// int16_t *p_invd =&inv_d;
uint8_t
kb
,
kc
;
uint8_t
kc
;
uint8_t
Ilbrm
=
0
;
uint32_t
Tbslbrm
=
950984
;
uint16_t
nb_rb
=
30
;
//to update
//uint16_t nb_symb_sch = 12;
uint8_t
nb_re_dmrs
=
6
;
uint16_t
length_dmrs
=
1
;
double
Coderate
=
0
.
0
;
uint32_t
i
,
j
;
// uint32_t k;
__m128i
*
pv
=
(
__m128i
*
)
&
z
;
__m128i
*
pl
=
(
__m128i
*
)
&
l
;
...
...
@@ -322,21 +319,41 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
printf
(
"K %d C %d Z %d nl %d
\n
"
,
harq_process
->
K
,
harq_process
->
C
,
p_decParams
->
Z
,
harq_process
->
Nl
);
#endif
}
kb
=
harq_process
->
K
/
harq_process
->
Z
;
if
(
kb
==
22
){
p_decParams
->
BG
=
1
;
p_decParams
->
R
=
13
;
kc
=
68
;
Coderate
=
(
float
)
A
/
(
float
)
G
;
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
){
p_decParams
->
BG
=
2
;
if
(
Coderate
<
0
.
3333
){
p_decParams
->
R
=
15
;
kc
=
52
;
}
else
if
(
Coderate
<
0
.
6667
){
p_decParams
->
R
=
13
;
kc
=
32
;
}
else
{
p_decParams
->
R
=
23
;
kc
=
17
;
}
}
else
{
p_decParams
->
BG
=
2
;
p_decParams
->
R
=
13
;
kc
=
52
;
}
p_decParams
->
BG
=
1
;
if
(
Coderate
<
0
.
6667
){
p_decParams
->
R
=
13
;
kc
=
68
;
}
else
if
(
Coderate
<
0
.
8889
){
p_decParams
->
R
=
23
;
kc
=
35
;
}
else
{
p_decParams
->
R
=
89
;
kc
=
27
;
}
}
//printf("coderate %f kc %d \n", Coderate, kc);
p_decParams
->
numMaxIter
=
dlsch
->
max_ldpc_iterations
;
Kr
=
p_decParams
->
Z
*
kb
;
p_decParams
->
outMode
=
0
;
...
...
@@ -453,54 +470,38 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
memset
(
harq_process
->
c
[
r
],
0
,
Kr_bytes
);
// printf("done\n");
if
(
harq_process
->
C
==
1
)
if
(
harq_process
->
C
==
1
)
{
crc_type
=
CRC24_A
;
else
length_dec
=
harq_process
->
B
;
}
else
{
crc_type
=
CRC24_B
;
length_dec
=
(
harq_process
->
B
+
24
*
harq_process
->
C
)
/
harq_process
->
C
;
}
if
(
err_flag
==
0
)
{
/*
LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n",
Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS,
harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_ldpc_iterations);
*/
#if UE_TIMING_TRACE
start_meas
(
dlsch_turbo_decoding_stats
);
#endif
//LOG_E(PHY,"AbsSubframe %d.%d Start
turbo
segment %d/%d A %d ",frame%1024,nr_tti_rx,r,harq_process->C-1, A);
//LOG_E(PHY,"AbsSubframe %d.%d Start
LDPC
segment %d/%d A %d ",frame%1024,nr_tti_rx,r,harq_process->C-1, A);
//printf("harq process dr iteration %d\n", p_decParams->numMaxIter);
for
(
int
cnt
=
0
;
cnt
<
(
kc
-
2
)
*
p_decParams
->
Z
;
cnt
++
){
inv_d
[
cnt
]
=
(
1
)
*
harq_process
->
d
[
r
][
cnt
];
}
/*for (int cnt =0; cnt < 16; cnt++){
printf("dr %d inv_d %d \n", harq_process->d[r][cnt], inv_d[cnt]);
}
printf(" \n");
printf("end dr \n");
for (int cnt =(50*p_decParams->Z-16) ; cnt < 50*p_decParams->Z; cnt++){
printf("%d ", harq_process->d[r][cnt]);
}
printf(" \n");*/
memset
(
pv
,
0
,
2
*
harq_process
->
Z
*
sizeof
(
int16_t
));
memset
(
pv
,
0
,
2
*
harq_process
->
Z
*
sizeof
(
int16_t
));
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t));
memset
((
pv
+
K_bytes_F
),
127
,
harq_process
->
F
*
sizeof
(
int16_t
));
for
(
i
=
((
2
*
p_decParams
->
Z
)
>>
3
),
j
=
0
;
i
<
K_bytes_F
+
((
2
*
p_decParams
->
Z
)
>>
3
)
;
i
++
,
j
++
)
for
(
i
=
((
2
*
p_decParams
->
Z
)
>>
3
),
j
=
0
;
i
<
K_bytes_F
;
i
++
,
j
++
)
{
pv
[
i
]
=
_mm_loadu_si128
((
__m128i
*
)(
&
inv_d
[
8
*
j
]));
pv
[
i
]
=
_mm_loadu_si128
((
__m128i
*
)(
&
harq_process
->
d
[
r
]
[
8
*
j
]));
}
for
(
i
=
Kr_bytes
+
((
2
*
p_decParams
->
Z
)
>>
3
),
j
=
Kr_bytes
;
i
<
((
kc
*
p_decParams
->
Z
)
>>
3
);
i
++
,
j
++
)
for
(
i
=
Kr_bytes
,
j
=
K_bytes_F
-
((
2
*
p_decParams
->
Z
)
>>
3
)
;
i
<
((
kc
*
p_decParams
->
Z
)
>>
3
);
i
++
,
j
++
)
{
pv
[
i
]
=
_mm_loadu_si128
((
__m128i
*
)(
&
inv_d
[
8
*
j
]));
pv
[
i
]
=
_mm_loadu_si128
((
__m128i
*
)(
&
harq_process
->
d
[
r
]
[
8
*
j
]));
}
for
(
i
=
0
,
j
=
0
;
j
<
((
kc
*
p_decParams
->
Z
)
>>
4
);
i
+=
2
,
j
++
)
...
...
@@ -517,8 +518,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
p_procTime
);
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
harq_process
->
B
,
harq_process
->
F
,
crc_type
))
{
printf
(
"
CRC OK
\n
"
);
if
(
check_crc
((
uint8_t
*
)
llrProcBuf
,
length_dec
,
harq_process
->
F
,
crc_type
))
{
printf
(
"
Segment %d CRC OK
\n
"
,
r
);
ret
=
2
;
}
else
{
...
...
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