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
b3377497
Commit
b3377497
authored
Oct 25, 2019
by
Sakthivel Velumani
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nr-tbs-fixes' into pdsch-ch-est
parents
45d09bb5
0ceb9545
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
297 additions
and
305 deletions
+297
-305
cmake_targets/autotests/test_case_list.xml
cmake_targets/autotests/test_case_list.xml
+6
-6
nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
+1
-0
openair1/PHY/CODING/TESTBENCH/ldpctest.c
openair1/PHY/CODING/TESTBENCH/ldpctest.c
+8
-8
openair1/PHY/CODING/coding_defs.h
openair1/PHY/CODING/coding_defs.h
+8
-3
openair1/PHY/CODING/nrLDPC_encoder/defs.h
openair1/PHY/CODING/nrLDPC_encoder/defs.h
+4
-4
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
+6
-79
openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
...ir1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
+2
-33
openair1/PHY/CODING/nr_compute_tbs.c
openair1/PHY/CODING/nr_compute_tbs.c
+83
-23
openair1/PHY/CODING/nr_segmentation.c
openair1/PHY/CODING/nr_segmentation.c
+1
-1
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+1
-0
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+26
-33
openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
+1
-1
openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h
openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h
+1
-1
openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c
openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c
+50
-53
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
+3
-3
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+3
-3
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+45
-18
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+3
-3
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+2
-0
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+14
-16
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+10
-4
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+1
-0
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+2
-1
openair1/SIMULATION/NR_PHY/dlschsim.c
openair1/SIMULATION/NR_PHY/dlschsim.c
+7
-3
openair1/SIMULATION/NR_PHY/ulschsim.c
openair1/SIMULATION/NR_PHY/ulschsim.c
+3
-3
openair1/SIMULATION/NR_PHY/ulsim.c
openair1/SIMULATION/NR_PHY/ulsim.c
+3
-3
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+3
-3
No files found.
cmake_targets/autotests/test_case_list.xml
View file @
b3377497
...
...
@@ -1084,11 +1084,11 @@
(Test3: 273 PRB),
(Test4: 106 PRB 12 CSET-Offset),
(Test5: 217 PRB 48 CSET-Offset),
(Test6: 106 PRB 25 PDSCH-Offset),
<!--
(Test6: 106 PRB 25 PDSCH-Offset),
(Test7: 106 PRB 51 PDSCH-Offset),
(Test8: 217 PRB 100 PDSCH-PRBs),
(Test9: 217 PRB 80 PDSCH-Offset),
(Test10: 217 PRB 100 PDSCH-PRBs 80 PDSCH-Offset),
(Test10: 217 PRB 100 PDSCH-PRBs 80 PDSCH-Offset),
-->
(Test11: 106 PRB 4 PDSCH-Start-Symbols),
(Test12: 217 PRB 5 PDSCH-Symbols),
(Test13: 106 PRB 0 MCS),
...
...
@@ -1104,18 +1104,18 @@
-n100 -R273
-n100 -R106 -o12
-n100 -R217 -o48
-n100 -R106 -a25
<!--
-n100 -R106 -a25
-n100 -R106 -a51
-n100 -R217 -b100
-n100 -R217 -a80
-n100 -R217 -a80 -b100
-n100 -R217 -a80 -b100
-->
-n100 -R106 -c4
-n100 -R217 -j5
-n100 -R106 -e0
-n100 -R273 -e28
</main_exec_args>
<tags>
nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5
nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10
nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14
</tags>
<tags>
nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5
<!--nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10-->
nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14
</tags>
<search_expr_true>
"PDCCH test OK" "PDSCH test OK"
</search_expr_true>
<search_expr_false>
segmentation fault|assertion|exiting|fatal
|CRC NOK
</search_expr_false>
<search_expr_false>
segmentation fault|assertion|exiting|fatal
</search_expr_false>
<nruns>
3
</nruns>
</testCase>
...
...
nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
View file @
b3377497
...
...
@@ -586,6 +586,7 @@ typedef struct {
uint8_t
start_symbol
;
uint8_t
nb_symbols
;
uint8_t
mcs_idx
;
uint8_t
mcs_table
;
uint8_t
ndi
;
uint8_t
nb_codewords
;
uint8_t
nb_layers
;
...
...
openair1/PHY/CODING/TESTBENCH/ldpctest.c
View file @
b3377497
...
...
@@ -130,9 +130,9 @@ int test_ldpc(short No_iteration,
double
*
modulated_input
[
MAX_NUM_DLSCH_SEGMENTS
];
char
*
channel_output_fixed
[
MAX_NUM_DLSCH_SEGMENTS
];
unsigned
int
i
,
j
,
trial
=
0
;
short
BG
=
0
,
Zc
,
Kb
=
0
,
nrows
=
0
;
//,ncols;
short
BG
=
0
,
nrows
=
0
;
//,ncols;
int
no_punctured_columns
,
removed_bit
;
int
i1
;
int
i1
,
Zc
,
Kb
=
0
;
int
R_ind
=
0
;
//Table of possible lifting sizes
//short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
...
...
@@ -287,7 +287,7 @@ int test_ldpc(short No_iteration,
// printf("puncture:%d\n",no_punctured_columns);
removed_bit
=
(
nrows
-
no_punctured_columns
-
2
)
*
Zc
+
block_length
-
(
int
)(
block_length
/
((
float
)
nom_rate
/
(
float
)
denom_rate
));
if
(
ntrials
==
0
)
ldpc_encoder_orig
(
test_input
[
0
],
channel_input
[
0
],
block_length
,
BG
,
1
);
ldpc_encoder_orig
(
test_input
[
0
],
channel_input
[
0
],
Zc
,
BG
,
block_length
,
BG
,
1
);
for
(
trial
=
0
;
trial
<
ntrials
;
trial
++
)
{
...
...
@@ -295,20 +295,20 @@ int test_ldpc(short No_iteration,
//// encoder
start_meas
(
&
time
);
for
(
j
=
0
;
j
<
n_segments
;
j
++
)
{
ldpc_encoder_orig
(
test_input
[
j
],
channel_input
[
j
],
block_length
,
BG
,
0
);
ldpc_encoder_orig
(
test_input
[
j
],
channel_input
[
j
],
Zc
,
Kb
,
block_length
,
BG
,
0
);
}
stop_meas
(
&
time
);
/* start_meas(time_optim);
ldpc_encoder_optim_8seg(test_input,channel_input_optim,block_length,BG,n_segments,&tinput,&tprep,&tparity,&toutput);
ldpc_encoder_optim_8seg(test_input,channel_input_optim,
Zc,Kb,
block_length,BG,n_segments,&tinput,&tprep,&tparity,&toutput);
for(j=0;j<n_segments;j++) {
ldpc_encoder_optim(test_input[j],channel_input_optim[j],block_length,BG,&tinput,&tprep,&tparity,&toutput);
ldpc_encoder_optim(test_input[j],channel_input_optim[j],
Zc,Kb,
block_length,BG,&tinput,&tprep,&tparity,&toutput);
}
stop_meas(time_optim);*/
for
(
j
=
0
;
j
<
(
n_segments
%
8
+
1
);
j
++
)
{
for
(
j
=
0
;
j
<
(
n_segments
/
8
+
1
);
j
++
)
{
start_meas
(
time_optim
);
ldpc_encoder_optim_8seg_multi
(
test_input
,
channel_input_optim
,
block_length
,
BG
,
n_segments
,
j
,
&
tinput
,
&
tprep
,
&
tparity
,
&
toutput
);
ldpc_encoder_optim_8seg_multi
(
test_input
,
channel_input_optim
,
Zc
,
Kb
,
block_length
,
BG
,
n_segments
,
j
,
&
tinput
,
&
tprep
,
&
tparity
,
&
toutput
);
stop_meas
(
time_optim
);
}
...
...
openair1/PHY/CODING/coding_defs.h
View file @
b3377497
...
...
@@ -458,13 +458,18 @@ int32_t nr_segmentation(unsigned char *input_buffer,
uint8_t
BG
);
uint32_t
nr_compute_tbs
(
uint16_t
Qm
,
uint16_t
R
,
uint16_t
R
,
uint16_t
nb_rb
,
uint16_t
nb_symb_sch
,
uint
8_t
nb_re_dmrs
,
uint16_t
length_dmrs
,
uint
16_t
nb_dmrs_prb
,
uint16_t
nb_rb_oh
,
uint8_t
Nl
);
uint32_t
nr_compute_tbslbrm
(
uint16_t
table
,
uint16_t
nb_rb
,
uint8_t
Nl
,
uint8_t
C
);
void
nr_interleaving_ldpc
(
uint32_t
E
,
uint8_t
Qm
,
uint8_t
*
e
,
uint8_t
*
f
);
void
nr_deinterleaving_ldpc
(
uint32_t
E
,
uint8_t
Qm
,
int16_t
*
e
,
int16_t
*
f
);
...
...
openair1/PHY/CODING/nrLDPC_encoder/defs.h
View file @
b3377497
...
...
@@ -36,12 +36,12 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
/*ldpc_encoder2.c*/
void
encode_parity_check_part_optim
(
uint8_t
*
c
,
uint8_t
*
d
,
short
BG
,
short
Zc
,
short
Kb
);
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
int
ldpc_encoder_optim_8seg_multi
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
unsigned
int
macro_num
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
int
ldpc_encoder_optim_8seg_multi
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
int
n_segments
,
unsigned
int
macro_num
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
/*ldpc_generate_coefficient.c*/
int
ldpc_encoder_orig
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
unsigned
char
gen_code
);
int
ldpc_encoder_orig
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
unsigned
char
gen_code
);
/*
int encode_parity_check_part(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb);
...
...
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
View file @
b3377497
...
...
@@ -198,16 +198,13 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
}
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
short
Zc
,
Kb
=
0
,
nrows
=
0
,
ncols
=
0
;
short
nrows
=
0
,
ncols
=
0
;
int
i
,
i1
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
short
lift_size
[
51
]
=
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
30
,
32
,
36
,
40
,
44
,
48
,
52
,
56
,
60
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
144
,
160
,
176
,
192
,
208
,
224
,
240
,
256
,
288
,
320
,
352
,
384
};
int
simd_size
;
//determine number of bits in codeword
...
...
@@ -215,7 +212,6 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
if
(
BG
==
1
)
{
//BG=1;
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
...
...
@@ -226,28 +222,8 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
if
(
block_length
>
640
)
Kb
=
10
;
else
if
(
block_length
>
560
)
Kb
=
9
;
else
if
(
block_length
>
192
)
Kb
=
8
;
else
Kb
=
6
;
}
//find minimum value in all sets of lifting size
Zc
=
0
;
for
(
i1
=
0
;
i1
<
51
;
i1
++
)
{
if
(
lift_size
[
i1
]
>=
(
double
)
block_length
/
Kb
)
{
Zc
=
lift_size
[
i1
];
//printf("%d\n",Zc);
break
;
}
}
AssertFatal
(
Zc
>
0
,
"no valid Zc found for block length %d
\n
"
,
block_length
);
#ifdef DEBUG_LDPC
LOG_D
(
PHY
,
"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d
\n
"
,
BG
,
Zc
,
Kb
,
block_length
);
...
...
@@ -317,14 +293,12 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
return
0
;
}
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
short
Zc
,
Kb
=
0
,
nrows
=
0
,
ncols
=
0
;
short
nrows
=
0
,
ncols
=
0
;
int
i
,
i1
,
j
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
short
lift_size
[
51
]
=
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
30
,
32
,
36
,
40
,
44
,
48
,
52
,
56
,
60
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
144
,
160
,
176
,
192
,
208
,
224
,
240
,
256
,
288
,
320
,
352
,
384
};
char
temp
;
int
simd_size
;
...
...
@@ -350,8 +324,6 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
//if (block_length>3840)
if
(
BG
==
1
)
{
//BG=1;
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
...
...
@@ -362,28 +334,8 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
if
(
block_length
>
640
)
Kb
=
10
;
else
if
(
block_length
>
560
)
Kb
=
9
;
else
if
(
block_length
>
192
)
Kb
=
8
;
else
Kb
=
6
;
}
//find minimum value in all sets of lifting size
Zc
=
0
;
for
(
i1
=
0
;
i1
<
51
;
i1
++
)
{
if
(
lift_size
[
i1
]
>=
(
double
)
block_length
/
Kb
)
{
Zc
=
lift_size
[
i1
];
//printf("%d\n",Zc);
break
;
}
}
#ifdef DEBUG_LDPC
LOG_D
(
PHY
,
"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d
\n
"
,
BG
,
Zc
,
Kb
,
block_length
,
n_segments
);
LOG_D
(
PHY
,
"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x
\n
"
,
test_input
[
0
][
0
],
test_input
[
0
][
1
],
test_input
[
0
][
2
],
test_input
[
0
][
3
]);
...
...
@@ -517,14 +469,13 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
return
0
;
}
int
ldpc_encoder_optim_8seg_multi
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
unsigned
int
macro_num
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
int
ldpc_encoder_optim_8seg_multi
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
int
n_segments
,
unsigned
int
macro_num
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
short
Zc
,
Kb
=
0
,
nrows
=
0
,
ncols
=
0
;
short
nrows
=
0
,
ncols
=
0
;
int
i
,
i1
,
j
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
short
lift_size
[
51
]
=
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
30
,
32
,
36
,
40
,
44
,
48
,
52
,
56
,
60
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
144
,
160
,
176
,
192
,
208
,
224
,
240
,
256
,
288
,
320
,
352
,
384
};
char
temp
;
int
simd_size
;
int
macro_segment
,
macro_segment_end
;
...
...
@@ -556,38 +507,14 @@ int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **cha
//determine number of bits in codeword
if
(
BG
==
1
)
{
BG
=
1
;
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
{
BG
=
2
;
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
if
(
block_length
>
640
)
Kb
=
10
;
else
if
(
block_length
>
560
)
Kb
=
9
;
else
if
(
block_length
>
192
)
Kb
=
8
;
else
Kb
=
6
;
}
//find minimum value in all sets of lifting size
Zc
=
0
;
for
(
i1
=
0
;
i1
<
51
;
i1
++
)
{
if
(
lift_size
[
i1
]
>=
(
double
)
block_length
/
Kb
)
{
Zc
=
lift_size
[
i1
];
//printf("%d\n",Zc);
break
;
}
}
#ifdef DEBUG_LDPC
LOG_D
(
PHY
,
"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d
\n
"
,
BG
,
Zc
,
Kb
,
block_length
,
n_segments
);
...
...
openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
View file @
b3377497
...
...
@@ -361,24 +361,19 @@ short *choose_generator_matrix(short BG,short Zc)
return
Gen_shift_values
;
}
int
ldpc_encoder_orig
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
unsigned
char
gen_code
)
int
ldpc_encoder_orig
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
int
Zc
,
int
Kb
,
short
block_length
,
short
BG
,
unsigned
char
gen_code
)
{
unsigned
char
c
[
22
*
384
];
//padded input, unpacked, max size
unsigned
char
d
[
68
*
384
];
//coded output, unpacked, max size
unsigned
char
channel_temp
,
temp
;
short
*
Gen_shift_values
,
*
no_shift_values
,
*
pointer_shift_values
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
,
i2
,
i3
,
i4
,
i5
,
temp_prime
,
var
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
short
lift_size
[
51
]
=
{
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
30
,
32
,
36
,
40
,
44
,
48
,
52
,
56
,
60
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
144
,
160
,
176
,
192
,
208
,
224
,
240
,
256
,
288
,
320
,
352
,
384
};
int
nind
=
0
;
int
indlist
[
1000
];
int
indlist2
[
1000
];
...
...
@@ -387,8 +382,6 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
//if (block_length>3840)
if
(
BG
==
1
)
{
//BG=1;
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
...
...
@@ -399,32 +392,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
if
(
block_length
>
640
)
Kb
=
10
;
else
if
(
block_length
>
560
)
Kb
=
9
;
else
if
(
block_length
>
192
)
Kb
=
8
;
else
Kb
=
6
;
}
//find minimum value in all sets of lifting size
Zc
=
0
;
for
(
i1
=
0
;
i1
<
51
;
i1
++
)
{
if
(
lift_size
[
i1
]
>=
(
double
)
block_length
/
Kb
)
{
Zc
=
lift_size
[
i1
];
//printf("%d\n",Zc);
break
;
}
}
if
(
Zc
==
0
)
{
printf
(
"ldpc_encoder_orig: could not determine lifting size
\n
"
);
return
(
-
1
);
}
Gen_shift_values
=
choose_generator_matrix
(
BG
,
Zc
);
if
(
Gen_shift_values
==
NULL
)
{
printf
(
"ldpc_encoder_orig: could not find generator matrix
\n
"
);
...
...
openair1/PHY/CODING/nr_compute_tbs.c
View file @
b3377497
...
...
@@ -24,69 +24,129 @@
author: Hongzhi WANG (TCL)
*/
#include "PHY/defs_nr_UE.h"
//#include "SCHED/extern.h"
#define INDEX_MAX_TBS_TABLE (93)
//Table 5.1.2.2-2
uint16_t
Tbstable_nr
[
INDEX_MAX_TBS_TABLE
]
=
{
24
,
32
,
40
,
48
,
56
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
136
,
144
,
152
,
160
,
168
,
176
,
184
,
192
,
208
,
224
,
240
,
256
,
272
,
288
,
304
,
320
,
336
,
352
,
368
,
384
,
408
,
432
,
456
,
480
,
504
,
528
,
552
,
576
,
608
,
640
,
672
,
704
,
736
,
768
,
808
,
848
,
888
,
928
,
984
,
1032
,
1064
,
1128
,
1160
,
1192
,
1224
,
1256
,
1288
,
1320
,
1352
,
1416
,
1480
,
1544
,
1608
,
1672
,
1736
,
1800
,
1864
,
1928
,
2024
,
2088
,
2152
,
2216
,
2280
,
2408
,
2472
,
2536
,
2600
,
2664
,
2728
,
2792
,
2856
,
2976
,
3104
,
3240
,
3368
,
3496
,
3624
,
3752
,
3824
};
uint16_t
NPRB_LBRM
[
7
]
=
{
32
,
66
,
107
,
135
,
162
,
217
,
273
};
uint32_t
nr_compute_tbs
(
uint16_t
Qm
,
uint16_t
R
,
uint16_t
nb_rb
,
uint16_t
nb_symb_sch
,
uint
8_t
nb_re_dmrs
,
uint16_t
length_dmrs
,
uint
16_t
nb_dmrs_prb
,
uint16_t
nb_rb_oh
,
uint8_t
Nl
)
{
uint16_t
nbp_re
,
nb_re
,
nb_dmrs_prb
,
nb_rb_oh
;
uint16_t
nbp_re
,
nb_re
;
uint32_t
nr_tbs
=
0
;
double
Ninfo
,
Np_info
,
n
,
C
;
uint32_t
Ninfo
,
Np_info
,
C
;
uint8_t
n
,
scale
;
nb_rb_oh
=
0
;
//set to 0 if not configured by higher layer
nb_dmrs_prb
=
nb_re_dmrs
*
length_dmrs
;
nbp_re
=
12
*
nb_symb_sch
-
nb_dmrs_prb
-
nb_rb_oh
;
nbp_re
=
NR_NB_SC_PER_RB
*
nb_symb_sch
-
nb_dmrs_prb
-
nb_rb_oh
;
nb_re
=
min
(
156
,
nbp_re
)
*
nb_rb
;
scale
=
(
R
>
1024
)
?
11
:
10
;
// Intermediate number of information bits
Ninfo
=
(
double
)((
nb_re
*
R
*
Qm
*
Nl
)
/
1024
)
;
Ninfo
=
(
nb_re
*
R
*
Qm
*
Nl
)
>>
scale
;
//printf("Ninfo %lf nbp_re %d nb_re %d mcs %d Qm %d, R %d\n", Ninfo, nbp_re, nb_re,mcs, Qm, R);
if
(
Ninfo
<=
3824
)
{
n
=
max
(
3
,
floor
(
log2
(
Ninfo
))
-
6
);
Np_info
=
max
(
24
,
pow
(
2
,
n
)
*
floor
(
Ninfo
/
pow
(
2
,
n
)));
Np_info
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
for
(
int
i
=
0
;
i
<
INDEX_MAX_TBS_TABLE
;
i
++
)
{
if
(
(
double
)
Tbstable_nr
[
i
]
>=
Np_info
){
if
(
Tbstable_nr
[
i
]
>=
Np_info
){
nr_tbs
=
Tbstable_nr
[
i
];
break
;
}
}
}
else
{
n
=
floor
(
log2
(
Ninfo
-
24
))
-
5
;
Np_info
=
max
(
3840
,
pow
(
2
,
n
)
*
round
((
Ninfo
-
24
)
/
pow
(
2
,
n
))
);
n
=
log2
(
Ninfo
-
24
)
-
5
;
Np_info
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),(
1
<<
n
)))
<<
n
);
if
(
R
<=
256
)
{
//1/4
C
=
ceil
(
(
Np_info
+
24
)
/
3816
);
nr_tbs
=
(
uint32_t
)(
8
*
C
*
ceil
(
(
Np_info
+
24
)
/
(
8
*
C
)
)
-
24
)
;
if
(
R
<=
256
)
{
C
=
CEILIDIV
((
Np_info
+
24
),
3816
);
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
}
else
{
if
(
Np_info
>
8424
){
C
=
ceil
(
(
Np_info
+
24
)
/
8424
);
nr_tbs
=
(
uint32_t
)(
8
*
C
*
ceil
(
(
Np_info
+
24
)
/
(
8
*
C
)
)
-
24
)
;
C
=
CEILIDIV
((
Np_info
+
24
),
8424
);
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
}
else
{
nr_tbs
=
(
uint32_t
)(
8
*
ceil
(
(
Np_info
+
24
)
/
8
)
-
24
);
//printf("n %lf Np_info %f pow %f ceil %f \n",n, Np_info,pow(2,6),ceil( (Np_info + 24)/8 ));
nr_tbs
=
((
CEILIDIV
((
Np_info
+
24
),
8
))
<<
3
)
-
24
;
}
}
}
return
nr_tbs
;
}
//tbslbrm calculation according to 5.4.2.1 of 38.212
uint32_t
nr_compute_tbslbrm
(
uint16_t
table
,
uint16_t
nb_rb
,
uint8_t
Nl
,
uint8_t
C
)
{
uint16_t
R
,
nb_re
;
uint16_t
nb_rb_lbrm
=
0
;
uint8_t
Qm
;
int
i
;
uint32_t
nr_tbs
=
0
;
uint32_t
Ninfo
,
Np_info
;
uint8_t
n
;
for
(
i
=
0
;
i
<
7
;
i
++
)
{
if
(
NPRB_LBRM
[
i
]
>=
nb_rb
){
nb_rb_lbrm
=
NPRB_LBRM
[
i
];
break
;
}
}
Qm
=
((
table
==
1
)
?
8
:
6
);
R
=
948
;
nb_re
=
156
*
nb_rb_lbrm
;
// Intermediate number of information bits
Ninfo
=
(
nb_re
*
R
*
Qm
*
Nl
)
>>
10
;
if
(
Ninfo
<=
3824
)
{
n
=
max
(
3
,
floor
(
log2
(
Ninfo
))
-
6
);
Np_info
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
for
(
int
i
=
0
;
i
<
INDEX_MAX_TBS_TABLE
;
i
++
)
{
if
(
Tbstable_nr
[
i
]
>=
Np_info
){
nr_tbs
=
Tbstable_nr
[
i
];
break
;
}
}
}
else
{
n
=
log2
(
Ninfo
-
24
)
-
5
;
Np_info
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),(
1
<<
n
)))
<<
n
);
if
(
R
<=
256
)
{
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
}
else
{
if
(
Np_info
>
8424
){
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
}
else
{
nr_tbs
=
((
CEILIDIV
((
Np_info
+
24
),
8
))
<<
3
)
-
24
;
}
}
}
return
nr_tbs
;
return
nr_tbs
;
}
openair1/PHY/CODING/nr_segmentation.c
View file @
b3377497
...
...
@@ -185,7 +185,7 @@ else
}
}
return
0
;
return
Kb
;
}
...
...
openair1/PHY/INIT/nr_init.c
View file @
b3377497
...
...
@@ -521,6 +521,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
rel15_ul
->
ulsch_pdu_rel15
.
nb_re_dmrs
=
6
;
rel15_ul
->
ulsch_pdu_rel15
.
length_dmrs
=
1
;
rel15_ul
->
ulsch_pdu_rel15
.
Qm
=
2
;
rel15_ul
->
ulsch_pdu_rel15
.
R
=
679
;
rel15_ul
->
ulsch_pdu_rel15
.
mcs
=
9
;
rel15_ul
->
ulsch_pdu_rel15
.
rv
=
0
;
rel15_ul
->
ulsch_pdu_rel15
.
n_layers
=
1
;
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
b3377497
...
...
@@ -283,8 +283,8 @@ 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
,
F
=
0
;
uint32_t
*
pz
=
&
Z
;
uint32_t
A
,
Z
,
Kb
,
F
=
0
;
uint32_t
*
Zc
=
&
Z
;
uint8_t
mod_order
=
rel15
.
modulation_order
;
uint16_t
Kr
=
0
,
r
,
r_offset
=
0
;
//uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
...
...
@@ -294,9 +294,9 @@ int nr_dlsch_encoding(unsigned char *a,
uint32_t
Tbslbrm
=
950984
;
//max tbs
uint8_t
nb_re_dmrs
=
rel15
.
nb_re_dmrs
;
uint16_t
R
=
rel15
.
coding_rate
;
uint16_t
Qm
=
rel15
.
modulation_order
;
uint16_t
length_dmrs
=
1
;
float
Coderate
=
0
.
0
;
uint8_t
Nl
=
4
;
/*
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
...
...
@@ -313,8 +313,6 @@ int nr_dlsch_encoding(unsigned char *a,
LOG_D
(
PHY
,
"dlsch coding A %d G %d mod_order %d
\n
"
,
A
,
G
,
mod_order
);
Tbslbrm
=
nr_compute_tbs
(
Qm
,
R
,
nb_rb
,
frame_parms
->
symbols_per_slot
,
0
,
0
,
rel15
.
nb_layers
);
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
if
(
dlsch
->
harq_processes
[
harq_pid
]
->
round
==
0
)
{
// this is a new packet
#ifdef DEBUG_DLSCH_CODING
...
...
@@ -369,14 +367,14 @@ int nr_dlsch_encoding(unsigned char *a,
else
BG
=
1
;
nr_segmentation
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
K
,
pz
,
// [hna] pz is Zc
&
dlsch
->
harq_processes
[
harq_pid
]
->
F
,
BG
);
Kb
=
nr_segmentation
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
K
,
Zc
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
F
,
BG
);
F
=
dlsch
->
harq_processes
[
harq_pid
]
->
F
;
...
...
@@ -386,7 +384,7 @@ int nr_dlsch_encoding(unsigned char *a,
Kr_bytes
=
Kr
>>
3
;
#endif
//printf("segment Z %d k %d Kr %d BG %d\n", *
pz
,dlsch->harq_processes[harq_pid]->K,Kr,BG);
//printf("segment Z %d k %d Kr %d BG %d\n", *
Zc
,dlsch->harq_processes[harq_pid]->K,Kr,BG);
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
//d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
...
...
@@ -395,31 +393,20 @@ int nr_dlsch_encoding(unsigned char *a,
printf
(
"Encoder: B %d F %d
\n
"
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
dlsch
->
harq_processes
[
harq_pid
]
->
F
);
printf
(
"start ldpc encoder segment %d/%d
\n
"
,
r
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
);
printf
(
"input %d %d %d %d %d
\n
"
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
0
],
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
1
],
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
2
],
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
3
],
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
4
]);
for
(
int
cnt
=
0
;
cnt
<
22
*
(
*
pz
)
/
8
;
cnt
++
){
for
(
int
cnt
=
0
;
cnt
<
22
*
(
*
Zc
)
/
8
;
cnt
++
){
printf
(
"%d "
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
cnt
]);
}
printf
(
"
\n
"
);
#endif
//ldpc_encoder_orig((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],dlsch->harq_processes[harq_pid]->d[r],Kr,BG,0);
//ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][0],Kr,BG,NULL,NULL,NULL,NULL);
//ldpc_encoder_orig((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],dlsch->harq_processes[harq_pid]->d[r],
*Zc,Kb,
Kr,BG,0);
//ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][0],
*Zc,Kb,
Kr,BG,NULL,NULL,NULL,NULL);
}
//for (int i=0;i<68*384;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
/*printf("output %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->d[0][0], dlsch->harq_processes[harq_pid]->d[0][1], dlsch->harq_processes[harq_pid]->d[r][2],dlsch->harq_processes[harq_pid]->d[0][3], dlsch->harq_processes[harq_pid]->d[0][4]);
for (int cnt =0 ; cnt < 66*(*pz); cnt ++){
printf("%d \n", dlsch->harq_processes[harq_pid]->d[0][cnt]);
}
printf("\n");*/
//ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,BG,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
ldpc_encoder_optim_8seg
(
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
d
,
Kr
,
BG
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
NULL
,
NULL
,
NULL
,
NULL
);
for
(
int
j
=
0
;
j
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
8
+
1
);
j
++
)
{
ldpc_encoder_optim_8seg_multi
(
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
d
,
*
Zc
,
Kb
,
Kr
,
BG
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
j
,
NULL
,
NULL
,
NULL
,
NULL
);
}
//printf("end ldpc encoder -- output\n");
#ifdef DEBUG_DLSCH_CODING
write_output
(
"enc_input0.m"
,
"enc_in0"
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
0
][
0
],
Kr_bytes
,
1
,
4
);
...
...
@@ -431,7 +418,7 @@ 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
++
)
{
for
(
int
k
=
(
Kr
-
F
-
2
*
(
*
Zc
));
k
<
Kr
-
2
*
(
*
Zc
);
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]);
...
...
@@ -452,10 +439,16 @@ int nr_dlsch_encoding(unsigned char *a,
E
=
nr_get_E
(
G
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
mod_order
,
rel15
.
nb_layers
,
r
);
// for tbslbrm calculation according to 5.4.2.1 of 38.212
if
(
rel15
.
nb_layers
<
Nl
)
Nl
=
rel15
.
nb_layers
;
Tbslbrm
=
nr_compute_tbslbrm
(
rel15
.
mcs_table
,
nb_rb
,
Nl
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
);
nr_rate_matching_ldpc
(
Ilbrm
,
Tbslbrm
,
BG
,
*
pz
,
*
Zc
,
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
],
dlsch
->
harq_processes
[
harq_pid
]
->
e
+
r_offset
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
...
...
openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
View file @
b3377497
...
...
@@ -85,7 +85,7 @@ uint8_t get_delta(uint8_t ap, uint8_t config) {
return
((
config
==
NFAPI_NR_DMRS_TYPE1
)
?
(
pdsch_dmrs_1
[
ap
][
2
])
:
(
pdsch_dmrs_2
[
ap
][
2
]));
}
uint16_t
get_dmrs_freq_idx
(
uint
8
_t
n
,
uint8_t
k_prime
,
uint8_t
delta
,
uint8_t
dmrs_type
)
{
uint16_t
get_dmrs_freq_idx
(
uint
16
_t
n
,
uint8_t
k_prime
,
uint8_t
delta
,
uint8_t
dmrs_type
)
{
uint16_t
dmrs_idx
=
(
dmrs_type
)
?
(
6
*
n
+
k_prime
+
delta
)
:
((
n
<<
2
)
+
(
k_prime
<<
1
)
+
delta
);
return
dmrs_idx
;
}
...
...
openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h
View file @
b3377497
...
...
@@ -45,6 +45,6 @@ void get_Wf(int8_t *Wf, uint8_t ap, uint8_t config);
uint8_t
get_delta
(
uint8_t
ap
,
uint8_t
config
);
uint16_t
get_dmrs_freq_idx
(
uint
8
_t
n
,
uint8_t
k_prime
,
uint8_t
delta
,
uint8_t
dmrs_type
);
uint16_t
get_dmrs_freq_idx
(
uint
16
_t
n
,
uint8_t
k_prime
,
uint8_t
delta
,
uint8_t
dmrs_type
);
uint8_t
get_l0
(
uint8_t
mapping_type
,
uint8_t
dmrs_typeA_position
);
openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c
View file @
b3377497
...
...
@@ -31,6 +31,7 @@
*/
#include "nr_transport_common_proto.h"
#include "PHY/CODING/coding_defs.h"
//Table 5.1.3.1-1 of 38.214
uint16_t
Table_51311
[
29
][
2
]
=
{{
2
,
120
},{
2
,
157
},{
2
,
193
},{
2
,
251
},{
2
,
308
},{
2
,
379
},{
2
,
449
},{
2
,
526
},{
2
,
602
},{
2
,
679
},{
4
,
340
},{
4
,
378
},{
4
,
434
},{
4
,
490
},{
4
,
553
},{
4
,
616
},
...
...
@@ -53,22 +54,18 @@ uint16_t Table_61411[28][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{
uint16_t
Table_61412
[
28
][
2
]
=
{{
2
,
30
},{
2
,
40
},{
2
,
50
},{
2
,
64
},{
2
,
78
},{
2
,
99
},{
2
,
120
},{
2
,
157
},{
2
,
193
},{
2
,
251
},{
2
,
308
},{
2
,
379
},{
2
,
449
},{
2
,
526
},{
2
,
602
},{
2
,
679
},
{
4
,
378
},{
4
,
434
},{
4
,
490
},{
4
,
553
},{
4
,
616
},{
4
,
658
},{
4
,
699
},{
4
,
772
},{
6
,
567
},{
6
,
616
},{
6
,
666
},
{
6
,
772
}};
uint16_t
nr_tbs_table
[
93
]
=
{
24
,
32
,
40
,
48
,
56
,
64
,
72
,
80
,
88
,
96
,
104
,
112
,
120
,
128
,
136
,
144
,
152
,
160
,
168
,
176
,
184
,
192
,
208
,
224
,
240
,
256
,
272
,
288
,
304
,
320
,
\
336
,
352
,
368
,
384
,
408
,
432
,
456
,
480
,
504
,
528
,
552
,
576
,
608
,
640
,
672
,
704
,
736
,
768
,
808
,
848
,
888
,
928
,
984
,
1032
,
1064
,
1128
,
1160
,
1192
,
1224
,
1256
,
\
1288
,
1320
,
1352
,
1416
,
1480
,
1544
,
1608
,
1672
,
1736
,
1800
,
1864
,
1928
,
2024
,
2088
,
2152
,
2216
,
2280
,
2408
,
2472
,
2536
,
2600
,
2664
,
2728
,
2792
,
2856
,
2976
,
\
3104
,
3240
,
3368
,
3496
,
3624
,
3752
,
3824
};
uint8_t
nr_get_Qm_dl
(
uint8_t
Imcs
,
uint8_t
table_idx
)
{
switch
(
table_idx
)
{
case
1
:
case
0
:
return
(
Table_51311
[
Imcs
][
0
]);
break
;
case
2
:
case
1
:
return
(
Table_51312
[
Imcs
][
0
]);
break
;
case
3
:
case
2
:
return
(
Table_51313
[
Imcs
][
0
]);
break
;
...
...
@@ -79,15 +76,15 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
uint32_t
nr_get_code_rate_dl
(
uint8_t
Imcs
,
uint8_t
table_idx
)
{
switch
(
table_idx
)
{
case
1
:
case
0
:
return
(
Table_51311
[
Imcs
][
1
]);
break
;
case
2
:
case
1
:
return
(
Table_51312
[
Imcs
][
1
]);
break
;
case
3
:
case
2
:
return
(
Table_51313
[
Imcs
][
1
]);
break
;
...
...
@@ -98,11 +95,23 @@ uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
uint8_t
nr_get_Qm_ul
(
uint8_t
Imcs
,
uint8_t
table_idx
)
{
switch
(
table_idx
)
{
case
0
:
return
(
Table_51311
[
Imcs
][
0
]);
break
;
case
1
:
return
(
Table_
61411
[
Imcs
][
0
]);
return
(
Table_
51312
[
Imcs
][
0
]);
break
;
case
2
:
return
(
Table_51313
[
Imcs
][
0
]);
break
;
case
3
:
return
(
Table_61411
[
Imcs
][
0
]);
break
;
case
4
:
return
(
Table_61412
[
Imcs
][
0
]);
break
;
...
...
@@ -113,11 +122,23 @@ uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
uint32_t
nr_get_code_rate_ul
(
uint8_t
Imcs
,
uint8_t
table_idx
)
{
switch
(
table_idx
)
{
case
0
:
return
(
Table_51311
[
Imcs
][
1
]);
break
;
case
1
:
return
(
Table_
61411
[
Imcs
][
1
]);
return
(
Table_
51312
[
Imcs
][
1
]);
break
;
case
2
:
return
(
Table_51313
[
Imcs
][
1
]);
break
;
case
3
:
return
(
Table_61411
[
Imcs
][
1
]);
break
;
case
4
:
return
(
Table_61412
[
Imcs
][
1
]);
break
;
...
...
@@ -146,16 +167,16 @@ static inline uint8_t get_table_idx(uint8_t mcs_table, uint8_t dci_format, uint8
return
1
;
}
void
nr_get_tbs
(
nfapi_nr_dl_config_dlsch_pdu
*
dlsch_pdu
,
nfapi_nr_dl_config_dci_dl_pdu
dci_pdu
,
nfapi_nr_config_request_t
config
)
{
void
nr_get_tbs
_dl
(
nfapi_nr_dl_config_dlsch_pdu
*
dlsch_pdu
,
nfapi_nr_dl_config_dci_dl_pdu
dci_pdu
,
nfapi_nr_config_request_t
config
)
{
LOG_D
(
MAC
,
"TBS calculation
\n
"
);
nfapi_nr_dl_config_pdcch_parameters_rel15_t
params_rel15
=
dci_pdu
.
pdcch_params_rel15
;
nfapi_nr_dl_config_dlsch_pdu_rel15_t
*
dlsch_rel15
=
&
dlsch_pdu
->
dlsch_pdu_rel15
;
uint8_t
rnti_type
=
params_rel15
.
rnti_type
;
uint
8
_t
N_PRB_oh
=
((
rnti_type
==
NFAPI_NR_RNTI_SI
)
||
(
rnti_type
==
NFAPI_NR_RNTI_RA
)
||
(
rnti_type
==
NFAPI_NR_RNTI_P
))
?
0
:
\
uint
16
_t
N_PRB_oh
=
((
rnti_type
==
NFAPI_NR_RNTI_SI
)
||
(
rnti_type
==
NFAPI_NR_RNTI_RA
)
||
(
rnti_type
==
NFAPI_NR_RNTI_P
))
?
0
:
\
(
config
.
pdsch_config
.
x_overhead
.
value
);
uint8_t
N_PRB_DMRS
=
(
config
.
pdsch_config
.
dmrs_type
.
value
==
NFAPI_NR_DMRS_TYPE1
)
?
6
:
4
;
//This only works for antenna port 1000
uint8_t
N_sh_symb
=
dlsch_rel15
->
nb_symbols
;
...
...
@@ -163,58 +184,34 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
uint16_t
N_RE_prime
=
NR_NB_SC_PER_RB
*
N_sh_symb
-
N_PRB_DMRS
-
N_PRB_oh
;
LOG_D
(
MAC
,
"N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead
\n
"
,
N_RE_prime
,
N_sh_symb
,
N_PRB_DMRS
,
N_PRB_oh
);
uint16_t
N_RE
,
Ninfo
,
Ninfo_prime
,
C
,
TBS
=
0
,
R
;
uint8_t
table_idx
,
Qm
,
n
,
scale
;
uint16_t
R
,
TBS
=
0
;
uint8_t
table_idx
,
Qm
;
/*uint8_t mcs_table = config.pdsch_config.mcs_table.value;
uint8_t ss_type = params_rel15.search_space_type;
uint8_t dci_format = params_rel15.dci_format;
get_table_idx(mcs_table, dci_format, rnti_type, ss_type);*/
table_idx
=
1
;
scale
=
((
table_idx
==
2
)
&&
((
Imcs
==
20
)
||
(
Imcs
==
26
)))
?
11
:
10
;
N_RE
=
min
(
156
,
N_RE_prime
)
*
dlsch_rel15
->
n_prb
;
table_idx
=
0
;
R
=
nr_get_code_rate_dl
(
Imcs
,
table_idx
);
Qm
=
nr_get_Qm_dl
(
Imcs
,
table_idx
);
Ninfo
=
(
N_RE
*
R
*
Qm
*
dlsch_rel15
->
nb_layers
)
>>
scale
;
if
(
Ninfo
<=
3824
)
{
n
=
max
(
3
,
(
log2
(
Ninfo
)
-
6
));
Ninfo_prime
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
for
(
int
i
=
0
;
i
<
93
;
i
++
)
if
(
nr_tbs_table
[
i
]
>=
Ninfo_prime
)
{
TBS
=
nr_tbs_table
[
i
];
break
;
}
}
else
{
n
=
log2
(
Ninfo
-
24
)
-
5
;
Ninfo_prime
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),(
1
<<
n
)))
<<
n
);
if
(
R
<
256
)
{
C
=
CEILIDIV
((
Ninfo_prime
+
24
),
3816
);
TBS
=
(
C
<<
3
)
*
CEILIDIV
((
Ninfo_prime
+
24
),(
C
<<
3
))
-
24
;
}
else
{
if
(
Ninfo_prime
>
8424
)
{
C
=
CEILIDIV
((
Ninfo_prime
+
24
),
8424
);
TBS
=
(
C
<<
3
)
*
CEILIDIV
((
Ninfo_prime
+
24
),(
C
<<
3
))
-
24
;
}
else
TBS
=
((
CEILIDIV
((
Ninfo_prime
+
24
),
8
))
<<
3
)
-
24
;
}
}
TBS
=
nr_compute_tbs
(
Qm
,
R
,
dlsch_rel15
->
n_prb
,
N_sh_symb
,
N_PRB_DMRS
,
N_PRB_oh
,
dlsch_rel15
->
nb_layers
);
dlsch_rel15
->
coding_rate
=
R
;
dlsch_rel15
->
modulation_order
=
Qm
;
dlsch_rel15
->
transport_block_size
=
TBS
;
dlsch_rel15
->
nb_re_dmrs
=
N_PRB_DMRS
;
dlsch_rel15
->
nb_mod_symbols
=
N_RE_prime
*
dlsch_rel15
->
n_prb
*
dlsch_rel15
->
nb_codewords
;
dlsch_rel15
->
mcs_table
=
table_idx
;
LOG_D
(
MAC
,
"TBS %d : N_
RE %d N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d Ninfo %d Ninfo_prime %d R %d Qm %d table %d sca
le %d nb_symbols %d
\n
"
,
TBS
,
N_
RE
,
N_PRB_DMRS
,
N_sh_symb
,
N_PRB_oh
,
Ninfo
,
Ninfo_prime
,
R
,
Qm
,
table_idx
,
scale
,
dlsch_rel15
->
nb_mod_symbols
);
LOG_D
(
MAC
,
"TBS %d : N_
PRB_DMRS %d N_sh_symb %d N_PRB_oh %d R %d Qm %d tab
le %d nb_symbols %d
\n
"
,
TBS
,
N_
PRB_DMRS
,
N_sh_symb
,
N_PRB_oh
,
R
,
Qm
,
table_idx
,
dlsch_rel15
->
nb_mod_symbols
);
}
uint32_t
nr_get_G
(
uint16_t
nb_rb
,
uint16_t
nb_symb_sch
,
uint8_t
nb_re_dmrs
,
uint16_t
length_dmrs
,
uint8_t
Qm
,
uint8_t
Nl
)
{
...
...
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
View file @
b3377497
...
...
@@ -56,9 +56,9 @@ uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
uint8_t
nr_get_Qm_ul
(
uint8_t
Imcs
,
uint8_t
table_idx
);
uint32_t
nr_get_code_rate_ul
(
uint8_t
Imcs
,
uint8_t
table_idx
);
void
nr_get_tbs
(
nfapi_nr_dl_config_dlsch_pdu
*
dlsch_pdu
,
nfapi_nr_dl_config_dci_dl_pdu
dci_pdu
,
nfapi_nr_config_request_t
config
);
void
nr_get_tbs
_dl
(
nfapi_nr_dl_config_dlsch_pdu
*
dlsch_pdu
,
nfapi_nr_dl_config_dci_dl_pdu
dci_pdu
,
nfapi_nr_config_request_t
config
);
/** \brief Computes available bits G. */
uint32_t
nr_get_G
(
uint16_t
nb_rb
,
uint16_t
nb_symb_sch
,
uint8_t
nb_re_dmrs
,
uint16_t
length_dmrs
,
uint8_t
Qm
,
uint8_t
Nl
);
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
View file @
b3377497
...
...
@@ -339,7 +339,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
// harq_process->trials[nfapi_ulsch_pdu_rel15->round]++;
harq_process
->
TBS
=
nr_compute_tbs
(
Qm
,
R
,
nb_rb
,
number_symbols
,
nb_re_dmrs
,
length_dmrs
,
n_layers
);
harq_process
->
TBS
=
nr_compute_tbs
(
Qm
,
R
,
nb_rb
,
number_symbols
,
nb_re_dmrs
*
length_dmrs
,
0
,
n_layers
);
A
=
harq_process
->
TBS
;
ret
=
ulsch
->
max_ldpc_iterations
+
1
;
...
...
@@ -438,8 +438,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
K_bytes_F
=
Kr_bytes
-
(
harq_process
->
F
>>
3
);
Tbslbrm
=
harq_process
->
TBS
;
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
E
=
nr_get_E
(
G
,
harq_process
->
C
,
nfapi_ulsch_pdu_rel15
->
Qm
,
nfapi_ulsch_pdu_rel15
->
n_layers
,
r
);
...
...
@@ -489,6 +487,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
///////////////////////// harq_process->e =====> harq_process->d /////////////////////////
Tbslbrm
=
nr_compute_tbslbrm
(
0
,
nb_rb
,
nfapi_ulsch_pdu_rel15
->
n_layers
,
harq_process
->
C
);
if
(
nr_rate_matching_ldpc_rx
(
Ilbrm
,
Tbslbrm
,
p_decParams
->
BG
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
View file @
b3377497
...
...
@@ -299,12 +299,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process
->
trials
[
harq_process
->
round
]
++
;
harq_process
->
TBS
=
nr_compute_tbs
(
harq_process
->
Qm
,
harq_process
->
R
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
harq_process
->
Nl
);
uint16_t
nb_rb_oh
=
0
;
// it was not computed at UE side even before and set to 0 in nr_compute_tbs
harq_process
->
TBS
=
nr_compute_tbs
(
harq_process
->
Qm
,
harq_process
->
R
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
nb_rb_oh
,
harq_process
->
Nl
);
A
=
harq_process
->
TBS
;
ret
=
dlsch
->
max_ldpc_iterations
+
1
;
dlsch
->
last_iteration_cnt
=
ret
;
harq_process
->
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
harq_process
->
Qm
,
harq_process
->
Nl
);
G
=
harq_process
->
G
;
...
...
@@ -312,7 +314,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
vcd_signal_dumper_dump_function_by_name
(
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION
,
VCD_FUNCTION_IN
);
Coderate
=
(
float
)
A
/
(
float
)
G
;
if
((
harq_process
->
R
)
<
1024
)
Coderate
=
(
float
)
(
harq_process
->
R
)
/
(
float
)
1024
;
else
Coderate
=
(
float
)
(
harq_process
->
R
)
/
(
float
)
2048
;
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
)
{
p_decParams
->
BG
=
2
;
...
...
@@ -409,8 +415,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
K_bytes_F
=
Kr_bytes
-
(
harq_process
->
F
>>
3
);
Tbslbrm
=
harq_process
->
TBS
;
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
//printf("start rx segment %d\n",r);
...
...
@@ -454,6 +458,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
vcd_signal_dumper_dump_function_by_name
(
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING
,
VCD_FUNCTION_IN
);
if
((
harq_process
->
Nl
)
<
4
)
Tbslbrm
=
nr_compute_tbslbrm
(
harq_process
->
mcs_table
,
nb_rb
,
harq_process
->
Nl
,
harq_process
->
C
);
else
Tbslbrm
=
nr_compute_tbslbrm
(
harq_process
->
mcs_table
,
nb_rb
,
4
,
harq_process
->
C
);
if
(
nr_rate_matching_ldpc_rx
(
Ilbrm
,
Tbslbrm
,
p_decParams
->
BG
,
...
...
@@ -750,7 +759,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
int32_t
no_iteration_ldpc
,
length_dec
;
/*uint8_t C;
uint8_t Qm;
uint8_t Nl;
uint8_t r_thread;
uint32_t Er, Gp,GpmodC;*/
t_nrLDPC_dec_params
decParams
;
...
...
@@ -759,7 +767,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
t_nrLDPC_time_stats
*
p_procTime
=&
procTime
;
int8_t
llrProcBuf
[
OAI_LDPC_MAX_NUM_LLR
]
__attribute__
((
aligned
(
32
)));
t_nrLDPC_procBuf
*
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
[
0
];
uint8_t
Nl
=
4
;
int16_t
z
[
68
*
384
];
int8_t
l
[
68
*
384
];
//__m128i l;
...
...
@@ -824,7 +832,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
nb_rb
=
harq_process
->
nb_rb
;
harq_process
->
trials
[
harq_process
->
round
]
++
;
harq_process
->
TBS
=
nr_compute_tbs
(
harq_process
->
Qm
,
harq_process
->
R
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
harq_process
->
Nl
);
uint16_t
nb_rb_oh
=
0
;
// it was not computed at UE side even before and set to 0 in nr_compute_tbs
harq_process
->
TBS
=
nr_compute_tbs
(
harq_process
->
Qm
,
harq_process
->
R
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
nb_rb_oh
,
harq_process
->
Nl
);
A
=
harq_process
->
TBS
;
...
...
@@ -844,7 +854,11 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
// printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi);
Coderate
=
(
float
)
A
/
(
float
)
G
;
if
((
harq_process
->
R
)
<
1024
)
Coderate
=
(
float
)
(
harq_process
->
R
)
/
(
float
)
1024
;
else
Coderate
=
(
float
)
(
harq_process
->
R
)
/
(
float
)
2048
;
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
)
{
p_decParams
->
BG
=
2
;
...
...
@@ -975,8 +989,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
Kr_bytes
=
Kr
>>
3
;
K_bytes_F
=
Kr_bytes
-
(
harq_process
->
F
>>
3
);
Tbslbrm
=
harq_process
->
TBS
;
E
=
nr_get_E
(
G
,
harq_process
->
C
,
harq_process
->
Qm
,
harq_process
->
Nl
,
r
);
/*
...
...
@@ -1017,6 +1029,12 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
harq_process
->
round
);
#endif
// for tbslbrm calculation according to 5.4.2.1 of 38.212
if
(
harq_process
->
Nl
<
Nl
)
Nl
=
harq_process
->
Nl
;
Tbslbrm
=
nr_compute_tbslbrm
(
rel15
.
mcs_table
,
nb_rb
,
Nl
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
);
if
(
nr_rate_matching_ldpc_rx
(
Ilbrm
,
Tbslbrm
,
p_decParams
->
BG
,
...
...
@@ -1364,8 +1382,8 @@ void *nr_dlsch_decoding_process(void *arg)
int
harq_pid
=
proc
->
harq_pid
;
llr8_flag1
=
proc
->
llr8_flag
;
int
frame
=
proc
->
frame_rx
;
int
slot
=
proc
->
nr_tti_rx
;
r
=
proc
->
num_seg
;
int
slot
=
proc
->
nr_tti_rx
;
r
=
proc
->
num_seg
;
NR_UE_DLSCH_t
*
dlsch
=
phy_vars_ue
->
dlsch
[
phy_vars_ue
->
current_thread_id
[
slot
]][
eNB_id
][
0
];
NR_DL_UE_HARQ_t
*
harq_process
=
dlsch
->
harq_processes
[
harq_pid
];
...
...
@@ -1393,7 +1411,9 @@ void *nr_dlsch_decoding_process(void *arg)
harq_process
->
trials
[
harq_process
->
round
]
++
;
harq_process
->
TBS
=
nr_compute_tbs
(
harq_process
->
Qm
,
harq_process
->
R
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
harq_process
->
Nl
);
uint16_t
nb_rb_oh
=
0
;
// it was not computed at UE side even before and set to 0 in nr_compute_tbs
harq_process
->
TBS
=
nr_compute_tbs
(
harq_process
->
Qm
,
harq_process
->
R
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
nb_rb_oh
,
harq_process
->
Nl
);
A
=
harq_process
->
TBS
;
//2072 for QPSK 1/3
...
...
@@ -1405,7 +1425,11 @@ void *nr_dlsch_decoding_process(void *arg)
LOG_I
(
PHY
,
"DLSCH Decoding process, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d
\n
"
,
harq_pid
,
A
,
G
,
harq_process
->
mcs
,
harq_process
->
Nl
,
nb_symb_sch
,
nb_rb
);
Coderate
=
(
float
)
A
/
(
float
)
G
;
if
((
harq_process
->
R
)
<
1024
)
Coderate
=
(
float
)
(
harq_process
->
R
)
/
(
float
)
1024
;
else
Coderate
=
(
float
)
(
harq_process
->
R
)
/
(
float
)
2048
;
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
)
{
p_decParams
->
BG
=
2
;
...
...
@@ -1518,9 +1542,7 @@ void *nr_dlsch_decoding_process(void *arg)
Kr_bytes
=
Kr
>>
3
;
K_bytes_F
=
Kr_bytes
-
(
harq_process
->
F
>>
3
);
Tbslbrm
=
harq_process
->
TBS
;
E
=
nr_get_E
(
G
,
harq_process
->
C
,
harq_process
->
Qm
,
harq_process
->
Nl
,
r
);
E
=
nr_get_E
(
G
,
harq_process
->
C
,
harq_process
->
Qm
,
harq_process
->
Nl
,
r
);
#if UE_TIMING_TRACE
start_meas
(
dlsch_deinterleaving_stats
);
...
...
@@ -1555,6 +1577,11 @@ void *nr_dlsch_decoding_process(void *arg)
harq_process
->
round
);
#endif
if
(
Nl
<
4
)
Tbslbrm
=
nr_compute_tbslbrm
(
harq_process
->
mcs_table
,
nb_rb
,
Nl
,
harq_process
->
C
);
else
Tbslbrm
=
nr_compute_tbslbrm
(
harq_process
->
mcs_table
,
nb_rb
,
4
,
harq_process
->
C
);
if
(
nr_rate_matching_ldpc_rx
(
Ilbrm
,
Tbslbrm
,
p_decParams
->
BG
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
View file @
b3377497
...
...
@@ -176,8 +176,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch
=
ue
->
dlsch
[
ue
->
current_thread_id
[
nr_tti_rx
]][
eNB_id
];
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
Qm
=
nr_get_Qm_dl
(
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
mcs
,
1
);
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
R
=
nr_get_code_rate_dl
(
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
mcs
,
1
);
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
Qm
=
nr_get_Qm_dl
(
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
mcs
,
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
mcs_table
);
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
R
=
nr_get_code_rate_dl
(
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
mcs
,
dlsch
[
0
]
->
harq_processes
[
harq_pid
]
->
mcs_table
);
//printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
LOG_D
(
PHY
,
"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d
\n
"
,
...
...
@@ -965,7 +965,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
break
;
}
if
(
dlsch1_harq
)
{
switch
(
nr_get_Qm_dl
(
dlsch1_harq
->
mcs
,
1
))
{
switch
(
nr_get_Qm_dl
(
dlsch1_harq
->
mcs
,
dlsch1_harq
->
mcs_table
))
{
case
2
:
if
(
rx_type
==
rx_standard
)
{
nr_dlsch_qpsk_llr
(
frame_parms
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
View file @
b3377497
...
...
@@ -265,6 +265,8 @@ typedef struct {
uint8_t
*
c
[
MAX_NUM_NR_DLSCH_SEGMENTS
];
/// Index of current HARQ round for this DLSCH
uint8_t
round
;
/// MCS table for this DLSCH
uint8_t
mcs_table
;
/// MCS format for this DLSCH
uint8_t
mcs
;
/// Qm (modulation order) for this DLSCH
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
View file @
b3377497
...
...
@@ -200,9 +200,9 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
uint32_t
A
,
Z
,
F
;
uint32_t
*
pz
;
uint8_t
mod_order
;
uint16_t
Kr
,
r
,
r_offset
,
R
;
uint16_t
Kr
,
r
,
r_offset
;
uint8_t
BG
;
uint32_t
E
;
uint32_t
E
,
Kb
;
uint8_t
Ilbrm
;
uint32_t
Tbslbrm
;
uint8_t
nb_re_dmrs
;
...
...
@@ -222,8 +222,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
nb_symb_sch
=
harq_process
->
number_of_symbols
;
A
=
harq_process
->
TBS
;
pz
=
&
Z
;
mod_order
=
nr_get_Qm_ul
(
harq_process
->
mcs
,
1
);
R
=
nr_get_code_rate_ul
(
harq_process
->
mcs
,
1
);
mod_order
=
nr_get_Qm_ul
(
harq_process
->
mcs
,
0
);
Kr
=
0
;
r_offset
=
0
;
BG
=
1
;
...
...
@@ -251,9 +250,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
harq_process
->
Nl
);
LOG_D
(
PHY
,
"ulsch coding A %d G %d mod_order %d
\n
"
,
A
,
G
,
mod_order
);
Tbslbrm
=
nr_compute_tbs
(
mod_order
,
R
,
nb_rb
,
frame_parms
->
symbols_per_slot
,
0
,
0
,
harq_process
->
Nl
);
// if (harq_process->Ndi == 1) { // this is a new packet
if
(
harq_process
->
round
==
0
)
{
// this is a new packet
...
...
@@ -297,14 +293,14 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
BG
=
1
;
}
nr_segmentation
(
harq_process
->
b
,
harq_process
->
c
,
harq_process
->
B
,
&
harq_process
->
C
,
&
harq_process
->
K
,
pz
,
&
harq_process
->
F
,
BG
);
Kb
=
nr_segmentation
(
harq_process
->
b
,
harq_process
->
c
,
harq_process
->
B
,
&
harq_process
->
C
,
&
harq_process
->
K
,
pz
,
&
harq_process
->
F
,
BG
);
F
=
harq_process
->
F
;
...
...
@@ -352,7 +348,7 @@ opp_enabled=0;
}
printf("\n");*/
ldpc_encoder_optim_8seg
(
harq_process
->
c
,
harq_process
->
d
,
Kr
,
BG
,
harq_process
->
C
,
NULL
,
NULL
,
NULL
,
NULL
);
ldpc_encoder_optim_8seg
(
harq_process
->
c
,
harq_process
->
d
,
*
pz
,
Kb
,
Kr
,
BG
,
harq_process
->
C
,
NULL
,
NULL
,
NULL
,
NULL
);
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
...
...
@@ -394,6 +390,8 @@ opp_enabled=0;
E
=
nr_get_E
(
G
,
harq_process
->
C
,
mod_order
,
harq_process
->
Nl
,
r
);
Tbslbrm
=
nr_compute_tbslbrm
(
0
,
nb_rb
,
harq_process
->
Nl
,
harq_process
->
C
);
nr_rate_matching_ldpc
(
Ilbrm
,
Tbslbrm
,
BG
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
View file @
b3377497
...
...
@@ -130,10 +130,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
harq_process_ul_ue
->
num_of_mod_symbols
=
N_RE_prime
*
harq_process_ul_ue
->
nb_rb
*
num_of_codewords
;
mod_order
=
nr_get_Qm_ul
(
harq_process_ul_ue
->
mcs
,
1
);
code_rate
=
nr_get_code_rate_ul
(
harq_process_ul_ue
->
mcs
,
1
);
mod_order
=
nr_get_Qm_ul
(
harq_process_ul_ue
->
mcs
,
0
);
code_rate
=
nr_get_code_rate_ul
(
harq_process_ul_ue
->
mcs
,
0
);
harq_process_ul_ue
->
TBS
=
nr_compute_tbs
(
mod_order
,
harq_process_ul_ue
->
nb_rb
,
code_rate
,
harq_process_ul_ue
->
number_of_symbols
,
ulsch_ue
->
nb_re_dmrs
,
ulsch_ue
->
length_dmrs
,
harq_process_ul_ue
->
Nl
);
harq_process_ul_ue
->
TBS
=
nr_compute_tbs
(
mod_order
,
code_rate
,
harq_process_ul_ue
->
nb_rb
,
harq_process_ul_ue
->
number_of_symbols
,
ulsch_ue
->
nb_re_dmrs
*
ulsch_ue
->
length_dmrs
,
0
,
harq_process_ul_ue
->
Nl
);
//-----------------------------------------------------//
// to be removed later when MAC is ready
...
...
@@ -159,7 +165,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH scrambling/////////////////////////
///////////
mod_order
=
nr_get_Qm_ul
(
harq_process_ul_ue
->
mcs
,
1
);
mod_order
=
nr_get_Qm_ul
(
harq_process_ul_ue
->
mcs
,
0
);
available_bits
=
nr_get_G
(
harq_process_ul_ue
->
nb_rb
,
harq_process_ul_ue
->
number_of_symbols
,
...
...
openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
View file @
b3377497
...
...
@@ -123,6 +123,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response)
dlsch0_harq
->
harq_ack
.
pucch_resource_indicator
=
dlsch_config_pdu
->
pucch_resource_id
;
dlsch0_harq
->
harq_ack
.
slot_for_feedback_ack
=
dlsch_config_pdu
->
pdsch_to_harq_feedback_time_ind
;
dlsch0_harq
->
Nl
=
1
;
dlsch0_harq
->
mcs_table
=
0
;
dlsch0_harq
->
status
=
ACTIVE
;
LOG_D
(
MAC
,
">>>>
\t
dlsch0->g_pucch=%d
\t
dlsch0_harq.mcs=%d
\n
"
,
dlsch0
->
g_pucch
,
dlsch0_harq
->
mcs
);
...
...
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
b3377497
...
...
@@ -3307,7 +3307,7 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t
harq_processes_dest
->
B
=
current_harq_processes
->
B
;
harq_processes_dest
->
C
=
current_harq_processes
->
C
;
harq_processes_dest
->
DCINdi
=
current_harq_processes
->
DCINdi
;
harq_processes_dest
->
DCINdi
=
current_harq_processes
->
DCINdi
;
harq_processes_dest
->
F
=
current_harq_processes
->
F
;
harq_processes_dest
->
G
=
current_harq_processes
->
G
;
harq_processes_dest
->
K
=
current_harq_processes
->
K
;
...
...
@@ -3320,6 +3320,7 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t
harq_processes_dest
->
dl_power_off
=
current_harq_processes
->
dl_power_off
;
harq_processes_dest
->
first_tx
=
current_harq_processes
->
first_tx
;
harq_processes_dest
->
mcs
=
current_harq_processes
->
mcs
;
harq_processes_dest
->
mcs_table
=
current_harq_processes
->
mcs_table
;
harq_processes_dest
->
mimo_mode
=
current_harq_processes
->
mimo_mode
;
harq_processes_dest
->
nb_rb
=
current_harq_processes
->
nb_rb
;
harq_processes_dest
->
pmi_alloc
=
current_harq_processes
->
pmi_alloc
;
...
...
openair1/SIMULATION/NR_PHY/dlschsim.c
View file @
b3377497
...
...
@@ -110,6 +110,7 @@ int main(int argc, char **argv)
uint16_t
nb_symb_sch
=
12
;
uint16_t
nb_rb
=
50
;
uint8_t
Imcs
=
9
;
uint8_t
mcs_table
=
0
;
cpuf
=
get_cpu_freq_GHz
();
...
...
@@ -438,10 +439,10 @@ int main(int argc, char **argv)
dlsch->harq_processes[0]->rvidx = rvidx;*/
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
// dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->mcs,dlsch->harq_processes[0]->Nl);
mod_order
=
nr_get_Qm_dl
(
Imcs
,
1
);
rate
=
nr_get_code_rate_dl
(
Imcs
,
1
);
mod_order
=
nr_get_Qm_dl
(
Imcs
,
mcs_table
);
rate
=
nr_get_code_rate_dl
(
Imcs
,
mcs_table
);
available_bits
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
1
);
TBS
=
nr_compute_tbs
(
mod_order
,
rate
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
Nl
);
TBS
=
nr_compute_tbs
(
mod_order
,
rate
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
0
,
Nl
);
printf
(
"available bits %u TBS %u mod_order %d
\n
"
,
available_bits
,
TBS
,
mod_order
);
//dlsch->harq_ids[subframe]= 0;
rel15
->
n_prb
=
nb_rb
;
...
...
@@ -450,6 +451,7 @@ int main(int argc, char **argv)
rel15
->
nb_layers
=
Nl
;
rel15
->
nb_re_dmrs
=
nb_re_dmrs
;
rel15
->
transport_block_size
=
TBS
;
rel15
->
coding_rate
=
rate
;
double
*
modulated_input
=
malloc16
(
sizeof
(
double
)
*
16
*
68
*
384
);
// [hna] 16 segments, 68*Zc
short
*
channel_output_fixed
=
malloc16
(
sizeof
(
short
)
*
16
*
68
*
384
);
short
*
channel_output_uncoded
=
malloc16
(
sizeof
(
unsigned
short
)
*
16
*
68
*
384
);
...
...
@@ -464,10 +466,12 @@ int main(int argc, char **argv)
NR_UE_DLSCH_t
*
dlsch0_ue
=
UE
->
dlsch
[
0
][
0
][
0
];
NR_DL_UE_HARQ_t
*
harq_process
=
dlsch0_ue
->
harq_processes
[
harq_pid
];
harq_process
->
mcs
=
Imcs
;
harq_process
->
mcs_table
=
mcs_table
;
harq_process
->
Nl
=
Nl
;
harq_process
->
nb_rb
=
nb_rb
;
harq_process
->
Qm
=
mod_order
;
harq_process
->
rvidx
=
rvidx
;
harq_process
->
R
=
rate
;
printf
(
"harq process ue mcs = %d Qm = %d, symb %d
\n
"
,
harq_process
->
mcs
,
harq_process
->
Qm
,
nb_symb_sch
);
unsigned
char
*
test_input
;
test_input
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
TBS
/
8
);
...
...
openair1/SIMULATION/NR_PHY/ulschsim.c
View file @
b3377497
...
...
@@ -386,10 +386,10 @@ int main(int argc, char **argv)
NR_UE_ULSCH_t
*
ulsch_ue
=
UE
->
ulsch
[
0
][
0
][
0
];
mod_order
=
nr_get_Qm_ul
(
Imcs
,
1
);
code_rate
=
nr_get_code_rate_ul
(
Imcs
,
1
);
mod_order
=
nr_get_Qm_ul
(
Imcs
,
0
);
code_rate
=
nr_get_code_rate_ul
(
Imcs
,
0
);
available_bits
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
1
);
TBS
=
nr_compute_tbs
(
mod_order
,
code_rate
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
Nl
);
TBS
=
nr_compute_tbs
(
mod_order
,
code_rate
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
0
,
Nl
);
printf
(
"
\n
Available bits %u TBS %u mod_order %d
\n
"
,
available_bits
,
TBS
,
mod_order
);
...
...
openair1/SIMULATION/NR_PHY/ulsim.c
View file @
b3377497
...
...
@@ -412,10 +412,10 @@ int main(int argc, char **argv)
unsigned
char
mod_order
;
uint16_t
code_rate
;
mod_order
=
nr_get_Qm_ul
(
Imcs
,
1
);
code_rate
=
nr_get_code_rate_ul
(
Imcs
,
1
);
mod_order
=
nr_get_Qm_ul
(
Imcs
,
0
);
code_rate
=
nr_get_code_rate_ul
(
Imcs
,
0
);
available_bits
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
1
);
TBS
=
nr_compute_tbs
(
mod_order
,
code_rate
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
precod_nbr_layers
);
TBS
=
nr_compute_tbs
(
mod_order
,
code_rate
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
0
,
precod_nbr_layers
);
NR_gNB_ULSCH_t
*
ulsch_gNB
=
gNB
->
ulsch
[
UE_id
+
1
][
0
];
nfapi_nr_ul_config_ulsch_pdu
*
rel15_ul
=
&
ulsch_gNB
->
harq_processes
[
harq_pid
]
->
ulsch_pdu
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
View file @
b3377497
...
...
@@ -145,7 +145,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
params_rel15
->
nb_slots
,
params_rel15
->
sfn_mod2
,
params_rel15
->
first_slot
);
nr_get_tbs
(
&
dl_config_dlsch_pdu
->
dlsch_pdu
,
dl_config_dci_pdu
->
dci_dl_pdu
,
*
cfg
);
nr_get_tbs
_dl
(
&
dl_config_dlsch_pdu
->
dlsch_pdu
,
dl_config_dci_pdu
->
dci_dl_pdu
,
*
cfg
);
LOG_D
(
MAC
,
"DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d
\n
"
,
dlsch_pdu_rel15
->
start_prb
,
dlsch_pdu_rel15
->
n_prb
,
...
...
@@ -270,7 +270,7 @@ int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
params_rel15
->
rb_offset
,
params_rel15
->
first_symbol
,
params_rel15
->
search_space_type
);
nr_get_tbs
(
&
dl_config_dlsch_pdu
->
dlsch_pdu
,
dl_config_dci_pdu
->
dci_dl_pdu
,
*
cfg
);
nr_get_tbs
_dl
(
&
dl_config_dlsch_pdu
->
dlsch_pdu
,
dl_config_dci_pdu
->
dci_dl_pdu
,
*
cfg
);
// Hardcode it for now
TBS
=
dl_config_dlsch_pdu
->
dlsch_pdu
.
dlsch_pdu_rel15
.
transport_block_size
;
LOG_D
(
MAC
,
"DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS: %d
\n
"
,
...
...
@@ -360,7 +360,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
// Hardcode it for now
TBS
=
6784
/
8
;
//TBS in bytes
//nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
//nr_get_tbs
_dl
(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
//TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
for
(
lcid
=
NB_RB_MAX
-
1
;
lcid
>=
DTCH
;
lcid
--
)
{
...
...
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