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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG-RAN
Commits
fc52fb8d
Commit
fc52fb8d
authored
Sep 16, 2024
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compute_tbs_common formatting
parent
d791d03e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
47 deletions
+36
-47
openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c
openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c
+36
-47
No files found.
openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c
View file @
fc52fb8d
...
@@ -63,95 +63,84 @@ uint32_t nr_compute_tbs(uint16_t Qm,
...
@@ -63,95 +63,84 @@ uint32_t nr_compute_tbs(uint16_t Qm,
const
uint32_t
nb_re
=
min
(
156
,
nbp_re
)
*
nb_rb
;
const
uint32_t
nb_re
=
min
(
156
,
nbp_re
)
*
nb_rb
;
// Intermediate number of information bits
// Intermediate number of information bits
// Rx1024 is tabulated as 10 times the actual code rate
// Rx1024 is tabulated as 10 times the actual code rate
const
uint32_t
R_5
=
R
/
5
;
// R can be fractional so we can't divide by 10
const
uint32_t
R_5
=
R
/
5
;
// R can be fractional so we can't divide by 10
// So we ned to right shift by 11 (10 for x1024 and 1 additional as above)
// So we ned to right shift by 11 (10 for x1024 and 1 additional as above)
const
uint32_t
Ninfo
=
((
nb_re
*
R_5
*
Qm
*
Nl
)
>>
11
)
>>
tb_scaling
;
const
uint32_t
Ninfo
=
((
nb_re
*
R_5
*
Qm
*
Nl
)
>>
11
)
>>
tb_scaling
;
uint32_t
nr_tbs
=
0
;
uint32_t
nr_tbs
=
0
;
uint32_t
Np_info
,
C
,
n
;
uint32_t
Np_info
,
C
,
n
;
if
(
Ninfo
<=
NR_MAX_PDSCH_TBS
)
{
if
(
Ninfo
<=
NR_MAX_PDSCH_TBS
)
{
n
=
max
(
3
,
floor
(
log2
(
Ninfo
))
-
6
);
n
=
max
(
3
,
floor
(
log2
(
Ninfo
))
-
6
);
Np_info
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
Np_info
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
for
(
int
i
=
0
;
i
<
INDEX_MAX_TBS_TABLE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
INDEX_MAX_TBS_TABLE
;
i
++
)
{
if
(
Tbstable_nr
[
i
]
>=
Np_info
){
if
(
Tbstable_nr
[
i
]
>=
Np_info
){
nr_tbs
=
Tbstable_nr
[
i
];
nr_tbs
=
Tbstable_nr
[
i
];
break
;
break
;
}
}
}
}
}
else
{
}
else
{
n
=
log2
(
Ninfo
-
24
)
-
5
;
n
=
log2
(
Ninfo
-
24
)
-
5
;
Np_info
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),(
1
<<
n
)))
<<
n
);
Np_info
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),
(
1
<<
n
)))
<<
n
);
if
(
R
<=
2560
)
{
if
(
R
<=
2560
)
{
C
=
CEILIDIV
((
Np_info
+
24
),
3816
);
C
=
CEILIDIV
((
Np_info
+
24
),
3816
);
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),
(
C
<<
3
))
-
24
;
}
else
{
}
else
{
if
(
Np_info
>
8424
){
if
(
Np_info
>
8424
){
C
=
CEILIDIV
((
Np_info
+
24
),
8424
);
C
=
CEILIDIV
((
Np_info
+
24
),
8424
);
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),
(
C
<<
3
))
-
24
;
}
else
{
}
else
{
nr_tbs
=
((
CEILIDIV
((
Np_info
+
24
),
8
))
<<
3
)
-
24
;
nr_tbs
=
((
CEILIDIV
((
Np_info
+
24
),
8
))
<<
3
)
-
24
;
}
}
}
}
}
}
LOG_D
(
NR_MAC
,
"Ninfo %u nbp_re %d nb_re %d Qm %d, R %d, tbs %d bits
\n
"
,
Ninfo
,
nbp_re
,
nb_re
,
Qm
,
R
,
nr_tbs
);
LOG_D
(
NR_MAC
,
"Ninfo %u nbp_re %d nb_re %d Qm %d, R %d, tbs %d bits
\n
"
,
Ninfo
,
nbp_re
,
nb_re
,
Qm
,
R
,
nr_tbs
);
return
nr_tbs
;
return
nr_tbs
;
}
}
//tbslbrm calculation according to 5.4.2.1 of 38.212
//tbslbrm calculation according to 5.4.2.1 of 38.212
uint32_t
nr_compute_tbslbrm
(
uint16_t
table
,
uint32_t
nr_compute_tbslbrm
(
uint16_t
table
,
uint16_t
nb_rb
,
uint8_t
Nl
)
uint16_t
nb_rb
,
{
uint8_t
Nl
)
{
uint16_t
nb_rb_lbrm
=
0
;
for
(
int
i
=
0
;
i
<
7
;
i
++
)
{
uint16_t
R
,
nb_re
;
uint16_t
nb_rb_lbrm
=
0
;
uint8_t
Qm
;
int
i
;
uint32_t
nr_tbs
=
0
;
uint32_t
Ninfo
,
Np_info
,
C
;
uint8_t
n
;
for
(
i
=
0
;
i
<
7
;
i
++
)
{
if
(
NPRB_LBRM
[
i
]
>=
nb_rb
){
if
(
NPRB_LBRM
[
i
]
>=
nb_rb
){
nb_rb_lbrm
=
NPRB_LBRM
[
i
];
nb_rb_lbrm
=
NPRB_LBRM
[
i
];
break
;
break
;
}
}
}
}
Qm
=
((
table
==
1
)
?
8
:
6
)
;
int
Qm
=
(
table
==
1
)
?
8
:
6
;
R
=
948
;
uint32_t
R
=
948
;
nb_re
=
156
*
nb_rb_lbrm
;
uint32_t
nb_re
=
156
*
nb_rb_lbrm
;
// Intermediate number of information bits
// Intermediate number of information bits
Ninfo
=
(
nb_re
*
R
*
Qm
*
Nl
)
>>
10
;
uint32_t
Ninfo
=
(
nb_re
*
R
*
Qm
*
Nl
)
>>
10
;
uint32_t
nr_tbs
=
0
;
uint32_t
Np_info
,
n
;
if
(
Ninfo
<=
NR_MAX_PDSCH_TBS
)
{
if
(
Ninfo
<=
NR_MAX_PDSCH_TBS
)
{
n
=
max
(
3
,
floor
(
log2
(
Ninfo
))
-
6
);
n
=
max
(
3
,
floor
(
log2
(
Ninfo
))
-
6
);
Np_info
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
Np_info
=
max
(
24
,
(
Ninfo
>>
n
)
<<
n
);
for
(
int
i
=
0
;
i
<
INDEX_MAX_TBS_TABLE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
INDEX_MAX_TBS_TABLE
;
i
++
)
{
if
(
Tbstable_nr
[
i
]
>=
Np_info
){
if
(
Tbstable_nr
[
i
]
>=
Np_info
){
nr_tbs
=
Tbstable_nr
[
i
];
nr_tbs
=
Tbstable_nr
[
i
];
break
;
break
;
}
}
}
}
}
else
{
}
else
{
n
=
log2
(
Ninfo
-
24
)
-
5
;
n
=
log2
(
Ninfo
-
24
)
-
5
;
Np_info
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),(
1
<<
n
)))
<<
n
);
Np_info
=
max
(
3840
,
(
ROUNDIDIV
((
Ninfo
-
24
),
(
1
<<
n
)))
<<
n
);
int
C
;
if
(
R
<=
256
)
{
if
(
R
<=
256
)
{
C
=
CEILIDIV
((
Np_info
+
24
),
3816
);
C
=
CEILIDIV
((
Np_info
+
24
),
3816
);
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),
(
C
<<
3
))
-
24
;
}
}
else
{
else
{
if
(
Np_info
>
8424
){
if
(
Np_info
>
8424
){
C
=
CEILIDIV
((
Np_info
+
24
),
8424
);
C
=
CEILIDIV
((
Np_info
+
24
),
8424
);
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),(
C
<<
3
))
-
24
;
nr_tbs
=
(
C
<<
3
)
*
CEILIDIV
((
Np_info
+
24
),
(
C
<<
3
))
-
24
;
}
}
else
else
nr_tbs
=
((
CEILIDIV
((
Np_info
+
24
),
8
))
<<
3
)
-
24
;
nr_tbs
=
((
CEILIDIV
((
Np_info
+
24
),
8
))
<<
3
)
-
24
;
}
}
}
}
return
nr_tbs
;
return
nr_tbs
;
...
...
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