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
littleBu
OpenXG-RAN
Commits
e993a59d
Commit
e993a59d
authored
3 years ago
by
sfn
Committed by
Thomas Schlichter
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make use of gNB precoding matrix for PDSCH layer precoding
parent
0517b973
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
498 additions
and
421 deletions
+498
-421
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+432
-380
openair1/PHY/MODULATION/nr_modulation.c
openair1/PHY/MODULATION/nr_modulation.c
+15
-0
openair1/PHY/MODULATION/nr_modulation.h
openair1/PHY/MODULATION/nr_modulation.h
+5
-0
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+29
-38
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+1
-1
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+1
-0
openair2/RRC/NR/rrc_gNB_reconfig.c
openair2/RRC/NR/rrc_gNB_reconfig.c
+13
-2
targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
.../GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
+2
-0
No files found.
openair1/PHY/INIT/nr_init.c
View file @
e993a59d
...
@@ -76,399 +76,451 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB,
...
@@ -76,399 +76,451 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB,
gNB_MAC_INST
*
mac
)
{
gNB_MAC_INST
*
mac
)
{
//get RRC Codebook configuration
//get RRC Codebook configuration
struct
NR_CSI_ReportConfig
*
csi_reportconfig
=
mac
->
UE_info
.
CellGroup
[
0
]
->
spCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
->
choice
.
setup
->
csi_ReportConfigToAddModList
->
list
.
array
[
0
];
struct
NR_CSI_ReportConfig
*
csi_reportconfig
=
mac
->
UE_info
.
CellGroup
[
0
]
->
spCellConfig
->
spCellConfigDedicated
->
csi_MeasConfig
->
choice
.
setup
->
csi_ReportConfigToAddModList
->
list
.
array
[
0
];
//int rrc_count = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.count;
if
(
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
present
==
NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel
)
{
int
N1
=
1
;
int
N2
=
1
;
int
O1
=
0
;
int
O2
=
0
;
int
CSI_RS_antenna_ports
=
1
;
//Uniform Planner Array: UPA
// X X X X ... X
// X X X X ... X
// N2 . . . . ... .
// X X X X ... X
// |<-----N1---->|
printf
(
"NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel
\n
"
);
struct
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel
*
type1single
=
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
;
if
(
type1single
->
nrOfAntennaPorts
.
present
==
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two
)
{
N1
=
1
;
N2
=
1
;
O1
=
1
;
O2
=
1
;
CSI_RS_antenna_ports
=
2
;
}
else
if
(
type1single
->
nrOfAntennaPorts
.
present
==
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo
)
{
//Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2)
switch
(
type1single
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
)
{
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_two_one
\n
"
);
N1
=
2
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
4
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_two_two_TypeI
\n
"
);
N1
=
2
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
8
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_four_one
\n
"
);
N1
=
4
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
8
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_three_two
\n
"
);
N1
=
3
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
12
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_six_one
\n
"
);
N1
=
6
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
12
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_four_two
\n
"
);
N1
=
4
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
16
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_eight_one
\n
"
);
N1
=
8
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
16
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_four_three
\n
"
);
N1
=
4
;
N2
=
3
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
24
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_six_two_
\n
"
);
N1
=
6
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
24
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_twelve_one
\n
"
);
N1
=
12
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
24
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_four_four
\n
"
);
N1
=
4
;
N2
=
4
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
32
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_eight_two
\n
"
);
N1
=
8
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
32
;
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction
:
printf
(
"NR Codebook Config: codebookType, type1, n1_n2_PR_sixteen_one
\n
"
);
N1
=
16
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
32
;
break
;
default:
printf
(
"n1 n2 is %d
\n
"
,
type1single
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
);
N1
=
1
;
N2
=
1
;
O1
=
1
;
O2
=
1
;
CSI_RS_antenna_ports
=
2
;
break
;
}
}
if
(
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
codebookMode
==
1
){
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
){
if
(
CSI_RS_antenna_ports
<
16
)
{
LOG_I
(
MAC
,
"NR mac_init_codebook_gNB: codebookType present %d
\n
"
,
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
present
);
//Generate DFT vertical beams
if
(
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
present
==
NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel
)
{
//ll: index of a vertical beams vector (represented by i1_1 in TS 38.214)
int
N1
=
1
;
double
complex
v
[
N1
*
O1
][
N1
];
int
N2
=
1
;
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i1_1
int
O1
=
0
;
for
(
int
nn
=
0
;
nn
<
N1
;
nn
++
){
int
O2
=
0
;
v
[
ll
][
nn
]
=
cexp
(
I
*
(
2
*
M_PI
*
nn
*
ll
)
/
(
N1
*
O1
));
int
CSI_RS_antenna_ports
=
1
;
//printf("v[%d][%d] = %f +j %f\n", ll,nn, creal(v[ll][nn]),cimag(v[ll][nn]));
}
//Uniform Planner Array: UPA
//Generate DFT Horizontal beams
// X X X X ... X
//mm: index of a Horizontal beams vector (represented by i1_2 in TS 38.214)
// X X X X ... X
double
complex
u
[
N2
*
O2
][
N2
];
// N2 . . . . ... .
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i1_2
// X X X X ... X
for
(
int
nn
=
0
;
nn
<
N2
;
nn
++
){
// |<-----N1---->|
u
[
mm
][
nn
]
=
cexp
(
I
*
(
2
*
M_PI
*
nn
*
mm
)
/
(
N2
*
O2
));
LOG_I
(
MAC
,
"NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel
\n
"
);
//printf("u[%d][%d] = %f +j %f\n", mm,nn, creal(u[mm][nn]),cimag(u[mm][nn]));
struct
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel
*
type1single
=
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
;
if
(
type1single
->
nrOfAntennaPorts
.
present
==
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two
)
{
N1
=
1
;
N2
=
1
;
O1
=
1
;
O2
=
1
;
CSI_RS_antenna_ports
=
2
;
LOG_I
(
MAC
,
"NR Codebook Config: antenna ports: %d
\n
"
,
CSI_RS_antenna_ports
);
}
else
if
(
type1single
->
nrOfAntennaPorts
.
present
==
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo
)
{
//Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2)
switch
(
type1single
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
)
{
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction
:
N1
=
2
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
4
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction
:
N1
=
2
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
8
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction
:
N1
=
4
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
8
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction
:
N1
=
3
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
12
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction
:
N1
=
6
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
12
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction
:
N1
=
4
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
16
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction
:
N1
=
8
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
16
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction
:
N1
=
4
;
N2
=
3
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
24
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction
:
N1
=
6
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
24
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction
:
N1
=
12
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
24
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction
:
N1
=
4
;
N2
=
4
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
32
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction
:
N1
=
8
;
N2
=
2
;
O1
=
4
;
O2
=
4
;
CSI_RS_antenna_ports
=
32
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two
\n
"
,
CSI_RS_antenna_ports
);
break
;
case
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction
:
N1
=
16
;
N2
=
1
;
O1
=
4
;
O2
=
1
;
CSI_RS_antenna_ports
=
32
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one
\n
"
,
CSI_RS_antenna_ports
);
break
;
default:
N1
=
1
;
N2
=
1
;
O1
=
1
;
O2
=
1
;
CSI_RS_antenna_ports
=
2
;
LOG_I
(
MAC
,
"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2 %d
\n
"
,
CSI_RS_antenna_ports
,
type1single
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
);
break
;
}
}
//Generate co-phasing angles
}
//i_2: index of a co-phasing vector
//i1_1, i1_2, and i_2 are reported from UEs
double
complex
theta_n
[
4
];
for
(
int
nn
=
0
;
nn
<
4
;
nn
++
){
theta_n
[
nn
]
=
cexp
(
I
*
M_PI
*
nn
/
2
);
//printf("theta_n[%d] = %f +j %f\n", nn, creal(theta_n[nn]),cimag(theta_n[nn]));
}
//Kronecker product v_lm
double
complex
v_lm
[
N1
*
O1
][
N2
*
O2
][
N2
*
N1
];
//v_ll_mm_codebook denotes the elements of a precoding matrix W_i1,1_i_1,2
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
for
(
int
nn1
=
0
;
nn1
<
N1
;
nn1
++
)
for
(
int
nn2
=
0
;
nn2
<
N2
;
nn2
++
){
printf
(
"indx %d
\n
"
,
nn1
*
N2
+
nn2
);
v_lm
[
ll
][
mm
][
nn1
*
N2
+
nn2
]
=
v
[
ll
][
nn1
]
*
u
[
mm
][
nn2
];
printf
(
"v_lm[%d][%d][%d] = %f +j %f
\n
"
,
ll
,
mm
,
nn1
*
N2
+
nn2
,
creal
(
v_lm
[
ll
][
mm
][
nn1
*
N2
+
nn2
]),
cimag
(
v_lm
[
ll
][
mm
][
nn1
*
N2
+
nn2
]));
}
int
pmi_size
=
1
;
if
(
CSI_RS_antenna_ports
==
2
)
pmi_size
=
(
N1
*
O1
)
*
N2
*
O2
*
(
4
)
+
(
N1
*
O1
-
1
)
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
(
N2
*
O2
-
1
)
*
N1
*
O1
*
N2
*
O2
*
2
+
(
N1
*
O1
-
1
)
*
N2
*
O2
*
2
+
(
N2
*
O2
-
1
)
*
2
+
2
;
else
if
(
CSI_RS_antenna_ports
>=
4
)
pmi_size
=
N1
*
O1
*
N2
*
O2
*
(
4
)
+
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
(
N1
*
O1
-
1
)
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
(
N2
*
O2
-
1
)
*
N1
*
O1
*
N2
*
O2
*
2
+
(
N1
*
O1
-
1
)
*
N2
*
O2
*
2
+
(
N2
*
O2
-
1
)
*
2
+
2
;
gNB
->
nr_mimo_precoding_matrix
=
(
int32_t
**
)
malloc16
(
pmi_size
*
sizeof
(
int32_t
));
int32_t
**
mat
=
gNB
->
nr_mimo_precoding_matrix
;
double
complex
res_code
;
//Table 5.2.2.2.1-5:
//Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
for
(
int
nn
=
0
;
nn
<
4
;
nn
++
){
int
pmiq
=
ll
*
N2
*
O2
*
4
+
mm
*
4
+
nn
;
mat
[
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
1
*
sizeof
(
int32_t
));
printf
(
"layer 1 pmiq = %d
\n
"
,
pmiq
);
for
(
int
len
=
0
;
len
<
N1
*
N2
;
len
++
)
{
res_code
=
sqrt
(
1
/
(
double
)
CSI_RS_antenna_ports
)
*
v_lm
[
ll
][
mm
][
len
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
len
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
len
])[
0
],((
short
*
)
&
mat
[
pmiq
][
len
])[
1
]);
}
for
(
int
len
=
N1
*
N2
;
len
<
2
*
N1
*
N2
;
len
++
)
{
res_code
=
sqrt
(
1
/
(
double
)
CSI_RS_antenna_ports
)
*
theta_n
[
nn
]
*
v_lm
[
ll
][
mm
][
len
-
N1
*
N2
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
len
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
len
])[
0
],((
short
*
)
&
mat
[
pmiq
][
len
])[
1
]);
}
if
(
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
codebookMode
==
1
){
if
(
CSI_RS_antenna_ports
<
16
)
{
//Generate DFT vertical beams
//ll: index of a vertical beams vector (represented by i1_1 in TS 38.214)
double
complex
v
[
N1
*
O1
][
N1
];
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i1_1
for
(
int
nn
=
0
;
nn
<
N1
;
nn
++
){
v
[
ll
][
nn
]
=
cexp
(
I
*
(
2
*
M_PI
*
nn
*
ll
)
/
(
N1
*
O1
));
//printf("v[%d][%d] = %f +j %f\n", ll,nn, creal(v[ll][nn]),cimag(v[ll][nn]));
}
}
int
llc
;
//Generate DFT Horizontal beams
int
mmc
;
//mm: index of a Horizontal beams vector (represented by i1_2 in TS 38.214)
double
complex
phase_sign
;
double
complex
u
[
N2
*
O2
][
N2
];
//Table 5.2.2.2.1-6:
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i1_2
//Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
for
(
int
nn
=
0
;
nn
<
N2
;
nn
++
){
for
(
int
llb
=
0
;
llb
<
N1
*
O1
;
llb
++
)
//i_1_1
u
[
mm
][
nn
]
=
cexp
(
I
*
(
2
*
M_PI
*
nn
*
mm
)
/
(
N2
*
O2
));
for
(
int
mmb
=
0
;
mmb
<
N2
*
O2
;
mmb
++
)
//i_1_2
//printf("u[%d][%d] = %f +j %f\n", mm,nn, creal(u[mm][nn]),cimag(u[mm][nn]));
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
}
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
//Generate co-phasing angles
for
(
int
nn
=
0
;
nn
<
2
;
nn
++
){
//i_2: index of a co-phasing vector
int
pmiq
=
N1
*
O1
*
N2
*
O2
*
(
4
)
+
llb
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
mmb
*
N1
*
O1
*
N2
*
O2
*
2
+
ll
*
N2
*
O2
*
2
+
mm
*
2
+
nn
;
//i1_1, i1_2, and i_2 are reported from UEs
mat
[
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
(
2
)
*
sizeof
(
int32_t
));
double
complex
theta_n
[
4
];
printf
(
"layer 2 pmiq = %d
\n
"
,
pmiq
);
for
(
int
nn
=
0
;
nn
<
4
;
nn
++
){
for
(
int
j_col
=
0
;
j_col
<
2
;
j_col
++
)
{
theta_n
[
nn
]
=
cexp
(
I
*
M_PI
*
nn
/
2
);
if
(
j_col
==
0
)
{
//printf("theta_n[%d] = %f +j %f\n", nn, creal(theta_n[nn]),cimag(theta_n[nn]));
llc
=
llb
;
}
mmc
=
mmb
;
//Kronecker product v_lm
phase_sign
=
1
;
double
complex
v_lm
[
N1
*
O1
][
N2
*
O2
][
N2
*
N1
];
}
//v_ll_mm_codebook denotes the elements of a precoding matrix W_i1,1_i_1,2
if
(
j_col
==
1
)
{
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
llc
=
ll
;
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
mmc
=
mm
;
for
(
int
nn1
=
0
;
nn1
<
N1
;
nn1
++
)
phase_sign
=
-
1
;
for
(
int
nn2
=
0
;
nn2
<
N2
;
nn2
++
){
}
//printf("indx %d \n",nn1*N2+nn2);
for
(
int
i_rows
=
0
;
i_rows
<
N1
*
N2
;
i_rows
++
)
{
v_lm
[
ll
][
mm
][
nn1
*
N2
+
nn2
]
=
v
[
ll
][
nn1
]
*
u
[
mm
][
nn2
];
res_code
=
sqrt
(
1
/
(
double
)(
2
*
CSI_RS_antenna_ports
))
*
v_lm
[
llc
][
mmc
][
i_rows
];
//printf("v_lm[%d][%d][%d] = %f +j %f\n",ll,mm, nn1*N2+nn2, creal(v_lm[ll][mm][nn1*N2+nn2]),cimag(v_lm[ll][mm][nn1*N2+nn2]));
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
i_rows
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
0
],((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
1
]);
}
for
(
int
i_rows
=
N1
*
N2
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
2
*
CSI_RS_antenna_ports
))
*
(
phase_sign
)
*
theta_n
[
nn
]
*
v_lm
[
llc
][
mmc
][
i_rows
-
N1
*
N2
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
i_rows
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
0
],((
short
*
)
&
mat
[
pmiq
][
i_rows
*
2
+
j_col
])[
1
]);
}
}
}
gNB
->
nr_mimo_precoding_matrix
=
(
int32_t
***
)
malloc16
(
4
*
sizeof
(
int32_t
**
));
int32_t
***
mat
=
gNB
->
nr_mimo_precoding_matrix
;
double
complex
res_code
;
//Table 5.2.2.2.1-5:
//Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
int
pmiq_size
=
N1
*
O1
*
N2
*
O2
*
4
+
1
;
mat
[
0
]
=
(
int32_t
**
)
malloc16
(
pmiq_size
*
sizeof
(
int32_t
*
));
//pmi=0 corresponds to unit matrix
mat
[
0
][
0
]
=
(
int32_t
*
)
calloc
(
2
*
N1
*
N2
,
sizeof
(
int32_t
));
for
(
int
j_col
=
0
;
j_col
<
1
;
j_col
++
)
//1 layer
for
(
int
i_rows
=
0
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
//2-x polarized antenna
if
(
j_col
==
i_rows
)
((
short
*
)
&
mat
[
0
][
0
][
i_rows
+
j_col
])[
0
]
=
32768
;
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
for
(
int
nn
=
0
;
nn
<
4
;
nn
++
){
int
pmiq
=
1
+
ll
*
N2
*
O2
*
4
+
mm
*
4
+
nn
;
mat
[
0
][
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
1
*
sizeof
(
int32_t
));
LOG_I
(
MAC
,
"layer 1 Codebook pmiq = %d
\n
"
,
pmiq
);
for
(
int
len
=
0
;
len
<
N1
*
N2
;
len
++
)
{
res_code
=
sqrt
(
1
/
(
double
)
CSI_RS_antenna_ports
)
*
v_lm
[
ll
][
mm
][
len
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_I
(
MAC
,
"1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
len
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
0
],((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
1
]);
}
}
//Table 5.2.2.2.1-7:
//Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
for
(
int
len
=
N1
*
N2
;
len
<
2
*
N1
*
N2
;
len
++
)
{
if
(
CSI_RS_antenna_ports
>=
3
)
res_code
=
sqrt
(
1
/
(
double
)
CSI_RS_antenna_ports
)
*
theta_n
[
nn
]
*
v_lm
[
ll
][
mm
][
len
-
N1
*
N2
];
for
(
int
llb
=
0
;
llb
<
N1
*
O1
;
llb
++
)
//i_1_1
if
(
creal
(
res_code
)
>
0
)
for
(
int
mmb
=
0
;
mmb
<
N2
*
O2
;
mmb
++
)
//i_1_2
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
else
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
for
(
int
nn
=
0
;
nn
<
2
;
nn
++
){
if
(
cimag
(
res_code
)
>
0
)
int
pmiq
=
N1
*
O1
*
N2
*
O2
*
(
4
)
+
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
llb
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
mmb
*
N1
*
O1
*
N2
*
O2
*
2
+
ll
*
N2
*
O2
*
2
+
mm
*
2
+
nn
;
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
mat
[
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
(
3
)
*
sizeof
(
int32_t
));
else
printf
(
"layer 3 pmiq = %d
\n
"
,
pmiq
);
((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
for
(
int
j_col
=
0
;
j_col
<
3
;
j_col
++
)
{
if
(
j_col
==
0
)
{
LOG_I
(
MAC
,
"1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
len
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
0
],((
short
*
)
&
mat
[
0
][
pmiq
][
len
])[
1
]);
llc
=
llb
;
mmc
=
mmb
;
phase_sign
=
1
;
}
if
(
j_col
==
1
)
{
llc
=
ll
;
mmc
=
mm
;
phase_sign
=
1
;
}
if
(
j_col
==
3
)
{
llc
=
llb
;
mmc
=
mmb
;
phase_sign
=
-
1
;
}
for
(
int
i_rows
=
0
;
i_rows
<
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
3
*
CSI_RS_antenna_ports
))
*
v_lm
[
llc
][
mmc
][
i_rows
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
i_rows
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
0
],((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
1
]);
}
for
(
int
i_rows
=
N1
*
N2
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
3
*
CSI_RS_antenna_ports
))
*
(
phase_sign
)
*
theta_n
[
nn
]
*
v_lm
[
llc
][
mmc
][
i_rows
-
N1
*
N2
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
i_rows
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
0
],((
short
*
)
&
mat
[
pmiq
][
i_rows
*
3
+
j_col
])[
1
]);
}
}
}
}
//Table 5.2.2.2.1-8:
}
//Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
if
(
CSI_RS_antenna_ports
>=
4
)
int
llc
;
for
(
int
llb
=
0
;
llb
<
N1
*
O1
;
llb
++
)
//i_1_1
int
mmc
;
for
(
int
mmb
=
0
;
mmb
<
N2
*
O2
;
mmb
++
)
//i_1_2
double
complex
phase_sign
;
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
//Table 5.2.2.2.1-6:
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
//Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
for
(
int
nn
=
0
;
nn
<
2
;
nn
++
){
pmiq_size
=
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
1
;
int
pmiq
=
N1
*
O1
*
N2
*
O2
*
(
4
)
+
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
llb
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
mmb
*
N1
*
O1
*
N2
*
O2
*
2
+
ll
*
N2
*
O2
*
2
+
mm
*
2
+
nn
;
mat
[
1
]
=
(
int32_t
**
)
malloc16
(
pmiq_size
*
sizeof
(
int32_t
*
));
mat
[
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
4
*
sizeof
(
int32_t
));
printf
(
"layer 4 pmiq = %d
\n
"
,
pmiq
);
//pmi=0 corresponds to unit matrix
for
(
int
j_col
=
0
;
j_col
<
4
;
j_col
++
)
{
mat
[
1
][
0
]
=
(
int32_t
*
)
calloc
((
2
*
N1
*
N2
)
*
(
2
),
sizeof
(
int32_t
));
if
(
j_col
==
0
)
{
for
(
int
j_col
=
0
;
j_col
<
2
;
j_col
++
)
//2 layers
llc
=
llb
;
for
(
int
i_rows
=
0
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
//2-x polarized antenna
mmc
=
mmb
;
if
(
j_col
==
i_rows
)
phase_sign
=
1
;
((
short
*
)
&
mat
[
1
][
0
][
i_rows
*
2
+
j_col
])[
0
]
=
32768
;
}
if
(
j_col
==
1
)
{
//pmi=1,...,pmi_size are computed as follows
llc
=
ll
;
for
(
int
llb
=
0
;
llb
<
N1
*
O1
;
llb
++
)
//i_1_1
mmc
=
mm
;
for
(
int
mmb
=
0
;
mmb
<
N2
*
O2
;
mmb
++
)
//i_1_2
phase_sign
=
1
;
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
}
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
if
(
j_col
==
3
)
{
for
(
int
nn
=
0
;
nn
<
2
;
nn
++
){
llc
=
llb
;
int
pmiq
=
1
+
llb
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
mmb
*
N1
*
O1
*
N2
*
O2
*
2
+
ll
*
N2
*
O2
*
2
+
mm
*
2
+
nn
;
mmc
=
mmb
;
mat
[
1
][
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
(
2
)
*
sizeof
(
int32_t
));
phase_sign
=
-
1
;
LOG_I
(
MAC
,
"layer 2 Codebook pmiq = %d
\n
"
,
pmiq
);
}
for
(
int
j_col
=
0
;
j_col
<
2
;
j_col
++
)
{
if
(
j_col
==
4
)
{
if
(
j_col
==
0
)
{
llc
=
ll
;
llc
=
llb
;
mmc
=
mm
;
mmc
=
mmb
;
phase_sign
=
-
1
;
phase_sign
=
1
;
}
if
(
j_col
==
1
)
{
llc
=
ll
;
mmc
=
mm
;
phase_sign
=
-
1
;
}
for
(
int
i_rows
=
0
;
i_rows
<
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
2
*
CSI_RS_antenna_ports
))
*
v_lm
[
llc
][
mmc
][
i_rows
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_I
(
MAC
,
"2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
i_rows
,
j_col
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
0
],((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
1
]);
}
for
(
int
i_rows
=
N1
*
N2
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
2
*
CSI_RS_antenna_ports
))
*
(
phase_sign
)
*
theta_n
[
nn
]
*
v_lm
[
llc
][
mmc
][
i_rows
-
N1
*
N2
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_I
(
MAC
,
"2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
i_rows
,
j_col
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
0
],((
short
*
)
&
mat
[
1
][
pmiq
][
i_rows
*
2
+
j_col
])[
1
]);
}
}
}
for
(
int
i_rows
=
0
;
i_rows
<
N1
*
N2
;
i_rows
++
)
{
}
res_code
=
sqrt
(
1
/
(
double
)(
4
*
CSI_RS_antenna_ports
))
*
v_lm
[
llc
][
mmc
][
i_rows
];
if
(
creal
(
res_code
)
>
0
)
//Table 5.2.2.2.1-7:
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
//Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
else
if
(
CSI_RS_antenna_ports
>=
3
){
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
pmiq_size
=
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
1
;
if
(
cimag
(
res_code
)
>
0
)
mat
[
2
]
=
(
int32_t
**
)
malloc16
(
pmiq_size
*
sizeof
(
int32_t
*
));
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q1else
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
//pmi=0 corresponds to unit matrix
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
i_rows
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
0
],((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
1
]);
mat
[
2
][
0
]
=
(
int32_t
*
)
calloc
((
2
*
N1
*
N2
)
*
(
3
),
sizeof
(
int32_t
));
for
(
int
j_col
=
0
;
j_col
<
3
;
j_col
++
)
//3 layers
for
(
int
i_rows
=
0
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
//2-x polarized antenna
if
(
j_col
==
i_rows
)
((
short
*
)
&
mat
[
2
][
0
][
i_rows
*
3
+
j_col
])[
0
]
=
32768
;
//pmi=1,...,pmi_size are computed as follows
for
(
int
llb
=
0
;
llb
<
N1
*
O1
;
llb
++
)
//i_1_1
for
(
int
mmb
=
0
;
mmb
<
N2
*
O2
;
mmb
++
)
//i_1_2
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
for
(
int
nn
=
0
;
nn
<
2
;
nn
++
){
int
pmiq
=
llb
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
mmb
*
N1
*
O1
*
N2
*
O2
*
2
+
ll
*
N2
*
O2
*
2
+
mm
*
2
+
nn
+
1
;
mat
[
2
][
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
(
3
)
*
sizeof
(
int32_t
));
LOG_D
(
MAC
,
"layer 3 Codebook pmiq = %d
\n
"
,
pmiq
);
for
(
int
j_col
=
0
;
j_col
<
3
;
j_col
++
)
{
if
(
j_col
==
0
)
{
llc
=
llb
;
mmc
=
mmb
;
phase_sign
=
1
;
}
if
(
j_col
==
1
)
{
llc
=
ll
;
mmc
=
mm
;
phase_sign
=
1
;
}
if
(
j_col
==
3
)
{
llc
=
llb
;
mmc
=
mmb
;
phase_sign
=
-
1
;
}
for
(
int
i_rows
=
0
;
i_rows
<
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
3
*
CSI_RS_antenna_ports
))
*
v_lm
[
llc
][
mmc
][
i_rows
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_D
(
MAC
,
"3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
i_rows
,
j_col
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
0
],((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
1
]);
}
for
(
int
i_rows
=
N1
*
N2
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
3
*
CSI_RS_antenna_ports
))
*
(
phase_sign
)
*
theta_n
[
nn
]
*
v_lm
[
llc
][
mmc
][
i_rows
-
N1
*
N2
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_D
(
MAC
,
"3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
i_rows
,
j_col
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
0
],((
short
*
)
&
mat
[
2
][
pmiq
][
i_rows
*
3
+
j_col
])[
1
]);
}
}
}
}
for
(
int
i_rows
=
N1
*
N2
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
{
}
res_code
=
sqrt
(
1
/
(
double
)(
4
*
CSI_RS_antenna_ports
))
*
(
phase_sign
)
*
theta_n
[
nn
]
*
v_lm
[
llc
][
mmc
][
i_rows
-
N1
*
N2
];
//Table 5.2.2.2.1-8:
if
(
creal
(
res_code
)
>
0
)
//Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
if
(
CSI_RS_antenna_ports
>=
4
){
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
pmiq_size
=
N1
*
O1
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
1
;
if
(
cimag
(
res_code
)
>
0
)
mat
[
3
]
=
(
int32_t
**
)
malloc16
(
pmiq_size
*
sizeof
(
int32_t
*
));
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
//pmi=0 corresponds to unit matrix
((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
mat
[
3
][
0
]
=
(
int32_t
*
)
calloc
((
2
*
N1
*
N2
)
*
(
4
),
sizeof
(
int32_t
));
printf
(
"%d %d result = %f+j %f FIXED POINT %d+j %d
\n
"
,
pmiq
,
i_rows
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
0
],((
short
*
)
&
mat
[
pmiq
][
i_rows
*
4
+
j_col
])[
1
]);
for
(
int
j_col
=
0
;
j_col
<
4
;
j_col
++
)
//4 layers
for
(
int
i_rows
=
0
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
//2-x polarized antenna
if
(
j_col
==
i_rows
)
((
short
*
)
&
mat
[
3
][
0
][
i_rows
*
4
+
j_col
])[
0
]
=
32768
;
//pmi=1,...,pmi_size are computed as follows
for
(
int
llb
=
0
;
llb
<
N1
*
O1
;
llb
++
)
//i_1_1
for
(
int
mmb
=
0
;
mmb
<
N2
*
O2
;
mmb
++
)
//i_1_2
for
(
int
ll
=
0
;
ll
<
N1
*
O1
;
ll
++
)
//i_1_1
for
(
int
mm
=
0
;
mm
<
N2
*
O2
;
mm
++
)
//i_1_2
for
(
int
nn
=
0
;
nn
<
2
;
nn
++
){
int
pmiq
=
llb
*
N2
*
O2
*
N1
*
O1
*
N2
*
O2
*
2
+
mmb
*
N1
*
O1
*
N2
*
O2
*
2
+
ll
*
N2
*
O2
*
2
+
mm
*
2
+
nn
+
1
;
mat
[
3
][
pmiq
]
=
(
int32_t
*
)
malloc16
((
2
*
N1
*
N2
)
*
4
*
sizeof
(
int32_t
));
LOG_D
(
MAC
,
"layer 4 pmiq = %d
\n
"
,
pmiq
);
for
(
int
j_col
=
0
;
j_col
<
4
;
j_col
++
)
{
if
(
j_col
==
0
)
{
llc
=
llb
;
mmc
=
mmb
;
phase_sign
=
1
;
}
if
(
j_col
==
1
)
{
llc
=
ll
;
mmc
=
mm
;
phase_sign
=
1
;
}
if
(
j_col
==
3
)
{
llc
=
llb
;
mmc
=
mmb
;
phase_sign
=
-
1
;
}
if
(
j_col
==
4
)
{
llc
=
ll
;
mmc
=
mm
;
phase_sign
=
-
1
;
}
for
(
int
i_rows
=
0
;
i_rows
<
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
4
*
CSI_RS_antenna_ports
))
*
v_lm
[
llc
][
mmc
][
i_rows
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q1else
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_D
(
MAC
,
"4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
i_rows
,
j_col
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
0
],((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
1
]);
}
for
(
int
i_rows
=
N1
*
N2
;
i_rows
<
2
*
N1
*
N2
;
i_rows
++
)
{
res_code
=
sqrt
(
1
/
(
double
)(
4
*
CSI_RS_antenna_ports
))
*
(
phase_sign
)
*
theta_n
[
nn
]
*
v_lm
[
llc
][
mmc
][
i_rows
-
N1
*
N2
];
if
(
creal
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
0
]
=
(
short
)
((
creal
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
if
(
cimag
(
res_code
)
>
0
)
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
+
0
.
5
);
//convert to Q15
else
((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
1
]
=
(
short
)
((
cimag
(
res_code
)
*
32768
)
-
0
.
5
);
//convert to Q15
LOG_D
(
MAC
,
"4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d
\n
"
,
pmiq
,
i_rows
,
j_col
,
creal
(
res_code
),
cimag
(
res_code
),((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
0
],((
short
*
)
&
mat
[
3
][
pmiq
][
i_rows
*
4
+
j_col
])[
1
]);
}
}
}
}
}
}
}
}
}
else
{
//codebookMode 2
LOG_I
(
MAC
,
"CodeBook Type 1, CodebookMode %ld is not supported
\n
"
,
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
codebookMode
);
}
}
}
else
{
//codebookMode 2
}
else
{
printf
(
"CodeBook Type 1, CodebookMode %ld is not supported
\n
"
,
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
codebookMode
);
LOG_I
(
MAC
,
"subType_PR_typeI %d is not supported
\n
"
,
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
present
);
}
}
}
else
{
printf
(
"subType_PR_typeI %d is not supported
\n
"
,
csi_reportconfig
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
present
);
}
}
return
(
0
);
return
(
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/MODULATION/nr_modulation.c
View file @
e993a59d
...
@@ -801,3 +801,18 @@ int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n
...
@@ -801,3 +801,18 @@ int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n
/* ((int16_t *)precodatatx_F)[0] = (int16_t)((((int16_t *)precodatatx_F)[0]*ONE_OVER_SQRT2_Q15)>>15);
/* ((int16_t *)precodatatx_F)[0] = (int16_t)((((int16_t *)precodatatx_F)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t *)precodatatx_F)[1] = (int16_t)((((int16_t *)precodatatx_F)[1]*ONE_OVER_SQRT2_Q15)>>15);*/
((int16_t *)precodatatx_F)[1] = (int16_t)((((int16_t *)precodatatx_F)[1]*ONE_OVER_SQRT2_Q15)>>15);*/
}
}
int
nr_layer_precoder_cm
(
int16_t
**
datatx_F_precoding
,
int
*
prec_matrix
,
uint8_t
n_layers
,
int32_t
re_offset
)
{
int32_t
precodatatx_F
=
0
;
for
(
int
al
=
0
;
al
<
n_layers
;
al
++
)
{
int16_t
antenna_re
=
datatx_F_precoding
[
al
][
re_offset
<<
1
];
int16_t
antenna_im
=
datatx_F_precoding
[
al
][(
re_offset
<<
1
)
+
1
];
//printf("antenna precoding: %d %d\n",((int16_t *)&prec_matrix[al])[0],((int16_t *)&prec_matrix[al])[1]);
((
int16_t
*
)
&
precodatatx_F
)[
0
]
+=
(
int16_t
)(((
int32_t
)(
antenna_re
*
(((
int16_t
*
)
&
prec_matrix
[
al
])[
0
]))
-
(
int32_t
)(
antenna_im
*
(((
int16_t
*
)
&
prec_matrix
[
al
])[
1
])))
>>
15
);
((
int16_t
*
)
&
precodatatx_F
)[
1
]
+=
(
int16_t
)(((
int32_t
)(
antenna_re
*
(((
int16_t
*
)
&
prec_matrix
[
al
])[
1
]))
+
(
int32_t
)(
antenna_im
*
(((
int16_t
*
)
&
prec_matrix
[
al
])[
0
])))
>>
15
);
}
return
precodatatx_F
;
}
This diff is collapsed.
Click to expand it.
openair1/PHY/MODULATION/nr_modulation.h
View file @
e993a59d
...
@@ -135,4 +135,9 @@ int nr_layer_precoder(int16_t **datatx_F_precoding,
...
@@ -135,4 +135,9 @@ int nr_layer_precoder(int16_t **datatx_F_precoding,
char
*
prec_matrix
,
char
*
prec_matrix
,
uint8_t
n_layers
,
uint8_t
n_layers
,
int32_t
re_offset
);
int32_t
re_offset
);
int
nr_layer_precoder_cm
(
int16_t
**
datatx_F_precoding
,
int
*
prec_matrix
,
uint8_t
n_layers
,
int32_t
re_offset
);
#endif
#endif
This diff is collapsed.
Click to expand it.
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
e993a59d
...
@@ -459,47 +459,38 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
...
@@ -459,47 +459,38 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
}
}
}
}
else
{
else
{
//get the precoding matrix weights:
if
(
frame_parms
->
nb_antennas_tx
==
1
){
//no precoding matrix defined
char
*
W_prec
;
memcpy
((
void
*
)
&
txdataF
[
ap
][
l
*
frame_parms
->
ofdm_symbol_size
+
txdataF_offset
+
k
],
switch
(
frame_parms
->
nb_antennas_tx
)
{
(
void
*
)
&
txdataF_precoding
[
ap
][
2
*
(
l
*
frame_parms
->
ofdm_symbol_size
+
txdataF_offset
+
k
)],
case
1
:
//1 antenna port
NR_NB_SC_PER_RB
*
sizeof
(
int32_t
));
W_prec
=
nr_W_1l_2p
[
pmi
][
ap
];
k
+=
NR_NB_SC_PER_RB
;
break
;
if
(
k
>=
frame_parms
->
ofdm_symbol_size
)
{
case
2
:
//2 antenna ports
if
(
rel15
->
nrOfLayers
==
1
)
//1 layer
W_prec
=
nr_W_1l_2p
[
pmi
][
ap
];
else
//2 layers
W_prec
=
nr_W_2l_2p
[
pmi
][
ap
];
break
;
case
4
:
//4 antenna ports
if
(
rel15
->
nrOfLayers
==
1
)
//1 layer
W_prec
=
nr_W_1l_4p
[
pmi
][
ap
];
else
if
(
rel15
->
nrOfLayers
==
2
)
//2 layers
W_prec
=
nr_W_2l_4p
[
pmi
][
ap
];
else
if
(
rel15
->
nrOfLayers
==
3
)
//3 layers
W_prec
=
nr_W_3l_4p
[
pmi
][
ap
];
else
//4 layers
W_prec
=
nr_W_4l_4p
[
pmi
][
ap
];
break
;
default:
LOG_D
(
PHY
,
"Precoding 1,2, or 4 antenna ports are currently supported
\n
"
);
W_prec
=
nr_W_1l_2p
[
pmi
][
ap
];
break
;
}
for
(
int
i
=
0
;
i
<
NR_NB_SC_PER_RB
;
i
++
)
{
int32_t
re_offset
=
l
*
frame_parms
->
ofdm_symbol_size
+
k
;
int32_t
precodatatx_F
=
nr_layer_precoder
(
txdataF_precoding
,
W_prec
,
rel15
->
nrOfLayers
,
re_offset
+
txdataF_offset
);
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
(
2
*
txdataF_offset
)]
=
((
int16_t
*
)
&
precodatatx_F
)[
0
];
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
1
+
(
2
*
txdataF_offset
)]
=
((
int16_t
*
)
&
precodatatx_F
)[
1
];
#ifdef DEBUG_DLSCH_MAPPING
printf
(
"antenna %d
\t
l %d
\t
k %d
\t
txdataF: %d %d
\n
"
,
ap
,
l
,
k
,
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
(
2
*
txdataF_offset
)],
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
1
+
(
2
*
txdataF_offset
)]);
#endif
if
(
++
k
>=
frame_parms
->
ofdm_symbol_size
)
{
k
-=
frame_parms
->
ofdm_symbol_size
;
k
-=
frame_parms
->
ofdm_symbol_size
;
}
}
}
}
else
{
//get the precoding matrix weights:
int32_t
**
mat
=
gNB
->
nr_mimo_precoding_matrix
[
rel15
->
nrOfLayers
-
1
];
//i_row =0,...,dl_antenna_port
//j_col =0,...,nrOfLayers
//mat[pmi][i_rows*2+j_col]
int
*
W_prec
;
W_prec
=
(
int32_t
*
)
&
mat
[
pmi
][
ap
*
rel15
->
nrOfLayers
];
for
(
int
i
=
0
;
i
<
NR_NB_SC_PER_RB
;
i
++
)
{
int32_t
re_offset
=
l
*
frame_parms
->
ofdm_symbol_size
+
k
;
int32_t
precodatatx_F
=
nr_layer_precoder_cm
(
txdataF_precoding
,
W_prec
,
rel15
->
nrOfLayers
,
re_offset
+
txdataF_offset
);
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
(
2
*
txdataF_offset
)]
=
((
int16_t
*
)
&
precodatatx_F
)[
0
];
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
1
+
(
2
*
txdataF_offset
)]
=
((
int16_t
*
)
&
precodatatx_F
)[
1
];
#ifdef DEBUG_DLSCH_MAPPING
printf
(
"antenna %d
\t
l %d
\t
k %d
\t
txdataF: %d %d
\n
"
,
ap
,
l
,
k
,
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
(
2
*
txdataF_offset
)],
((
int16_t
*
)
txdataF
[
ap
])[(
re_offset
<<
1
)
+
1
+
(
2
*
txdataF_offset
)]);
#endif
if
(
++
k
>=
frame_parms
->
ofdm_symbol_size
)
{
k
-=
frame_parms
->
ofdm_symbol_size
;
}
}
}
}
}
}
//RB loop
}
//RB loop
}
// symbol loop
}
// symbol loop
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/defs_gNB.h
View file @
e993a59d
...
@@ -805,7 +805,7 @@ typedef struct PHY_VARS_gNB_s {
...
@@ -805,7 +805,7 @@ typedef struct PHY_VARS_gNB_s {
uint32_t
****
nr_gold_pdsch_dmrs
;
uint32_t
****
nr_gold_pdsch_dmrs
;
/// PDSCH codebook I precoding LUTs
/// PDSCH codebook I precoding LUTs
int32_t
**
nr_mimo_precoding_matrix
;
int32_t
**
*
nr_mimo_precoding_matrix
;
/// PUSCH DMRS
/// PUSCH DMRS
uint32_t
****
nr_gold_pusch_dmrs
;
uint32_t
****
nr_gold_pusch_dmrs
;
...
...
This diff is collapsed.
Click to expand it.
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
e993a59d
...
@@ -794,6 +794,7 @@ int main(int argc, char **argv)
...
@@ -794,6 +794,7 @@ int main(int argc, char **argv)
// rrc_mac_config_req_gNB
// rrc_mac_config_req_gNB
gNB_mac
->
pre_processor_dl
=
nr_dlsim_preprocessor
;
gNB_mac
->
pre_processor_dl
=
nr_dlsim_preprocessor
;
phy_init_nr_gNB
(
gNB
,
0
,
1
);
phy_init_nr_gNB
(
gNB
,
0
,
1
);
mac_init_codebook_gNB
(
gNB
,
gNB_mac
);
N_RB_DL
=
gNB
->
frame_parms
.
N_RB_DL
;
N_RB_DL
=
gNB
->
frame_parms
.
N_RB_DL
;
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
0
]
->
UE_info
;
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
0
]
->
UE_info
;
UE_info
->
num_UEs
=
1
;
UE_info
->
num_UEs
=
1
;
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/NR/rrc_gNB_reconfig.c
View file @
e993a59d
...
@@ -1156,7 +1156,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
...
@@ -1156,7 +1156,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
csi_MeasConfig
->
csi_ReportConfigToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_ReportConfigToAddModList
));
csi_MeasConfig
->
csi_ReportConfigToAddModList
=
calloc
(
1
,
sizeof
(
*
csi_MeasConfig
->
csi_ReportConfigToAddModList
));
csi_MeasConfig
->
csi_ReportConfigToReleaseList
=
NULL
;
csi_MeasConfig
->
csi_ReportConfigToReleaseList
=
NULL
;
if
(
d
o_csirs
&&
dl_antenna_ports
>
1
)
{
if
(
d
l_antenna_ports
>
1
)
{
/*do_csirs&&*/
NR_CSI_ReportConfig_t
*
csirep1
=
calloc
(
1
,
sizeof
(
*
csirep1
));
NR_CSI_ReportConfig_t
*
csirep1
=
calloc
(
1
,
sizeof
(
*
csirep1
));
csirep1
->
reportConfigId
=
0
;
csirep1
->
reportConfigId
=
0
;
csirep1
->
carrier
=
NULL
;
csirep1
->
carrier
=
NULL
;
...
@@ -1208,8 +1208,19 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
...
@@ -1208,8 +1208,19 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo
;
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo
;
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
=
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
=
calloc
(
1
,
sizeof
(
*
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
));
calloc
(
1
,
sizeof
(
*
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
));
if
(
dl_antenna_ports
==
4
)
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
=
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
=
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction
;
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction
;
else
if
(
dl_antenna_ports
==
8
)
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
=
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction
;
else
if
(
dl_antenna_ports
==
12
)
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
=
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction
;
else
//default
csirep1
->
codebookConfig
->
codebookType
.
choice
.
type1
->
subType
.
choice
.
typeI_SinglePanel
->
nrOfAntennaPorts
.
choice
.
moreThanTwo
->
n1_n2
.
present
=
NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction
;
/*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.size=1;
/*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.size=1;
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.bits_unused=1;
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.bits_unused=1;
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf=malloc(1);
csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf=malloc(1);
...
...
This diff is collapsed.
Click to expand it.
targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
View file @
e993a59d
...
@@ -239,6 +239,8 @@ RUs = (
...
@@ -239,6 +239,8 @@ RUs = (
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
## beamforming 2x2 matrix:
## beamforming 2x2 matrix:
#bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
#bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
## beamforming 2x4 matrix:
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000];
## beamforming 4x4 matrix:
## beamforming 4x4 matrix:
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
sdr_addrs
=
"addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"
;
sdr_addrs
=
"addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"
;
...
...
This diff is collapsed.
Click to expand it.
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