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
c94d7632
Commit
c94d7632
authored
Jan 06, 2020
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging of nr_dlschsim, rate matching optimization
parent
d27a8f07
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
357 additions
and
120 deletions
+357
-120
openair1/PHY/CODING/coding_defs.h
openair1/PHY/CODING/coding_defs.h
+2
-0
openair1/PHY/CODING/nr_rate_matching.c
openair1/PHY/CODING/nr_rate_matching.c
+287
-12
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+19
-12
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+7
-20
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+1
-1
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+2
-0
openair1/SIMULATION/NR_PHY/dlschsim.c
openair1/SIMULATION/NR_PHY/dlschsim.c
+4
-2
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+17
-42
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+3
-3
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+8
-7
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+3
-3
openair2/LAYER2/NR_MAC_gNB/main.c
openair2/LAYER2/NR_MAC_gNB/main.c
+2
-1
openair2/NR_PHY_INTERFACE/NR_IF_Module.c
openair2/NR_PHY_INTERFACE/NR_IF_Module.c
+2
-17
No files found.
openair1/PHY/CODING/coding_defs.h
View file @
c94d7632
...
...
@@ -481,6 +481,8 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
uint8_t
*
w
,
uint8_t
*
e
,
uint8_t
C
,
uint32_t
F
,
uint32_t
Foffset
,
uint8_t
rvidx
,
uint32_t
E
);
...
...
openair1/PHY/CODING/nr_rate_matching.c
View file @
c94d7632
This diff is collapsed.
Click to expand it.
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
c94d7632
...
...
@@ -305,13 +305,13 @@ int nr_dlsch_encoding(unsigned char *a,
#ifdef DEBUG_DLSCH_CODING
LOG_D
(
PHY
,
"encoding thinks this is a new packet
\n
"
);
#endif
/*
/*
int i;
LOG_D(PHY,"dlsch (tx): \n");
for (i=0;i<(A>>3);i++)
LOG_D(PHY,"%02x
.
",a[i]);
LOG_D(PHY,"%02x
\n
",a[i]);
LOG_D(PHY,"\n");
*/
*/
if
(
A
>
3824
)
{
// Add 24-bit crc (polynomial A) to payload
...
...
@@ -381,7 +381,7 @@ int nr_dlsch_encoding(unsigned char *a,
LOG_D
(
PHY
,
"Encoder: B %d F %d
\n
"
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
dlsch
->
harq_processes
[
harq_pid
]
->
F
);
LOG_D
(
PHY
,
"start ldpc encoder segment %d/%d
\n
"
,
r
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
);
LOG_D
(
PHY
,
"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
++
){
LOG_D
(
PHY
,
"%d "
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
][
cnt
]);
}
LOG_D
(
PHY
,
"
\n
"
);
...
...
@@ -407,7 +407,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
)
{
if
(
F
>
0
)
{
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))
...
...
@@ -415,13 +415,7 @@ int nr_dlsch_encoding(unsigned char *a,
}
}
#ifdef DEBUG_DLSCH_CODING
printf
(
"Rate Matching, Code segment %d (coded bits (G) %u, unpunctured/repeated bits per code segment %d, mod_order %d, nb_rb %d)...
\n
"
,
r
,
G
,
Kr
*
3
,
mod_order
,
nb_rb
);
#endif
#ifdef DEBUG_DLSCH_CODING
LOG_D
(
PHY
,
"rvidx in encoding = %d
\n
"
,
rel15
->
rvIndex
[
0
]);
...
...
@@ -429,6 +423,17 @@ int nr_dlsch_encoding(unsigned char *a,
E
=
nr_get_E
(
G
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
mod_order
,
rel15
->
nrOfLayers
,
r
);
#ifdef DEBUG_DLSCH_CODING
printf
(
"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...
\n
"
,
r
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
G
,
E
,
F
,
Kr
-
F
-
2
*
(
*
Zc
),
mod_order
,
nb_rb
);
#endif
// for tbslbrm calculation according to 5.4.2.1 of 38.212
if
(
rel15
->
nrOfLayers
<
Nl
)
Nl
=
rel15
->
nrOfLayers
;
...
...
@@ -443,6 +448,8 @@ int nr_dlsch_encoding(unsigned char *a,
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
],
dlsch
->
harq_processes
[
harq_pid
]
->
e
+
r_offset
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
F
,
Kr
-
F
-
2
*
(
*
Zc
),
rel15
->
rvIndex
[
0
],
E
);
stop_meas
(
dlsch_rate_matching_stats
);
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
View file @
c94d7632
...
...
@@ -43,7 +43,7 @@
#include "executables/nr-uesoftmodem.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
//#define DEBUG_DLSCH_DECODING
//#define DEBUG_DLSCH_DECODING
1
//#define ENABLE_PHY_PAYLOAD_DEBUG 1
#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX
...
...
@@ -239,7 +239,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
}
t_nrLDPC_procBuf
**
p_nrLDPC_procBuf
=
harq_process
->
p_nrLDPC_procBuf
;
AssertFatal
(
p_nrLDPC_procBuf
[
0
]
->
llrProcBuf
!=
NULL
,
"Entry. llProcBuf is null!
\n
"
);
int16_t
z
[
68
*
384
];
int8_t
l
[
68
*
384
];
...
...
@@ -253,7 +252,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
double
Coderate
;
// = 0.0;
uint8_t
dmrs_Type
=
harq_process
->
dmrsConfigType
;
AssertFatal
(
dmrs_Type
==
NFAPI_NR_DMRS_TYPE1
||
dmrs_Type
==
NFAPI_NR_DMRS_TYPE
2
,
"Illegal dmrs_type %d
\n
"
,
dmrs_Type
);
AssertFatal
(
dmrs_Type
==
1
||
dmrs_Type
==
2
,
"Illegal dmrs_type %d
\n
"
,
dmrs_Type
);
uint8_t
nb_re_dmrs
=
(
dmrs_Type
==
1
)
?
6
:
4
;
uint16_t
dmrs_length
=
get_num_dmrs
(
harq_process
->
dlDmrsSymbPos
);
AssertFatal
(
dmrs_length
==
1
||
dmrs_length
==
2
,
"Illegal dmrs_length %d
\n
"
,
dmrs_length
);
...
...
@@ -315,7 +314,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process
->
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
dmrs_length
,
harq_process
->
Qm
,
harq_process
->
Nl
);
G
=
harq_process
->
G
;
LOG_D
(
PHY
,
"DLSCH Decoding, 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
);
LOG_D
(
PHY
,
"DLSCH Decoding, harq_pid %d TBS %d G %d
nb_re_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d
\n
"
,
harq_pid
,
A
,
G
,
nb_re_dmrs
,
harq_process
->
mcs
,
harq_process
->
Nl
,
nb_symb_sch
,
nb_rb
);
vcd_signal_dumper_dump_function_by_name
(
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION
,
VCD_FUNCTION_IN
);
...
...
@@ -431,14 +430,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
vcd_signal_dumper_dump_function_by_name
(
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING
,
VCD_FUNCTION_IN
);
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"10. llProcBuf is null!
\n
"
);
nr_deinterleaving_ldpc
(
E
,
harq_process
->
Qm
,
harq_process
->
w
[
r
],
// [hna] w is e
dlsch_llr
+
r_offset
);
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"11. llProcBuf is null!
\n
"
);
vcd_signal_dumper_dump_function_by_name
(
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING
,
VCD_FUNCTION_OUT
);
...
...
@@ -472,7 +469,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
else
Tbslbrm
=
nr_compute_tbslbrm
(
harq_process
->
mcs_table
,
nb_rb
,
4
,
harq_process
->
C
);
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"0. llProcBuf is null!
\n
"
);
if
(
nr_rate_matching_ldpc_rx
(
Ilbrm
,
Tbslbrm
,
...
...
@@ -498,7 +494,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
#endif
}
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"1. llProcBuf is null!
\n
"
);
//for (int i =0; i<16; i++)
// printf("rx output ratematching d[%d]= %d r_offset %d\n", i,harq_process->d[r][i], r_offset);
...
...
@@ -508,12 +503,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
#ifdef DEBUG_DLSCH_DECODING
if
(
r
==
0
)
{
write_output
(
"decoder_llr.m"
,
"decllr"
,
dlsch_llr
,
G
,
1
,
0
);
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],
(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
0
);
write_output
(
"decoder_in.m"
,
"dec"
,
&
harq_process
->
d
[
0
][
0
],
E
,
1
,
0
);
}
printf
(
"decoder input(segment %u) :"
,
r
);
int
i
;
for
(
i
=
0
;
i
<
(
3
*
8
*
Kr_bytes
)
+
12
;
i
++
)
for
(
i
=
0
;
i
<
E
;
i
++
)
printf
(
"%d : %d
\n
"
,
i
,
harq_process
->
d
[
r
][
i
]);
printf
(
"
\n
"
);
#endif
...
...
@@ -566,13 +561,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_LDPC
,
VCD_FUNCTION_IN
);
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"2. llProcBuf is null!
\n
"
);
no_iteration_ldpc
=
nrLDPC_decoder
(
p_decParams
,
(
int8_t
*
)
&
pl
[
0
],
llrProcBuf
,
p_nrLDPC_procBuf
[
r
],
p_procTime
);
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"3. llProcBuf is null!
\n
"
);
vcd_signal_dumper_dump_function_by_name
(
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC
,
VCD_FUNCTION_OUT
);
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
...
...
@@ -587,7 +580,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
ret
=
1
+
dlsch
->
max_ldpc_iterations
;
}
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"4. llProcBuf is null!
\n
"
);
nb_total_decod
++
;
if
(
no_iteration_ldpc
>
dlsch
->
max_ldpc_iterations
){
...
...
@@ -604,7 +596,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
{
harq_process
->
c
[
r
][
m
]
=
(
uint8_t
)
llrProcBuf
[
m
];
}
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"5. llProcBuf is null!
\n
"
);
#ifdef DEBUG_DLSCH_DECODING
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
...
...
@@ -667,7 +658,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
phy_vars_ue
->
Mod_id
,
nr_tti_rx
,
harq_pid
,
harq_process
->
status
,
harq_process
->
round
,
dlsch
->
Mdlharq
,
harq_process
->
TBS
);
}
AssertFatal
(
p_nrLDPC_procBuf
[
r
]
->
llrProcBuf
!=
NULL
,
"Exit 1. llProcBuf is null!
\n
"
);
return
((
1
+
dlsch
->
max_ldpc_iterations
));
}
else
{
//#if UE_DEBUG_TRACE
...
...
@@ -707,12 +697,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
AssertFatal
(
p_nrLDPC_procBuf
[
0
]
->
llrProcBuf
!=
NULL
,
"7. llProcBuf is null (r %d)!
\n
"
,
r
);
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
));
AssertFatal
(
p_nrLDPC_procBuf
[
0
]
->
llrProcBuf
!=
NULL
,
"8. llProcBuf is null (r %d)!
\n
"
,
r
);
#ifdef DEBUG_DLSCH_DECODING
printf
(
"Segment %u : Kr= %u bytes
\n
"
,
r
,
Kr_bytes
);
...
...
@@ -744,7 +732,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
dlsch
->
last_iteration_cnt
=
ret
;
AssertFatal
(
p_nrLDPC_procBuf
[
0
]
->
llrProcBuf
!=
NULL
,
"Exit 2. llProcBuf is null!
\n
"
);
return
(
ret
);
}
...
...
@@ -803,7 +790,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
double
Coderate
=
0
.
0
;
nfapi_nr_dl_config_dlsch_pdu_rel15_t
*
dl_config_pdu
=
&
harq_processes
[
harq_pid
]
->
dl_config_pdu
uint8_t
dmrs_type
=
dl_config_pdu
->
dmrsConfigType
;
uint8_t
nb_re_dmrs
=
(
dmrs_type
==
NFAPI_NR_DMRS_TYPE
1
)
?
6
:
4
;
uint8_t
nb_re_dmrs
=
(
dmrs_type
==
1
)
?
6
:
4
;
uint16_t
length_dmrs
=
get_num_dmrs
(
dl_config_pdu
->
dlDmrsSymbPos
);
uint32_t
i
,
j
;
...
...
@@ -864,7 +851,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
G
=
harq_process
->
G
;
LOG_D
(
PHY
,
"DLSCH Decoding main, 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
);
LOG_D
(
PHY
,
"DLSCH Decoding main, harq_pid %d TBS %d G %d
, nb_re_dmrs %d, length_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d
\n
"
,
harq_pid
,
A
,
G
,
nb_re_dmrs
,
length_dmrs
,
harq_process
->
mcs
,
harq_process
->
Nl
,
nb_symb_sch
,
nb_rb
);
proc
->
decoder_main_available
=
1
;
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
View file @
c94d7632
...
...
@@ -427,7 +427,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
avgs
=
cmax
(
avgs
,
avg
[(
aatx
<<
1
)
+
aarx
]);
pdsch_vars
[
eNB_id
]
->
log2_maxh
=
(
log2_approx
(
avgs
)
/
2
)
+
1
;
pdsch_vars
[
eNB_id
]
->
log2_maxh
=
(
log2_approx
(
avgs
)
/
2
)
+
3
;
}
else
if
(
dlsch0_harq
->
mimo_mode
==
NR_DUALSTREAM
)
{
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
View file @
c94d7632
...
...
@@ -396,6 +396,8 @@ opp_enabled=0;
harq_process
->
d
[
r
],
harq_process
->
e
+
r_offset
,
harq_process
->
C
,
F
,
Kr
-
F
-
2
*
(
*
pz
),
harq_process
->
rvidx
,
E
);
...
...
openair1/SIMULATION/NR_PHY/dlschsim.c
View file @
c94d7632
...
...
@@ -449,10 +449,11 @@ int main(int argc, char **argv)
rel15
->
NrOfSymbols
=
nb_symb_sch
;
rel15
->
qamModOrder
[
0
]
=
mod_order
;
rel15
->
nrOfLayers
=
Nl
;
rel15
->
TBSize
[
0
]
=
TBS
;
rel15
->
TBSize
[
0
]
=
TBS
>>
3
;
rel15
->
targetCodeRate
[
0
]
=
rate
;
rel15
->
NrOfCodewords
=
1
;
rel15
->
dmrsConfigType
=
NFAPI_NR_DMRS_TYPE1
;
rel15
->
dlDmrsSymbPos
=
4
;
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
);
...
...
@@ -473,7 +474,8 @@ int main(int argc, char **argv)
harq_process
->
Qm
=
mod_order
;
harq_process
->
rvidx
=
rvidx
;
harq_process
->
R
=
rate
;
harq_process
->
dmrsConfigType
=
NFAPI_NR_DMRS_TYPE1
;
harq_process
->
dmrsConfigType
=
1
;
harq_process
->
dlDmrsSymbPos
=
4
;
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/dlsim.c
View file @
c94d7632
...
...
@@ -186,8 +186,6 @@ int main(int argc, char **argv)
int
trial
,
n_trials
=
1
,
n_errors
=
0
,
n_false_positive
=
0
;
//int n_errors2, n_alamouti;
uint8_t
transmission_mode
=
1
,
n_tx
=
1
,
n_rx
=
1
;
uint16_t
Nid_cell
=
0
;
uint64_t
SSB_positions
=
0x01
;
channel_desc_t
*
gNB2UE
;
//uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
...
...
@@ -206,25 +204,21 @@ int main(int argc, char **argv)
int
N_RB_DL
=
106
,
mu
=
1
;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
dlsch_config
;
uint16_t
ssb_periodicity
=
10
;
//unsigned char frame_type = 0;
int
frame
=
0
,
slot
=
1
;
int
frame_length_complex_samples
;
int
frame_length_complex_samples_no_prefix
;
int
slot_length_complex_samples_no_prefix
;
NR_DL_FRAME_PARMS
*
frame_parms
;
UE_nr_rxtx_proc_t
UE_proc
;
NR_Sched_Rsp_t
Sched_INFO
;
gNB_MAC_INST
*
gNB_mac
;
NR_UE_MAC_INST_t
*
UE_mac
;
int
cyclic_prefix_type
=
NFAPI_CP_NORMAL
;
int
ret
;
int
run_initial_sync
=
0
;
int
do_pdcch_flag
=
1
;
uint16_t
cset_offset
=
0
;
int
loglvl
=
OAILOG_INFO
;
float
target_error_rate
=
0
.
01
;
...
...
@@ -238,10 +232,10 @@ int main(int argc, char **argv)
randominit
(
0
);
int
mcsIndex_set
=
0
,
rbStart_set
=
0
,
rbSize_set
=
0
,
StartSymbolIndex_set
=
0
,
NrOfSymbols_set
=
0
;
int
mcsIndex_set
=
0
,
rbStart_set
=
0
,
rbSize_set
=
0
;
int
print_perf
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:E
o:a:b:c:j
:e:"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:E
a:b
:e:"
))
!=
-
1
)
{
switch
(
c
)
{
/*case 'f':
write_output_file=1;
...
...
@@ -367,14 +361,6 @@ int main(int argc, char **argv)
break
;
case
'M'
:
SSB_positions
=
atoi
(
optarg
);
break
;
case
'N'
:
Nid_cell
=
atoi
(
optarg
);
break
;
case
'R'
:
N_RB_DL
=
atoi
(
optarg
);
break
;
...
...
@@ -408,9 +394,6 @@ int main(int argc, char **argv)
css_flag
=
1
;
break
;
case
'o'
:
cset_offset
=
atoi
(
optarg
);
break
;
case
'a'
:
dlsch_config
.
rbStart
=
atoi
(
optarg
);
...
...
@@ -422,16 +405,6 @@ int main(int argc, char **argv)
rbSize_set
=
1
;
break
;
case
'c'
:
dlsch_config
.
StartSymbolIndex
=
atoi
(
optarg
);
StartSymbolIndex_set
=
1
;
break
;
case
'j'
:
dlsch_config
.
NrOfSymbols
=
atoi
(
optarg
);
NrOfSymbols_set
=
1
;
break
;
case
'e'
:
dlsch_config
.
mcsIndex
[
0
]
=
atoi
(
optarg
);
mcsIndex_set
=
1
;
...
...
@@ -454,8 +427,6 @@ int main(int argc, char **argv)
printf
(
"-z Number of RX antennas used in UE
\n
"
);
//printf("-i Relative strength of first intefering gNB (in dB) - cell_id mod 3 = 1\n");
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
printf
(
"-M Multiple SSB positions in burst
\n
"
);
printf
(
"-N Nid_cell
\n
"
);
printf
(
"-R N_RB_DL
\n
"
);
printf
(
"-O oversampling factor (1,2,4,8,16)
\n
"
);
printf
(
"-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file
\n
"
);
...
...
@@ -595,7 +566,6 @@ int main(int argc, char **argv)
frame_length_complex_samples
=
frame_parms
->
samples_per_subframe
*
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
;
frame_length_complex_samples_no_prefix
=
frame_parms
->
samples_per_subframe_wCP
*
NR_NUMBER_OF_SUBFRAMES_PER_FRAME
;
slot_length_complex_samples_no_prefix
=
frame_parms
->
samples_per_slot_wCP
;
s_re
=
malloc
(
2
*
sizeof
(
double
*
));
s_im
=
malloc
(
2
*
sizeof
(
double
*
));
...
...
@@ -665,7 +635,7 @@ int main(int argc, char **argv)
UE_mac
->
if_module
=
nr_ue_if_module_init
(
0
);
unsigned
int
available_bits
;
unsigned
int
available_bits
=
0
;
unsigned
char
*
estimated_output_bit
;
unsigned
char
*
test_input_bit
;
unsigned
int
errors_bit
=
0
;
...
...
@@ -687,8 +657,6 @@ int main(int argc, char **argv)
//Configure UE
uint32_t
pdcch_ConfigSIB1
=
0
;
uint32_t
ssb_SubcarrierOffset
=
0
;
rrc
.
carrier
.
MIB
=
(
uint8_t
*
)
malloc
(
4
);
rrc
.
carrier
.
sizeof_MIB
=
do_MIB_NR
(
&
rrc
,
0
);
...
...
@@ -717,7 +685,6 @@ int main(int argc, char **argv)
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
.
2
)
{
varArray_t
*
table_tx
=
initVarArray
(
1000
,
sizeof
(
double
));
varArray_t
*
table_tx_ifft
=
initVarArray
(
1000
,
sizeof
(
double
));
reset_meas
(
&
gNB
->
phy_proc_tx
);
// total gNB tx
reset_meas
(
&
gNB
->
dlsch_scrambling_stats
);
reset_meas
(
&
gNB
->
dlsch_interleaving_stats
);
...
...
@@ -801,7 +768,9 @@ int main(int argc, char **argv)
// if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev));
for
(
i
=
0
;
i
<
frame_length_complex_samples
;
i
++
)
{
for
(
i
=
(
slot
*
frame_parms
->
samples_per_slot
);
i
<
((
slot
+
1
)
*
frame_parms
->
samples_per_slot
);
i
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_tx
;
aa
++
)
{
r_re
[
aa
][
i
]
=
((
double
)(((
short
*
)
txdata
[
aa
]))[(
i
<<
1
)]);
r_im
[
aa
][
i
]
=
((
double
)(((
short
*
)
txdata
[
aa
]))[(
i
<<
1
)
+
1
]);
...
...
@@ -812,11 +781,13 @@ int main(int argc, char **argv)
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
rel15
=
gNB_dlsch
->
harq_processes
[
0
]
->
pdsch_pdu
.
pdsch_pdu_rel15
;
//AWGN
sigma2_dB
=
10
*
log10
((
double
)
txlev
*
(
N_RB_DL
/
rel15
.
rbSize
))
-
SNR
;
sigma2_dB
=
10
*
log10
((
double
)
txlev
*
(
(
double
)
UE
->
frame_parms
.
ofdm_symbol_size
/
(
12
*
rel15
.
rbSize
)
))
-
SNR
;
sigma2
=
pow
(
10
,
sigma2_dB
/
10
);
if
(
n_trials
==
1
)
printf
(
"sigma2 %f (%f dB), txlev %f (factor %f)
\n
"
,
sigma2
,
sigma2_dB
,
10
*
log10
((
double
)
txlev
*
(
N_RB_DL
/
rel15
.
rbSize
)),(
double
)
N_RB_DL
/
rel15
.
rbSize
);
if
(
n_trials
==
1
)
printf
(
"sigma2 %f (%f dB), txlev %f (factor %f)
\n
"
,
sigma2
,
sigma2_dB
,
10
*
log10
((
double
)
txlev
),(
double
)(
double
)
UE
->
frame_parms
.
ofdm_symbol_size
/
(
12
*
rel15
.
rbSize
)
);
for
(
i
=
0
;
i
<
frame_length_complex_samples
;
i
++
)
{
for
(
i
=
(
slot
*
frame_parms
->
samples_per_slot
);
i
<
((
slot
+
1
)
*
frame_parms
->
samples_per_slot
);
i
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_rx
;
aa
++
)
{
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[
2
*
i
]
=
(
short
)
((
r_re
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[
2
*
i
+
1
]
=
(
short
)
((
r_im
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
...
...
@@ -899,7 +870,7 @@ int main(int argc, char **argv)
if
(
errors_scrambling
>
0
)
{
if
(
n_trials
==
1
)
printf
(
"errors_scrambling = %d
(trial %d)
\n
"
,
errors_scrambling
,
trial
);
printf
(
"errors_scrambling = %d
/%d (trial %d)
\n
"
,
errors_scrambling
,
available_bits
,
trial
);
}
if
(
errors_bit
>
0
)
{
...
...
@@ -935,7 +906,11 @@ int main(int argc, char **argv)
if
(
print_perf
==
1
)
{
printf
(
"
\n
gNB TX function statistics (per %d us slot)
\n
"
,
1000
>>*
scc
->
ssbSubcarrierSpacing
);
printf
(
"
\n
gNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))
\n
"
,
1000
>>*
scc
->
ssbSubcarrierSpacing
,
dlsch_config
.
rbSize
,
dlsch_config
.
mcsIndex
[
0
],
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
pdsch_pdu
.
pdsch_pdu_rel15
.
TBSize
[
0
]
<<
3
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
K
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
K
/
((
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
pdsch_pdu
.
pdsch_pdu_rel15
.
TBSize
[
0
]
<<
3
)
>
3824
?
22
:
10
));
printDistribution
(
&
gNB
->
phy_proc_tx
,
table_tx
,
"PHY proc tx"
);
printStatIndent2
(
&
gNB
->
dlsch_encoding_stats
,
"DLSCH encoding time"
);
printStatIndent3
(
&
gNB
->
dlsch_segmentation_stats
,
"DLSCH segmentation time"
);
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
View file @
c94d7632
...
...
@@ -316,9 +316,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
protocol_ctxt_t
ctxt
;
int
CC_id
,
i
=
-
1
;
NR_UE_list_t
*
UE_list
=
&
RC
.
nrmac
[
module_idP
]
->
UE_list
;
rnti_t
rnti
;
int
CC_id
;
NR_COMMON_channels_t
*
cc
=
RC
.
nrmac
[
module_idP
]
->
common_channels
;
//nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = NULL;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
View file @
c94d7632
...
...
@@ -249,9 +249,9 @@ int configure_fapi_dl_Tx(int Mod_idP,
int
*
CCEIndex
,
nfapi_nr_dl_tti_request_body_t
*
dl_req
,
nfapi_nr_pdu_t
*
TX_req
,
in
t
*
mcsIndex
,
in
t
*
rbSize
,
in
t
*
rbStart
)
{
uint8_
t
*
mcsIndex
,
uint16_
t
*
rbSize
,
uint16_
t
*
rbStart
)
{
gNB_MAC_INST
*
nr_mac
=
RC
.
nrmac
[
Mod_idP
];
...
...
@@ -303,7 +303,7 @@ int configure_fapi_dl_Tx(int Mod_idP,
pdsch_pdu_rel15
->
NrOfCodewords
=
1
;
int
mcs
=
(
mcsIndex
!=
NULL
)
?
*
mcsIndex
:
9
;
pdsch_pdu_rel15
->
targetCodeRate
[
0
]
=
nr_get_code_rate_dl
(
mcs
Index
,
0
);
pdsch_pdu_rel15
->
targetCodeRate
[
0
]
=
nr_get_code_rate_dl
(
mcs
,
0
);
pdsch_pdu_rel15
->
qamModOrder
[
0
]
=
2
;
pdsch_pdu_rel15
->
mcsIndex
[
0
]
=
mcs
;
pdsch_pdu_rel15
->
mcsTable
[
0
]
=
0
;
...
...
@@ -430,7 +430,7 @@ int configure_fapi_dl_Tx(int Mod_idP,
// TX_req->TLVs[0].length = 8;
// memcpy((void*)&TX_req->TLVs[0].value.direct[0],(void*)&cc[CC_id].RAR_pdu.payload[0],TX_req->TLVs[0].length);
return
TBS
/
8
;
//Return TBS in bytes
return
TBS
;
//Return TBS in bytes
}
void
config_uldci
(
NR_BWP_Uplink_t
*
ubwp
,
nfapi_nr_pusch_pdu_t
*
pusch_pdu
,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t
*
pdcch_pdu_rel15
,
dci_pdu_rel15_t
*
dci_pdu_rel15
,
int
*
dci_formats
,
int
*
rnti_types
)
{
...
...
@@ -681,9 +681,10 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
dlsch_config
!=
NULL
?
&
dlsch_config
->
rbStart
:
NULL
);
// HOT FIX for all zero pdu problem
// ------------------------------------------------------------------------------------------------
LOG_D
(
MAC
,
"Filling %d bytes in DL_TX
\n
"
,
TBS_bytes
);
for
(
int
i
=
0
;
i
<
TBS_bytes
;
i
++
)
{
//
((
uint8_t
*
)
nr_mac
->
UE_list
.
DLSCH_pdu
[
0
][
0
].
payload
[
0
])[
i
]
=
(
unsigned
char
)
rand
(
);
((
uint8_t
*
)
nr_mac
->
UE_list
.
DLSCH_pdu
[
0
][
0
].
payload
[
0
])[
i
]
=
(
unsigned
char
)
(
lrand48
()
&
0xff
);
//LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
}
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
...
...
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
c94d7632
...
...
@@ -70,9 +70,9 @@ int configure_fapi_dl_Tx(int Mod_id,
int
*
CCEIndeces
,
nfapi_nr_dl_tti_request_body_t
*
dl_req
,
nfapi_nr_pdu_t
*
TX_req
,
in
t
*
mcsIndex
,
in
t
*
rbSize
,
in
t
*
rbStart
);
uint8_
t
*
mcsIndex
,
uint16_
t
*
rbSize
,
uint16_
t
*
rbStart
);
void
config_uldci
(
NR_BWP_Uplink_t
*
ubwp
,
nfapi_nr_pusch_pdu_t
*
pusch_pdu
,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t
*
pdcch_pdu_rel15
,
dci_pdu_rel15_t
*
dci_pdu_rel15
,
int
*
dci_formats
,
int
*
rnti_types
);
void
nr_schedule_uss_dlsch_phytest
(
module_id_t
module_idP
,
...
...
openair2/LAYER2/NR_MAC_gNB/main.c
View file @
c94d7632
...
...
@@ -47,7 +47,7 @@ extern RAN_CONTEXT_t RC;
void
mac_top_init_gNB
(
void
)
{
module_id_t
i
,
j
;
module_id_t
i
;
int
list_el
;
NR_UE_list_t
*
UE_list
;
gNB_MAC_INST
*
nrmac
;
...
...
@@ -113,4 +113,5 @@ void mac_top_init_gNB(void)
UE_list
->
active
[
list_el
]
=
FALSE
;
}
srand48
(
0
);
}
openair2/NR_PHY_INTERFACE/NR_IF_Module.c
View file @
c94d7632
...
...
@@ -107,21 +107,6 @@ void handle_nr_sr(NR_UL_IND_t *UL_info) {
}
void
handle_nr_cqi
(
NR_UL_IND_t
*
UL_info
)
{
if
(
nfapi_mode
==
1
)
{
if
(
UL_info
->
cqi_ind
.
number_of_cqis
>
0
)
{
LOG_D
(
PHY
,
"UL_info->cqi_ind.number_of_cqis:%d
\n
"
,
UL_info
->
cqi_ind
.
number_of_cqis
);
nfapi_cqi_indication_t
ind
;
ind
.
header
.
message_id
=
NFAPI_RX_CQI_INDICATION
;
ind
.
sfn_sf
=
UL_info
->
frame
<<
4
|
UL_info
->
slot
;
ind
.
cqi_indication_body
=
UL_info
->
cqi_ind
;
// oai_nfapi_cqi_indication(&ind);
UL_info
->
cqi_ind
.
number_of_cqis
=
0
;
}
}
else
{
/*
for (int i=0;i<UL_info->cqi_ind.number_of_cqis;i++)
...
...
@@ -135,7 +120,7 @@ void handle_nr_cqi(NR_UL_IND_t *UL_info) {
&UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
*/
UL_info
->
cqi_ind
.
number_of_cqis
=
0
;
}
}
void
handle_nr_harq
(
NR_UL_IND_t
*
UL_info
)
{
...
...
@@ -300,7 +285,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
sched_info
->
UL_dci_req
=
&
mac
->
UL_dci_req
[
CC_id
];
if
((
mac
->
common_channels
[
CC_id
].
ServingCellConfigCommon
->
tdd_UL_DL_ConfigurationCommon
==
NULL
)
||
(
is_nr_UL_slot
(
&
mac
->
common_channels
[
CC_id
]
,(
sched_info
->
slot
+
sf_ahead
)
%
spf
)
>
0
))
(
is_nr_UL_slot
(
mac
->
common_channels
[
CC_id
].
ServingCellConfigCommon
,(
sched_info
->
slot
+
sf_ahead
)
%
spf
)
>
0
))
sched_info
->
UL_tti_req
=
&
mac
->
UL_tti_req
[
CC_id
];
else
sched_info
->
UL_tti_req
=
NULL
;
...
...
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