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
常顺宇
OpenXG-RAN
Commits
9a503d98
Commit
9a503d98
authored
4 years ago
by
Raymond Knopp
Committed by
Robert Schmidt
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup after removing harq state in L0
parent
5c62091b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
250 additions
and
354 deletions
+250
-354
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+0
-6
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+1
-1
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+232
-330
openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
+3
-3
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+2
-4
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+11
-9
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+1
-1
No files found.
openair1/PHY/INIT/nr_init.c
View file @
9a503d98
...
@@ -257,9 +257,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
...
@@ -257,9 +257,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
int
N_RB_UL
=
cfg
->
carrier_config
.
ul_grid_size
[
cfg
->
ssb_config
.
scs_common
.
value
].
value
;
int
N_RB_UL
=
cfg
->
carrier_config
.
ul_grid_size
[
cfg
->
ssb_config
.
scs_common
.
value
].
value
;
printf
(
"Before ULSCH init : %p
\n
"
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]);
for
(
int
ULSCH_id
=
0
;
ULSCH_id
<
NUMBER_OF_NR_ULSCH_MAX
;
ULSCH_id
++
)
{
for
(
int
ULSCH_id
=
0
;
ULSCH_id
<
NUMBER_OF_NR_ULSCH_MAX
;
ULSCH_id
++
)
{
printf
(
"ULSCH_id %d : %p
\n
"
,
ULSCH_id
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]);
pusch_vars
[
ULSCH_id
]
=
(
NR_gNB_PUSCH
*
)
malloc16_clear
(
sizeof
(
NR_gNB_PUSCH
)
);
pusch_vars
[
ULSCH_id
]
=
(
NR_gNB_PUSCH
*
)
malloc16_clear
(
sizeof
(
NR_gNB_PUSCH
)
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
)
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
)
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext2
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
)
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext2
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
)
);
...
@@ -276,7 +274,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
...
@@ -276,7 +274,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
pusch_vars
[
ULSCH_id
]
->
ul_ch_magb
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
)
);
pusch_vars
[
ULSCH_id
]
->
ul_ch_magb
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
)
);
pusch_vars
[
ULSCH_id
]
->
rho
=
(
int32_t
**
)
malloc16_clear
(
Prx
*
sizeof
(
int32_t
*
)
);
pusch_vars
[
ULSCH_id
]
->
rho
=
(
int32_t
**
)
malloc16_clear
(
Prx
*
sizeof
(
int32_t
*
)
);
printf
(
"ULSCH_id %d (before rx antenna alloc) : %p
\n
"
,
ULSCH_id
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]);
for
(
i
=
0
;
i
<
Prx
;
i
++
)
{
for
(
i
=
0
;
i
<
Prx
;
i
++
)
{
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
N_RB_UL
*
12
*
fp
->
symbols_per_slot
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
N_RB_UL
*
12
*
fp
->
symbols_per_slot
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext2
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
N_RB_UL
*
12
*
fp
->
symbols_per_slot
);
pusch_vars
[
ULSCH_id
]
->
rxdataF_ext2
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
N_RB_UL
*
12
*
fp
->
symbols_per_slot
);
...
@@ -293,16 +290,13 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
...
@@ -293,16 +290,13 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
pusch_vars
[
ULSCH_id
]
->
ul_ch_magb
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
symbols_per_slot
*
sizeof
(
int32_t
)
*
N_RB_UL
*
12
);
pusch_vars
[
ULSCH_id
]
->
ul_ch_magb
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
symbols_per_slot
*
sizeof
(
int32_t
)
*
N_RB_UL
*
12
);
pusch_vars
[
ULSCH_id
]
->
rho
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
(
fp
->
N_RB_UL
*
12
*
7
*
2
)
);
pusch_vars
[
ULSCH_id
]
->
rho
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
(
fp
->
N_RB_UL
*
12
*
7
*
2
)
);
}
}
printf
(
"ULSCH_id %d (before llr alloc) : %p
\n
"
,
ULSCH_id
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]);
pusch_vars
[
ULSCH_id
]
->
llr
=
(
int16_t
*
)
malloc16_clear
(
(
8
*
((
3
*
8
*
6144
)
+
12
))
*
sizeof
(
int16_t
)
);
// [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
pusch_vars
[
ULSCH_id
]
->
llr
=
(
int16_t
*
)
malloc16_clear
(
(
8
*
((
3
*
8
*
6144
)
+
12
))
*
sizeof
(
int16_t
)
);
// [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
printf
(
"ULSCH_id %d (after llr alloc) : %p
\n
"
,
ULSCH_id
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]);
pusch_vars
[
ULSCH_id
]
->
ul_valid_re_per_slot
=
(
int16_t
*
)
malloc16_clear
(
sizeof
(
int16_t
)
*
fp
->
symbols_per_slot
);
pusch_vars
[
ULSCH_id
]
->
ul_valid_re_per_slot
=
(
int16_t
*
)
malloc16_clear
(
sizeof
(
int16_t
)
*
fp
->
symbols_per_slot
);
}
//ulsch_id
}
//ulsch_id
/*
/*
for (ulsch_id=0; ulsch_id<NUMBER_OF_UE_MAX; ulsch_id++)
for (ulsch_id=0; ulsch_id<NUMBER_OF_UE_MAX; ulsch_id++)
gNB->UE_stats_ptr[ulsch_id] = &gNB->UE_stats[ulsch_id];
gNB->UE_stats_ptr[ulsch_id] = &gNB->UE_stats[ulsch_id];
*/
*/
printf
(
"After ULSCH init : %p
\n
"
,
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]);
return
(
0
);
return
(
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
9a503d98
...
@@ -137,7 +137,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
...
@@ -137,7 +137,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
if
(
dlsch
->
slot_tx
[
slot
]
==
0
)
continue
;
if
(
dlsch
->
slot_tx
[
slot
]
==
0
)
continue
;
int
harq_pid
=
0
;
//dlsch->harq_ids[frame%2][slot];
int
harq_pid
=
0
;
//dlsch->harq_ids[frame%2][slot];
NR_DL_gNB_HARQ_t
*
harq
=
dlsch
->
harq_processes
[
harq_pid
]
;
NR_DL_gNB_HARQ_t
*
harq
=
&
dlsch
->
harq_process
;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
harq
->
pdsch_pdu
.
pdsch_pdu_rel15
;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
harq
->
pdsch_pdu
.
pdsch_pdu_rel15
;
uint32_t
scrambled_output
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
uint32_t
scrambled_output
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
int16_t
**
mod_symbs
=
(
int16_t
**
)
dlsch
->
mod_symbs
;
int16_t
**
mod_symbs
=
(
int16_t
**
)
dlsch
->
mod_symbs
;
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
9a503d98
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
void
free_gNB_dlsch
(
NR_gNB_DLSCH_t
**
dlschptr
,
uint16_t
N_RB
)
void
free_gNB_dlsch
(
NR_gNB_DLSCH_t
**
dlschptr
,
uint16_t
N_RB
)
{
{
int
i
;
int
r
;
int
r
;
NR_gNB_DLSCH_t
*
dlsch
=
*
dlschptr
;
NR_gNB_DLSCH_t
*
dlsch
=
*
dlschptr
;
...
@@ -69,72 +68,61 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
...
@@ -69,72 +68,61 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
#ifdef DEBUG_DLSCH_FREE
#ifdef DEBUG_DLSCH_FREE
LOG_D
(
PHY
,
"Freeing dlsch %p
\n
"
,
dlsch
);
LOG_D
(
PHY
,
"Freeing dlsch %p
\n
"
,
dlsch
);
#endif
#endif
NR_DL_gNB_HARQ_t
*
harq
=&
dlsch
->
harq_process
;
for
(
i
=
0
;
i
<
dlsch
->
Mdlharq
;
i
++
)
{
if
(
harq
->
b
)
{
#ifdef DEBUG_DLSCH_FREE
free16
(
harq
->
b
,
a_segments
*
1056
);
LOG_D
(
PHY
,
"Freeing dlsch process %d
\n
"
,
i
);
harq
->
b
=
NULL
;
#endif
if
(
dlsch
->
harq_processes
[
i
])
{
#ifdef DEBUG_DLSCH_FREE
LOG_D
(
PHY
,
"Freeing dlsch process %d (%p)
\n
"
,
i
,
dlsch
->
harq_processes
[
i
]);
#endif
if
(
dlsch
->
harq_processes
[
i
]
->
b
)
{
free16
(
dlsch
->
harq_processes
[
i
]
->
b
,
a_segments
*
1056
);
dlsch
->
harq_processes
[
i
]
->
b
=
NULL
;
#ifdef DEBUG_DLSCH_FREE
#ifdef DEBUG_DLSCH_FREE
LOG_D
(
PHY
,
"Freeing dlsch process %d b (%p)
\n
"
,
i
,
dlsch
->
harq_processes
[
i
]
->
b
);
LOG_D
(
PHY
,
"Freeing harq->b (%p)
\n
"
,
harq
->
b
);
#endif
#endif
}
if
(
dlsch
->
harq_processes
[
i
]
->
e
)
{
if
(
harq
->
e
)
{
free16
(
dlsch
->
harq_processes
[
i
]
->
e
,
14
*
N_RB
*
12
*
8
);
free16
(
harq
->
e
,
14
*
N_RB
*
12
*
8
);
dlsch
->
harq_processes
[
i
]
->
e
=
NULL
;
harq
->
e
=
NULL
;
#ifdef DEBUG_DLSCH_FREE
#ifdef DEBUG_DLSCH_FREE
printf
(
"Freeing dlsch process %d e (%p)
\n
"
,
i
,
dlsch
->
harq_processes
[
i
]
->
e
);
printf
(
"Freeing dlsch process %d e (%p)
\n
"
,
i
,
harq
->
e
);
#endif
#endif
}
}
if
(
dlsch
->
harq_processes
[
i
]
->
f
)
{
if
(
harq
->
f
)
{
free16
(
dlsch
->
harq_processes
[
i
]
->
f
,
14
*
N_RB
*
12
*
8
);
free16
(
harq
->
f
,
14
*
N_RB
*
12
*
8
);
dlsch
->
harq_processes
[
i
]
->
f
=
NULL
;
harq
->
f
=
NULL
;
#ifdef DEBUG_DLSCH_FREE
#ifdef DEBUG_DLSCH_FREE
printf
(
"Freeing dlsch process %d f (%p)
\n
"
,
i
,
dlsch
->
harq_processes
[
i
]
->
f
);
printf
(
"Freeing dlsch process %d f (%p)
\n
"
,
i
,
harq
->
f
);
#endif
#endif
}
}
#ifdef DEBUG_DLSCH_FREE
#ifdef DEBUG_DLSCH_FREE
LOG_D
(
PHY
,
"Freeing dlsch process %d c (%p)
\n
"
,
i
,
dlsch
->
harq_processes
[
i
]
->
c
);
LOG_D
(
PHY
,
"Freeing dlsch process %d c (%p)
\n
"
,
i
,
harq
->
c
);
#endif
#endif
for
(
r
=
0
;
r
<
a_segments
;
r
++
)
{
for
(
r
=
0
;
r
<
a_segments
;
r
++
)
{
#ifdef DEBUG_DLSCH_FREE
#ifdef DEBUG_DLSCH_FREE
LOG_D
(
PHY
,
"Freeing dlsch process %d c[%d] (%p)
\n
"
,
i
,
r
,
dlsch
->
harq_processes
[
i
]
->
c
[
r
]);
LOG_D
(
PHY
,
"Freeing dlsch process %d c[%d] (%p)
\n
"
,
i
,
r
,
harq
->
c
[
r
]);
#endif
#endif
if
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
])
{
if
(
harq
->
c
[
r
])
{
free16
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
],
1056
);
free16
(
harq
->
c
[
r
],
1056
);
dlsch
->
harq_processes
[
i
]
->
c
[
r
]
=
NULL
;
harq
->
c
[
r
]
=
NULL
;
}
}
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
{
if
(
harq
->
d
[
r
])
{
free16
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
],
3
*
8448
);
free16
(
harq
->
d
[
r
],
3
*
8448
);
dlsch
->
harq_processes
[
i
]
->
d
[
r
]
=
NULL
;
harq
->
d
[
r
]
=
NULL
;
}
}
}
}
free16
(
dlsch
->
harq_processes
[
i
]
,
sizeof
(
NR_DL_gNB_HARQ_t
));
free16
(
harq
,
sizeof
(
NR_DL_gNB_HARQ_t
));
dlsch
->
harq_processes
[
i
]
=
NULL
;
harq
=
NULL
;
}
}
}
}
free16
(
dlsch
,
sizeof
(
NR_gNB_DLSCH_t
));
free16
(
dlsch
,
sizeof
(
NR_gNB_DLSCH_t
));
*
dlschptr
=
NULL
;
*
dlschptr
=
NULL
;
}
}
}
NR_gNB_DLSCH_t
*
new_gNB_dlsch
(
NR_DL_FRAME_PARMS
*
frame_parms
,
NR_gNB_DLSCH_t
*
new_gNB_dlsch
(
NR_DL_FRAME_PARMS
*
frame_parms
,
unsigned
char
Kmimo
,
unsigned
char
Kmimo
,
unsigned
char
Mdlharq
,
unsigned
char
Mdlharq
,
...
@@ -144,7 +132,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -144,7 +132,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
{
{
NR_gNB_DLSCH_t
*
dlsch
;
NR_gNB_DLSCH_t
*
dlsch
;
unsigned
char
exit_flag
=
0
,
i
,
r
,
aa
,
layer
;
unsigned
char
i
,
r
,
aa
,
layer
;
int
re
;
int
re
;
uint16_t
a_segments
=
MAX_NUM_NR_DLSCH_SEGMENTS
;
//number of segments to be allocated
uint16_t
a_segments
=
MAX_NUM_NR_DLSCH_SEGMENTS
;
//number of segments to be allocated
...
@@ -156,9 +144,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -156,9 +144,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
uint16_t
dlsch_bytes
=
a_segments
*
1056
;
// allocated bytes per segment
uint16_t
dlsch_bytes
=
a_segments
*
1056
;
// allocated bytes per segment
dlsch
=
(
NR_gNB_DLSCH_t
*
)
malloc16
(
sizeof
(
NR_gNB_DLSCH_t
)
);
AssertFatal
((
dlsch
=
(
NR_gNB_DLSCH_t
*
)
malloc16
(
sizeof
(
NR_gNB_DLSCH_t
)))
!=
NULL
,
"cannot allocate dlsch
\n
"
);
if
(
dlsch
)
{
bzero
(
dlsch
,
sizeof
(
NR_gNB_DLSCH_t
));
bzero
(
dlsch
,
sizeof
(
NR_gNB_DLSCH_t
));
dlsch
->
Kmimo
=
Kmimo
;
dlsch
->
Kmimo
=
Kmimo
;
dlsch
->
Mdlharq
=
Mdlharq
;
dlsch
->
Mdlharq
=
Mdlharq
;
...
@@ -192,90 +179,32 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -192,90 +179,32 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
dlsch
->
harq_ids
[
1
][
i
]
=
0
;
dlsch
->
harq_ids
[
1
][
i
]
=
0
;
}
}
for
(
i
=
0
;
i
<
Mdlharq
;
i
++
)
{
NR_DL_gNB_HARQ_t
*
harq
=
&
dlsch
->
harq_process
;
dlsch
->
harq_processes
[
i
]
=
(
NR_DL_gNB_HARQ_t
*
)
malloc16
(
sizeof
(
NR_DL_gNB_HARQ_t
));
LOG_T
(
PHY
,
"Required mem size %d dlsch->harq_processes[%d] %p
\n
"
,
bzero
(
harq
,
sizeof
(
NR_DL_gNB_HARQ_t
));
dlsch_bytes
,
i
,
dlsch
->
harq_processes
[
i
]);
AssertFatal
((
harq
->
b
=
(
unsigned
char
*
)
malloc16
(
dlsch_bytes
))
!=
NULL
,
"cannot allocate memory for harq->b
\n
"
);
AssertFatal
((
harq
->
pdu
=
(
uint8_t
*
)
malloc16
(
dlsch_bytes
))
!=
NULL
,
"cannot allocate memory for harq->pdu
\n
"
);
if
(
dlsch
->
harq_processes
[
i
])
{
bzero
(
harq
->
pdu
,
dlsch_bytes
);
bzero
(
dlsch
->
harq_processes
[
i
],
sizeof
(
NR_DL_gNB_HARQ_t
));
nr_emulate_dlsch_payload
(
harq
->
pdu
,
(
dlsch_bytes
)
>>
3
);
// dlsch->harq_processes[i]->first_tx=1;
bzero
(
harq
->
b
,
dlsch_bytes
);
dlsch
->
harq_processes
[
i
]
->
b
=
(
unsigned
char
*
)
malloc16
(
dlsch_bytes
);
dlsch
->
harq_processes
[
i
]
->
pdu
=
(
uint8_t
*
)
malloc16
(
dlsch_bytes
);
if
(
dlsch
->
harq_processes
[
i
]
->
pdu
)
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
pdu
,
dlsch_bytes
);
nr_emulate_dlsch_payload
(
dlsch
->
harq_processes
[
i
]
->
pdu
,
(
dlsch_bytes
)
>>
3
);
}
else
{
LOG_D
(
PHY
,
"Can't allocate PDU
\n
"
);
exit_flag
=
1
;
}
if
(
dlsch
->
harq_processes
[
i
]
->
b
)
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
b
,
dlsch_bytes
);
}
else
{
LOG_D
(
PHY
,
"Can't get b
\n
"
);
exit_flag
=
1
;
}
if
(
abstraction_flag
==
0
)
{
for
(
r
=
0
;
r
<
a_segments
;
r
++
)
{
for
(
r
=
0
;
r
<
a_segments
;
r
++
)
{
// account for filler in first segment and CRCs for multiple segment case
// account for filler in first segment and CRCs for multiple segment case
// [hna] 8448 is the maximum CB size in NR
// [hna] 8448 is the maximum CB size in NR
// 68*348 = 68*(maximum size of Zc)
// 68*348 = 68*(maximum size of Zc)
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
dlsch
->
harq_processes
[
i
]
->
c
[
r
]
=
(
uint8_t
*
)
malloc16
(
8448
);
AssertFatal
((
harq
->
c
[
r
]
=
(
uint8_t
*
)
malloc16
(
8448
))
!=
NULL
,
"cannot allocate harq->c[%d]
\n
"
,
r
);
dlsch
->
harq_processes
[
i
]
->
d
[
r
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
//max size for coded output
AssertFatal
((
harq
->
d
[
r
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
))
!=
NULL
,
"cannot allocate harq->d[%d]
\n
"
,
r
);;
//max size for coded output
if
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
])
{
bzero
(
harq
->
c
[
r
],
8448
);
bzero
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
],
8448
);
bzero
(
harq
->
d
[
r
],(
3
*
8448
));
}
else
{
AssertFatal
((
harq
->
e
=
(
uint8_t
*
)
malloc16
(
14
*
N_RB
*
12
*
8
))
!=
NULL
,
"cannot allocate harq->e
\n
"
);
LOG_D
(
PHY
,
"Can't get c
\n
"
);
bzero
(
harq
->
e
,
14
*
N_RB
*
12
*
8
);
exit_flag
=
2
;
AssertFatal
((
harq
->
f
=
(
uint8_t
*
)
malloc16
(
14
*
N_RB
*
12
*
8
))
!=
NULL
,
"cannot allocate harq->f
\n
"
);
}
bzero
(
harq
->
f
,
14
*
N_RB
*
12
*
8
);
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
],(
3
*
8448
));
}
else
{
LOG_D
(
PHY
,
"Can't get d
\n
"
);
exit_flag
=
2
;
}
}
dlsch
->
harq_processes
[
i
]
->
e
=
(
uint8_t
*
)
malloc16
(
14
*
N_RB
*
12
*
8
);
if
(
dlsch
->
harq_processes
[
i
]
->
e
)
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
e
,
14
*
N_RB
*
12
*
8
);
}
else
{
printf
(
"Can't get e
\n
"
);
exit_flag
=
1
;
}
dlsch
->
harq_processes
[
i
]
->
f
=
(
uint8_t
*
)
malloc16
(
14
*
N_RB
*
12
*
8
);
if
(
dlsch
->
harq_processes
[
i
]
->
f
)
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
f
,
14
*
N_RB
*
12
*
8
);
}
else
{
printf
(
"Can't get f
\n
"
);
exit_flag
=
1
;
}
}
}
else
{
LOG_D
(
PHY
,
"Can't get harq_p %d
\n
"
,
i
);
exit_flag
=
3
;
}
}
if
(
exit_flag
==
0
)
{
for
(
i
=
0
;
i
<
Mdlharq
;
i
++
)
{
dlsch
->
harq_processes
[
i
]
->
round
=
0
;
}
}
return
(
dlsch
);
return
(
dlsch
);
}
}
LOG_D
(
PHY
,
"new_gNB_dlsch exit flag %d, size of %ld
\n
"
,
exit_flag
,
sizeof
(
NR_gNB_DLSCH_t
));
free_gNB_dlsch
(
&
dlsch
,
N_RB
);
return
(
NULL
);
}
}
void
clean_gNB_dlsch
(
NR_gNB_DLSCH_t
*
dlsch
)
void
clean_gNB_dlsch
(
NR_gNB_DLSCH_t
*
dlsch
)
...
@@ -284,28 +213,21 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
...
@@ -284,28 +213,21 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
unsigned
char
Mdlharq
;
unsigned
char
Mdlharq
;
unsigned
char
i
,
j
,
r
;
unsigned
char
i
,
j
,
r
;
if
(
dlsch
)
{
AssertFatal
(
dlsch
!=
NULL
,
"dlsch is null
\n
"
);
Mdlharq
=
dlsch
->
Mdlharq
;
Mdlharq
=
dlsch
->
Mdlharq
;
dlsch
->
rnti
=
0
;
dlsch
->
rnti
=
0
;
dlsch
->
active
=
0
;
dlsch
->
active
=
0
;
NR_DL_gNB_HARQ_t
*
harq
=&
dlsch
->
harq_process
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
for
(
i
=
0
;
i
<
10
;
i
++
)
{
dlsch
->
harq_ids
[
0
][
i
]
=
Mdlharq
;
dlsch
->
harq_ids
[
0
][
i
]
=
Mdlharq
;
dlsch
->
harq_ids
[
1
][
i
]
=
Mdlharq
;
dlsch
->
harq_ids
[
1
][
i
]
=
Mdlharq
;
}
}
for
(
i
=
0
;
i
<
Mdlharq
;
i
++
)
{
for
(
i
=
0
;
i
<
Mdlharq
;
i
++
)
{
if
(
dlsch
->
harq_processes
[
i
])
{
// dlsch->harq_processes[i]->Ndi = 0;
//dlsch->harq_processes[i]->status = 0;
dlsch
->
harq_processes
[
i
]
->
round
=
0
;
for
(
j
=
0
;
j
<
96
;
j
++
)
for
(
j
=
0
;
j
<
96
;
j
++
)
for
(
r
=
0
;
r
<
MAX_NUM_NR_DLSCH_SEGMENTS
;
r
++
)
for
(
r
=
0
;
r
<
MAX_NUM_NR_DLSCH_SEGMENTS
;
r
++
)
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
if
(
harq
->
d
[
r
])
dlsch
->
harq_processes
[
i
]
->
d
[
r
][
j
]
=
NR_NULL
;
harq
->
d
[
r
][
j
]
=
NR_NULL
;
}
}
}
}
}
}
...
@@ -322,13 +244,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -322,13 +244,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned
int
G
;
unsigned
int
G
;
unsigned
int
crc
=
1
;
unsigned
int
crc
=
1
;
uint8_t
harq_pid
=
0
;
//dlsch->harq_ids[frame%2][slot];
NR_DL_gNB_HARQ_t
*
harq
=&
dlsch
->
harq_process
;
AssertFatal
(
harq_pid
<
8
&&
harq_pid
>=
0
,
"illegal harq_pid %d
\b
"
,
harq_pid
);
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
harq
->
pdsch_pdu
.
pdsch_pdu_rel15
;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
dlsch
->
harq_processes
[
harq_pid
]
->
pdsch_pdu
.
pdsch_pdu_rel15
;
uint16_t
nb_rb
=
rel15
->
rbSize
;
uint16_t
nb_rb
=
rel15
->
rbSize
;
uint8_t
nb_symb_sch
=
rel15
->
NrOfSymbols
;
uint8_t
nb_symb_sch
=
rel15
->
NrOfSymbols
;
uint32_t
A
,
Kb
,
F
=
0
;
uint32_t
A
,
Kb
,
F
=
0
;
uint32_t
*
Zc
=
&
dlsch
->
harq_process
es
[
harq_pid
]
->
Z
;
uint32_t
*
Zc
=
&
dlsch
->
harq_process
.
Z
;
uint8_t
mod_order
=
rel15
->
qamModOrder
[
0
];
uint8_t
mod_order
=
rel15
->
qamModOrder
[
0
];
uint16_t
Kr
=
0
,
r
;
uint16_t
Kr
=
0
,
r
;
uint32_t
r_offset
=
0
;
uint32_t
r_offset
=
0
;
...
@@ -347,7 +268,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -347,7 +268,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
float
Coderate
=
0
.
0
;
float
Coderate
=
0
.
0
;
uint8_t
Nl
=
4
;
uint8_t
Nl
=
4
;
dlsch
->
harq_processes
[
harq_pid
]
->
round
=
0
;
// regenerate all code segments every round. was nr_rv_round_map[rel15->rvIndex[0]];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING
,
VCD_FUNCTION_IN
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING
,
VCD_FUNCTION_IN
);
...
@@ -367,31 +287,15 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -367,31 +287,15 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
}
}
if
(
stats
)
{
if
(
stats
)
{
// stats->round_trials[dlsch->harq_processes[harq_pid]->round]++;
stats
->
rnti
=
dlsch
->
rnti
;
stats
->
rnti
=
dlsch
->
rnti
;
//if (dlsch->harq_processes[harq_pid]->round == 0){
stats
->
total_bytes_tx
+=
rel15
->
TBSize
[
0
];
stats
->
total_bytes_tx
+=
rel15
->
TBSize
[
0
];
stats
->
current_RI
=
rel15
->
nrOfLayers
;
stats
->
current_RI
=
rel15
->
nrOfLayers
;
stats
->
current_Qm
=
rel15
->
qamModOrder
[
0
];
stats
->
current_Qm
=
rel15
->
qamModOrder
[
0
];
//}
}
}
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
rel15
->
nrOfLayers
);
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
rel15
->
nrOfLayers
);
LOG_D
(
PHY
,
"dlsch coding A %d G %d mod_order %d
\n
"
,
A
,
G
,
mod_order
);
LOG_D
(
PHY
,
"dlsch coding A %d G %d mod_order %d
\n
"
,
A
,
G
,
mod_order
);
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
if
(
1
)
{
//dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
#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\n",a[i]);
LOG_D(PHY,"\n");
*/
if
(
A
>
3824
)
{
if
(
A
>
3824
)
{
// Add 24-bit crc (polynomial A) to payload
// Add 24-bit crc (polynomial A) to payload
crc
=
crc24a
(
a
,
A
)
>>
8
;
crc
=
crc24a
(
a
,
A
)
>>
8
;
...
@@ -401,12 +305,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -401,12 +305,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
//printf("CRC %x (A %d)\n",crc,A);
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
dlsch
->
harq_processes
[
harq_pid
]
->
B
=
A
+
24
;
harq
->
B
=
A
+
24
;
// dlsch->harq_processes[harq_pid]
->b = a;
// harq
->b = a;
AssertFatal
((
A
/
8
)
+
4
<=
MAX_NR_DLSCH_PAYLOAD_BYTES
,
"A %d is too big (A/8+4 = %d > %d)
\n
"
,
A
,(
A
/
8
)
+
4
,
MAX_NR_DLSCH_PAYLOAD_BYTES
);
AssertFatal
((
A
/
8
)
+
4
<=
MAX_NR_DLSCH_PAYLOAD_BYTES
,
"A %d is too big (A/8+4 = %d > %d)
\n
"
,
A
,(
A
/
8
)
+
4
,
MAX_NR_DLSCH_PAYLOAD_BYTES
);
memcpy
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
a
,(
A
/
8
)
+
4
);
// why is this +4 if the CRC is only 3 bytes?
memcpy
(
harq
->
b
,
a
,(
A
/
8
)
+
4
);
// why is this +4 if the CRC is only 3 bytes?
}
}
else
{
else
{
// Add 16-bit crc (polynomial A) to payload
// Add 16-bit crc (polynomial A) to payload
...
@@ -416,12 +320,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -416,12 +320,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
//printf("CRC %x (A %d)\n",crc,A);
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
dlsch
->
harq_processes
[
harq_pid
]
->
B
=
A
+
16
;
harq
->
B
=
A
+
16
;
// dlsch->harq_processes[harq_pid]
->b = a;
// harq
->b = a;
AssertFatal
((
A
/
8
)
+
3
<=
MAX_NR_DLSCH_PAYLOAD_BYTES
,
"A %d is too big (A/8+3 = %d > %d)
\n
"
,
A
,(
A
/
8
)
+
3
,
MAX_NR_DLSCH_PAYLOAD_BYTES
);
AssertFatal
((
A
/
8
)
+
3
<=
MAX_NR_DLSCH_PAYLOAD_BYTES
,
"A %d is too big (A/8+3 = %d > %d)
\n
"
,
A
,(
A
/
8
)
+
3
,
MAX_NR_DLSCH_PAYLOAD_BYTES
);
memcpy
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
a
,(
A
/
8
)
+
3
);
// using 3 bytes to mimic the case of 24 bit crc
memcpy
(
harq
->
b
,
a
,(
A
/
8
)
+
3
);
// using 3 bytes to mimic the case of 24 bit crc
}
}
if
(
R
<
1000
)
if
(
R
<
1000
)
Coderate
=
(
float
)
R
/
(
float
)
1024
;
Coderate
=
(
float
)
R
/
(
float
)
1024
;
...
@@ -429,77 +333,75 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -429,77 +333,75 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
Coderate
=
(
float
)
R
/
(
float
)
2048
;
Coderate
=
(
float
)
R
/
(
float
)
2048
;
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
)
if
((
A
<=
292
)
||
((
A
<=
3824
)
&&
(
Coderate
<=
0
.
6667
))
||
Coderate
<=
0
.
25
)
dlsch
->
harq_processes
[
harq_pid
]
->
BG
=
2
;
harq
->
BG
=
2
;
else
else
dlsch
->
harq_processes
[
harq_pid
]
->
BG
=
1
;
harq
->
BG
=
1
;
start_meas
(
dlsch_segmentation_stats
);
start_meas
(
dlsch_segmentation_stats
);
Kb
=
nr_segmentation
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
Kb
=
nr_segmentation
(
harq
->
b
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
harq
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
harq
->
B
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
&
harq
->
C
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
K
,
&
harq
->
K
,
Zc
,
Zc
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
F
,
&
harq
->
F
,
dlsch
->
harq_processes
[
harq_pid
]
->
BG
);
harq
->
BG
);
stop_meas
(
dlsch_segmentation_stats
);
stop_meas
(
dlsch_segmentation_stats
);
F
=
dlsch
->
harq_processes
[
harq_pid
]
->
F
;
F
=
harq
->
F
;
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
;
Kr
=
harq
->
K
;
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
uint16_t
Kr_bytes
;
uint16_t
Kr_bytes
;
Kr_bytes
=
Kr
>>
3
;
Kr_bytes
=
Kr
>>
3
;
#endif
#endif
//printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,dlsch->harq_processes[harq_pid]->K,Kr,BG,dlsch->harq_processes[harq_pid]
->C);
//printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,harq->K,Kr,BG,harq
->C);
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
for
(
r
=
0
;
r
<
harq
->
C
;
r
++
)
{
//d_tmp[r] = &dlsch->harq_processes[harq_pid]
->d[r][0];
//d_tmp[r] = &harq
->d[r][0];
//channel_input[r] = &dlsch->harq_processes[harq_pid]
->d[r][0];
//channel_input[r] = &harq
->d[r][0];
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
LOG_D
(
PHY
,
"Encoder: B %d F %d
\n
"
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
dlsch
->
harq_processes
[
harq_pid
]
->
F
);
LOG_D
(
PHY
,
"Encoder: B %d F %d
\n
"
,
harq
->
B
,
harq
->
F
);
LOG_D
(
PHY
,
"start ldpc encoder segment %d/%d
\n
"
,
r
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
);
LOG_D
(
PHY
,
"start ldpc encoder segment %d/%d
\n
"
,
r
,
harq
->
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
]);
LOG_D
(
PHY
,
"input %d %d %d %d %d
\n
"
,
harq
->
c
[
r
][
0
],
harq
->
c
[
r
][
1
],
harq
->
c
[
r
][
2
],
harq
->
c
[
r
][
3
],
harq
->
c
[
r
][
4
]);
for
(
int
cnt
=
0
;
cnt
<
22
*
(
*
Zc
)
/
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
,
"%d "
,
harq
->
c
[
r
][
cnt
]);
}
}
LOG_D
(
PHY
,
"
\n
"
);
LOG_D
(
PHY
,
"
\n
"
);
#endif
#endif
//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_orig((unsigned char*)harq->c[r],harq
->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);
//ldpc_encoder_optim((unsigned char*)harq->c[r],(unsigned char*)&harq
->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL);
}
}
encoder_implemparams_t
impp
;
encoder_implemparams_t
impp
;
impp
.
n_segments
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
impp
.
n_segments
=
harq
->
C
;
impp
.
tprep
=
tprep
;
impp
.
tprep
=
tprep
;
impp
.
tinput
=
tinput
;
impp
.
tinput
=
tinput
;
impp
.
tparity
=
tparity
;
impp
.
tparity
=
tparity
;
impp
.
toutput
=
toutput
;
impp
.
toutput
=
toutput
;
for
(
int
j
=
0
;
j
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
8
+
1
);
j
++
)
{
for
(
int
j
=
0
;
j
<
(
harq
->
C
/
8
+
1
);
j
++
)
{
impp
.
macro_num
=
j
;
impp
.
macro_num
=
j
;
nrLDPC_encoder
(
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
d
,
*
Zc
,
Kb
,
Kr
,
dlsch
->
harq_processes
[
harq_pid
]
->
BG
,
&
impp
);
nrLDPC_encoder
(
harq
->
c
,
harq
->
d
,
*
Zc
,
Kb
,
Kr
,
harq
->
BG
,
&
impp
);
}
}
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
write_output
(
"enc_input0.m"
,
"enc_in0"
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
0
][
0
],
Kr_bytes
,
1
,
4
);
write_output
(
"enc_input0.m"
,
"enc_in0"
,
&
harq
->
c
[
0
][
0
],
Kr_bytes
,
1
,
4
);
write_output
(
"enc_output0.m"
,
"enc0"
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
4
);
write_output
(
"enc_output0.m"
,
"enc0"
,
&
harq
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
4
);
#endif
#endif
}
F
=
harq
->
F
;
F
=
dlsch
->
harq_processes
[
harq_pid
]
->
F
;
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
;
Kr
=
harq
->
K
;
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
for
(
r
=
0
;
r
<
harq
->
C
;
r
++
)
{
if
(
F
>
0
)
{
if
(
F
>
0
)
{
for
(
int
k
=
(
Kr
-
F
-
2
*
(
*
Zc
));
k
<
Kr
-
2
*
(
*
Zc
);
k
++
)
{
for
(
int
k
=
(
Kr
-
F
-
2
*
(
*
Zc
));
k
<
Kr
-
2
*
(
*
Zc
);
k
++
)
{
// writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212
// writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
][
k
]
=
NR_NULL
;
harq
->
d
[
r
][
k
]
=
NR_NULL
;
//if (k<(Kr-F+8))
//if (k<(Kr-F+8))
//printf("r %d filler bits [%d] = %d \n", r,k,
dlsch->harq_processes[harq_pid]
->d[r][k]);
//printf("r %d filler bits [%d] = %d \n", r,k,
harq
->d[r][k]);
}
}
}
}
...
@@ -509,12 +411,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -509,12 +411,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
LOG_D
(
PHY
,
"rvidx in encoding = %d
\n
"
,
rel15
->
rvIndex
[
0
]);
LOG_D
(
PHY
,
"rvidx in encoding = %d
\n
"
,
rel15
->
rvIndex
[
0
]);
#endif
#endif
E
=
nr_get_E
(
G
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
mod_order
,
rel15
->
nrOfLayers
,
r
);
E
=
nr_get_E
(
G
,
harq
->
C
,
mod_order
,
rel15
->
nrOfLayers
,
r
);
//#ifdef DEBUG_DLSCH_CODING
//#ifdef DEBUG_DLSCH_CODING
LOG_D
(
PHY
,
"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
"
,
LOG_D
(
PHY
,
"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
,
r
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
harq
->
C
,
G
,
G
,
E
,
E
,
F
,
F
,
...
@@ -530,11 +432,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -530,11 +432,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
start_meas
(
dlsch_rate_matching_stats
);
start_meas
(
dlsch_rate_matching_stats
);
nr_rate_matching_ldpc
(
Ilbrm
,
nr_rate_matching_ldpc
(
Ilbrm
,
Tbslbrm
,
Tbslbrm
,
dlsch
->
harq_processes
[
harq_pid
]
->
BG
,
harq
->
BG
,
*
Zc
,
*
Zc
,
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
],
harq
->
d
[
r
],
dlsch
->
harq_processes
[
harq_pid
]
->
e
+
r_offset
,
harq
->
e
+
r_offset
,
dlsch
->
harq_processes
[
harq_pid
]
->
C
,
harq
->
C
,
F
,
F
,
Kr
-
F
-
2
*
(
*
Zc
),
Kr
-
F
-
2
*
(
*
Zc
),
rel15
->
rvIndex
[
0
],
rel15
->
rvIndex
[
0
],
...
@@ -542,22 +444,22 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
...
@@ -542,22 +444,22 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
stop_meas
(
dlsch_rate_matching_stats
);
stop_meas
(
dlsch_rate_matching_stats
);
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"output ratematching e[%d]= %d r_offset %u
\n
"
,
i
,
dlsch
->
harq_processes
[
harq_pid
]
->
e
[
i
+
r_offset
],
r_offset
);
printf
(
"output ratematching e[%d]= %d r_offset %u
\n
"
,
i
,
harq
->
e
[
i
+
r_offset
],
r_offset
);
#endif
#endif
start_meas
(
dlsch_interleaving_stats
);
start_meas
(
dlsch_interleaving_stats
);
nr_interleaving_ldpc
(
E
,
nr_interleaving_ldpc
(
E
,
mod_order
,
mod_order
,
dlsch
->
harq_processes
[
harq_pid
]
->
e
+
r_offset
,
harq
->
e
+
r_offset
,
dlsch
->
harq_processes
[
harq_pid
]
->
f
+
r_offset
);
harq
->
f
+
r_offset
);
stop_meas
(
dlsch_interleaving_stats
);
stop_meas
(
dlsch_interleaving_stats
);
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"output interleaving f[%d]= %d r_offset %u
\n
"
,
i
,
dlsch
->
harq_processes
[
harq_pid
]
->
f
[
i
+
r_offset
],
r_offset
);
printf
(
"output interleaving f[%d]= %d r_offset %u
\n
"
,
i
,
harq
->
f
[
i
+
r_offset
],
r_offset
);
if
(
r
==
dlsch
->
harq_processes
[
harq_pid
]
->
C
-
1
)
if
(
r
==
harq
->
C
-
1
)
write_output
(
"enc_output.m"
,
"enc"
,
dlsch
->
harq_processes
[
harq_pid
]
->
f
,
G
,
1
,
4
);
write_output
(
"enc_output.m"
,
"enc"
,
harq
->
f
,
G
,
1
,
4
);
#endif
#endif
r_offset
+=
E
;
r_offset
+=
E
;
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c
View file @
9a503d98
...
@@ -289,12 +289,12 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
...
@@ -289,12 +289,12 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
AssertFatal
(
(
dlsch_id
>=
0
)
&&
(
dlsch_id
<
NUMBER_OF_NR_DLSCH_MAX
),
AssertFatal
(
(
dlsch_id
>=
0
)
&&
(
dlsch_id
<
NUMBER_OF_NR_DLSCH_MAX
),
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d
\n
"
,
rel15
->
rnti
,
dlsch_id
);
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d
\n
"
,
rel15
->
rnti
,
dlsch_id
);
NR_gNB_DLSCH_t
*
dlsch
=
gNB
->
dlsch
[
dlsch_id
][
0
];
NR_gNB_DLSCH_t
*
dlsch
=
gNB
->
dlsch
[
dlsch_id
][
0
];
NR_DL_gNB_HARQ_t
*
*
harq
=
dlsch
->
harq_processe
s
;
NR_DL_gNB_HARQ_t
*
harq
=
&
dlsch
->
harq_proces
s
;
/// DLSCH struct
/// DLSCH struct
memcpy
((
void
*
)
&
harq
[
0
/*dlsch->harq_ids[frame%2][slot]*/
]
->
pdsch_pdu
,
(
void
*
)
pdsch_pdu
,
sizeof
(
nfapi_nr_dl_tti_pdsch_pdu
));
memcpy
((
void
*
)
&
harq
->
pdsch_pdu
,
(
void
*
)
pdsch_pdu
,
sizeof
(
nfapi_nr_dl_tti_pdsch_pdu
));
gNB
->
num_pdsch_rnti
[
slot
]
++
;
gNB
->
num_pdsch_rnti
[
slot
]
++
;
AssertFatal
(
sdu
!=
NULL
,
"sdu is null
\n
"
);
AssertFatal
(
sdu
!=
NULL
,
"sdu is null
\n
"
);
harq
[
0
/*dlsch->harq_ids[frame%2][slot]*/
]
->
pdu
=
sdu
;
harq
->
pdu
=
sdu
;
}
}
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/defs_gNB.h
View file @
9a503d98
...
@@ -94,8 +94,6 @@ typedef struct {
...
@@ -94,8 +94,6 @@ typedef struct {
uint32_t
frame
;
uint32_t
frame
;
/// Subframe where current HARQ round was sent
/// Subframe where current HARQ round was sent
uint32_t
subframe
;
uint32_t
subframe
;
/// Index of current HARQ round for this DLSCH
uint8_t
round
;
/// MIMO mode for this DLSCH
/// MIMO mode for this DLSCH
MIMO_mode_t
mimo_mode
;
MIMO_mode_t
mimo_mode
;
/// Concatenated sequences
/// Concatenated sequences
...
@@ -138,8 +136,8 @@ typedef struct {
...
@@ -138,8 +136,8 @@ typedef struct {
}
NR_gNB_SCH_STATS_t
;
}
NR_gNB_SCH_STATS_t
;
typedef
struct
{
typedef
struct
{
/// Pointers to
16 HARQ processes for the DLSCH
/// Pointers to
variables related to DLSCH harq process
NR_DL_gNB_HARQ_t
*
harq_processes
[
NR_MAX_NB_HARQ_PROCESSES
]
;
NR_DL_gNB_HARQ_t
harq_process
;
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t
*
txdataF
[
NR_MAX_NB_LAYERS
];
int32_t
*
txdataF
[
NR_MAX_NB_LAYERS
];
/// Modulated symbols buffer
/// Modulated symbols buffer
...
...
This diff is collapsed.
Click to expand it.
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
9a503d98
...
@@ -632,6 +632,9 @@ int main(int argc, char **argv)
...
@@ -632,6 +632,9 @@ int main(int argc, char **argv)
rrc_mac_config_req_gNB
(
0
,
0
,
1
,
pusch_tgt_snrx10
,
pucch_tgt_snrx10
,
NULL
,
1
,
secondaryCellGroup
->
spCellConfig
->
reconfigurationWithSync
->
newUE_Identity
,
secondaryCellGroup
);
rrc_mac_config_req_gNB
(
0
,
0
,
1
,
pusch_tgt_snrx10
,
pucch_tgt_snrx10
,
NULL
,
1
,
secondaryCellGroup
->
spCellConfig
->
reconfigurationWithSync
->
newUE_Identity
,
secondaryCellGroup
);
phy_init_nr_gNB
(
gNB
,
0
,
0
);
phy_init_nr_gNB
(
gNB
,
0
,
0
);
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
;
UE_info
->
num_UEs
=
1
;
// stub to configure frame_parms
// stub to configure frame_parms
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
// call MAC to configure common parameters
// call MAC to configure common parameters
...
@@ -797,10 +800,10 @@ int main(int argc, char **argv)
...
@@ -797,10 +800,10 @@ int main(int argc, char **argv)
scheduled_response
.
thread_id
=
UE_proc
.
thread_id
;
scheduled_response
.
thread_id
=
UE_proc
.
thread_id
;
nr_ue_phy_config_request
(
&
UE_mac
->
phy_config
);
nr_ue_phy_config_request
(
&
UE_mac
->
phy_config
);
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
0
]
->
UE_info
;
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
snrRun
=
0
;
snrRun
=
0
;
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
.
2
)
{
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
.
2
)
{
varArray_t
*
table_tx
=
initVarArray
(
1000
,
sizeof
(
double
));
varArray_t
*
table_tx
=
initVarArray
(
1000
,
sizeof
(
double
));
...
@@ -846,7 +849,7 @@ int main(int argc, char **argv)
...
@@ -846,7 +849,7 @@ int main(int argc, char **argv)
NR_DL_UE_HARQ_t
*
UE_harq_process
=
dlsch0
->
harq_processes
[
harq_pid
];
NR_DL_UE_HARQ_t
*
UE_harq_process
=
dlsch0
->
harq_processes
[
harq_pid
];
NR_gNB_DLSCH_t
*
gNB_dlsch
=
gNB
->
dlsch
[
0
][
0
];
NR_gNB_DLSCH_t
*
gNB_dlsch
=
gNB
->
dlsch
[
0
][
0
];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
gNB_dlsch
->
harq_process
es
[
slot
]
->
pdsch_pdu
.
pdsch_pdu_rel15
;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t
*
rel15
=
&
gNB_dlsch
->
harq_process
.
pdsch_pdu
.
pdsch_pdu_rel15
;
UE_harq_process
->
harq_ack
.
ack
=
0
;
UE_harq_process
->
harq_ack
.
ack
=
0
;
round
=
0
;
round
=
0
;
...
@@ -862,7 +865,6 @@ int main(int argc, char **argv)
...
@@ -862,7 +865,6 @@ int main(int argc, char **argv)
UE_info
->
UE_sched_ctrl
[
0
].
harq_processes
[
harq_pid
].
round
=
round
;
UE_info
->
UE_sched_ctrl
[
0
].
harq_processes
[
harq_pid
].
round
=
round
;
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
harq_pid
]
->
round
=
round
;
for
(
int
i
=
0
;
i
<
MAX_NUM_CORESET
;
i
++
)
for
(
int
i
=
0
;
i
<
MAX_NUM_CORESET
;
i
++
)
gNB_mac
->
UE_info
.
num_pdcch_cand
[
0
][
i
]
=
0
;
gNB_mac
->
UE_info
.
num_pdcch_cand
[
0
][
i
]
=
0
;
...
@@ -1011,8 +1013,8 @@ int main(int argc, char **argv)
...
@@ -1011,8 +1013,8 @@ int main(int argc, char **argv)
for
(
i
=
0
;
i
<
available_bits
;
i
++
)
{
for
(
i
=
0
;
i
<
available_bits
;
i
++
)
{
if
(((
gNB_dlsch
->
harq_process
es
[
harq_pid
]
->
f
[
i
]
==
0
)
&&
(
UE_llr
[
i
]
<=
0
))
||
if
(((
gNB_dlsch
->
harq_process
.
f
[
i
]
==
0
)
&&
(
UE_llr
[
i
]
<=
0
))
||
((
gNB_dlsch
->
harq_process
es
[
harq_pid
]
->
f
[
i
]
==
1
)
&&
(
UE_llr
[
i
]
>=
0
)))
((
gNB_dlsch
->
harq_process
.
f
[
i
]
==
1
)
&&
(
UE_llr
[
i
]
>=
0
)))
{
{
if
(
errors_scrambling
==
0
)
{
if
(
errors_scrambling
==
0
)
{
LOG_D
(
PHY
,
"
\n
"
);
LOG_D
(
PHY
,
"
\n
"
);
...
@@ -1025,7 +1027,7 @@ int main(int argc, char **argv)
...
@@ -1025,7 +1027,7 @@ int main(int argc, char **argv)
for
(
i
=
0
;
i
<
TBS
;
i
++
)
{
for
(
i
=
0
;
i
<
TBS
;
i
++
)
{
estimated_output_bit
[
i
]
=
(
UE_harq_process
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
estimated_output_bit
[
i
]
=
(
UE_harq_process
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
test_input_bit
[
i
]
=
(
gNB_dlsch
->
harq_process
es
[
harq_pid
]
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
// Further correct for multiple segments
test_input_bit
[
i
]
=
(
gNB_dlsch
->
harq_process
.
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
// Further correct for multiple segments
if
(
estimated_output_bit
[
i
]
!=
test_input_bit
[
i
])
{
if
(
estimated_output_bit
[
i
]
!=
test_input_bit
[
i
])
{
if
(
errors_bit
==
0
)
if
(
errors_bit
==
0
)
...
@@ -1065,9 +1067,9 @@ int main(int argc, char **argv)
...
@@ -1065,9 +1067,9 @@ int main(int argc, char **argv)
if
(
print_perf
==
1
)
{
if
(
print_perf
==
1
)
{
printf
(
"
\n
gNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))
\n
"
,
printf
(
"
\n
gNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))
\n
"
,
1000
>>*
scc
->
ssbSubcarrierSpacing
,
g_rbSize
,
g_mcsIndex
,
1000
>>*
scc
->
ssbSubcarrierSpacing
,
g_rbSize
,
g_mcsIndex
,
gNB
->
dlsch
[
0
][
0
]
->
harq_process
es
[
0
]
->
pdsch_pdu
.
pdsch_pdu_rel15
.
TBSize
[
0
]
<<
3
,
gNB
->
dlsch
[
0
][
0
]
->
harq_process
.
pdsch_pdu
.
pdsch_pdu_rel15
.
TBSize
[
0
]
<<
3
,
gNB
->
dlsch
[
0
][
0
]
->
harq_process
es
[
0
]
->
K
,
gNB
->
dlsch
[
0
][
0
]
->
harq_process
.
K
,
gNB
->
dlsch
[
0
][
0
]
->
harq_process
es
[
0
]
->
K
/
((
gNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
pdsch_pdu
.
pdsch_pdu_rel15
.
TBSize
[
0
]
<<
3
)
>
3824
?
22
:
10
));
gNB
->
dlsch
[
0
][
0
]
->
harq_process
.
K
/
((
gNB
->
dlsch
[
0
][
0
]
->
harq_process
.
pdsch_pdu
.
pdsch_pdu_rel15
.
TBSize
[
0
]
<<
3
)
>
3824
?
22
:
10
));
printDistribution
(
&
gNB
->
phy_proc_tx
,
table_tx
,
"PHY proc tx"
);
printDistribution
(
&
gNB
->
phy_proc_tx
,
table_tx
,
"PHY proc tx"
);
printStatIndent2
(
&
gNB
->
dlsch_encoding_stats
,
"DLSCH encoding time"
);
printStatIndent2
(
&
gNB
->
dlsch_encoding_stats
,
"DLSCH encoding time"
);
printStatIndent3
(
&
gNB
->
dlsch_segmentation_stats
,
"DLSCH segmentation time"
);
printStatIndent3
(
&
gNB
->
dlsch_segmentation_stats
,
"DLSCH segmentation time"
);
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
9a503d98
...
@@ -1577,7 +1577,7 @@ int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) {
...
@@ -1577,7 +1577,7 @@ int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) {
int
add_new_nr_ue
(
module_id_t
mod_idP
,
rnti_t
rntiP
,
NR_CellGroupConfig_t
*
secondaryCellGroup
)
int
add_new_nr_ue
(
module_id_t
mod_idP
,
rnti_t
rntiP
,
NR_CellGroupConfig_t
*
secondaryCellGroup
)
{
{
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
mod_idP
]
->
UE_info
;
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
mod_idP
]
->
UE_info
;
LOG_
W
(
MAC
,
"[gNB %d] Adding UE with rnti %x (num_UEs %d)
\n
"
,
LOG_
I
(
MAC
,
"[gNB %d] Adding UE with rnti %x (num_UEs %d)
\n
"
,
mod_idP
,
mod_idP
,
rntiP
,
rntiP
,
UE_info
->
num_UEs
);
UE_info
->
num_UEs
);
...
...
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