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
promise
OpenXG-RAN
Commits
63143b87
Commit
63143b87
authored
Jan 28, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Go on removing printf arguments warnings, add a suppression file to be used with cppcheck command
parent
875bdaf2
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1174 additions
and
1393 deletions
+1174
-1393
ci-scripts/cppcheck_suppressions.list
ci-scripts/cppcheck_suppressions.list
+6
-0
common/utils/backtrace.c
common/utils/backtrace.c
+7
-8
common/utils/hashtable/obj_hashtable.c
common/utils/hashtable/obj_hashtable.c
+189
-172
openair1/PHY/CODING/ccoding_byte.c
openair1/PHY/CODING/ccoding_byte.c
+1
-1
openair1/PHY/CODING/lte_rate_matching.c
openair1/PHY/CODING/lte_rate_matching.c
+3
-4
openair1/PHY/CODING/lte_segmentation.c
openair1/PHY/CODING/lte_segmentation.c
+2
-2
openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
+4
-27
openair1/PHY/LTE_REFSIG/lte_ul_ref.c
openair1/PHY/LTE_REFSIG/lte_ul_ref.c
+15
-28
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+238
-292
openair1/SIMULATION/LTE_PHY/dlsim.c
openair1/SIMULATION/LTE_PHY/dlsim.c
+709
-859
No files found.
ci-scripts/cppcheck_suppressions.list
0 → 100644
View file @
63143b87
// suppress error about keysP not free, it is done by calling func */
memleak:common/utils/hashtable/obj_hashtable.c
// followings errors are in file not used in oai exec's included in CI
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
common/utils/backtrace.c
View file @
63143b87
...
...
@@ -31,18 +31,18 @@
#include "backtrace.h"
/* Obtain a backtrace and print it to stdout. */
void
display_backtrace
(
void
)
{
void
display_backtrace
(
void
)
{
void
*
array
[
10
];
size_t
size
;
char
**
strings
;
size_t
i
;
char
*
test
=
getenv
(
"NO_BACKTRACE"
);
if
(
test
!=
0
)
*
((
int
*
)
0
)
=
0
;
char
*
test
=
getenv
(
"NO_BACKTRACE"
);
if
(
test
!=
0
)
*
((
int
*
)
0
)
=
0
;
size
=
backtrace
(
array
,
10
);
strings
=
backtrace_symbols
(
array
,
size
);
printf
(
"Obtained %zd stack frames.
\n
"
,
size
);
printf
(
"Obtained %u stack frames.
\n
"
,
(
unsigned
int
)
size
);
for
(
i
=
0
;
i
<
size
;
i
++
)
printf
(
"%s
\n
"
,
strings
[
i
]);
...
...
@@ -50,8 +50,7 @@ void display_backtrace(void)
free
(
strings
);
}
void
backtrace_handle_signal
(
siginfo_t
*
info
)
{
void
backtrace_handle_signal
(
siginfo_t
*
info
)
{
display_backtrace
();
//exit(EXIT_FAILURE);
}
common/utils/hashtable/obj_hashtable.c
View file @
63143b87
...
...
@@ -30,11 +30,10 @@
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/
static
hash_size_t
def_hashfunc
(
const
void
*
keyP
,
int
key_sizeP
)
{
static
hash_size_t
def_hashfunc
(
const
void
*
keyP
,
int
key_sizeP
)
{
hash_size_t
hash
=
0
;
while
(
key_sizeP
)
hash
^=
((
unsigned
char
*
)
keyP
)[
key_sizeP
--
];
while
(
key_sizeP
)
hash
^=
((
unsigned
char
*
)
keyP
)[
key_sizeP
--
];
return
hash
;
}
...
...
@@ -46,13 +45,12 @@ static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy().
*/
obj_hash_table_t
*
obj_hashtable_create
(
hash_size_t
sizeP
,
hash_size_t
(
*
hashfuncP
)(
const
void
*
,
int
),
void
(
*
freekeyfuncP
)(
void
*
),
void
(
*
freedatafuncP
)(
void
*
))
{
obj_hash_table_t
*
obj_hashtable_create
(
hash_size_t
sizeP
,
hash_size_t
(
*
hashfuncP
)(
const
void
*
,
int
),
void
(
*
freekeyfuncP
)(
void
*
),
void
(
*
freedatafuncP
)(
void
*
))
{
obj_hash_table_t
*
hashtbl
;
if
(
!
(
hashtbl
=
malloc
(
sizeof
(
obj_hash_table_t
))))
return
NULL
;
if
(
!
(
hashtbl
->
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
{
if
(
!
(
hashtbl
->
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
{
free
(
hashtbl
);
return
NULL
;
}
...
...
@@ -75,13 +73,13 @@ obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfunc
* Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t.
*/
hashtable_rc_t
obj_hashtable_destroy
(
obj_hash_table_t
*
hashtblP
)
{
hashtable_rc_t
obj_hashtable_destroy
(
obj_hash_table_t
*
hashtblP
)
{
hash_size_t
n
;
obj_hash_node_t
*
node
,
*
oldnode
;
for
(
n
=
0
;
n
<
hashtblP
->
size
;
++
n
)
{
node
=
hashtblP
->
nodes
[
n
];
while
(
node
)
{
oldnode
=
node
;
node
=
node
->
next
;
...
...
@@ -90,12 +88,13 @@ hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP)
free
(
oldnode
);
}
}
free
(
hashtblP
->
nodes
);
free
(
hashtblP
);
return
HASH_TABLE_OK
;
}
//-------------------------------------------------------------------------------------------------------------------------------
hashtable_rc_t
obj_hashtable_is_key_exists
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
)
hashtable_rc_t
obj_hashtable_is_key_exists
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
)
//-------------------------------------------------------------------------------------------------------------------------------
{
obj_hash_node_t
*
node
;
...
...
@@ -104,8 +103,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
if
(
hashtblP
==
NULL
)
{
return
HASH_TABLE_BAD_PARAMETER_HASHTABLE
;
}
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
(
node
->
key
==
keyP
)
{
return
HASH_TABLE_OK
;
...
...
@@ -114,8 +115,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
return
HASH_TABLE_OK
;
}
}
node
=
node
->
next
;
}
return
HASH_TABLE_KEY_NOT_EXISTS
;
}
//-------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -123,35 +126,42 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
* Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/
hashtable_rc_t
obj_hashtable_insert
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
,
void
*
dataP
)
{
hashtable_rc_t
obj_hashtable_insert
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
,
void
*
dataP
)
{
obj_hash_node_t
*
node
;
hash_size_t
hash
;
if
(
hashtblP
==
NULL
)
{
return
HASH_TABLE_BAD_PARAMETER_HASHTABLE
;
}
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
(
node
->
key
==
keyP
)
{
if
(
node
->
data
)
{
hashtblP
->
freedatafunc
(
node
->
data
);
}
node
->
data
=
dataP
;
// waste of memory here (keyP is lost) we should free it now
return
HASH_TABLE_INSERT_OVERWRITTEN_DATA
;
}
node
=
node
->
next
;
}
if
(
!
(
node
=
malloc
(
sizeof
(
obj_hash_node_t
))))
return
-
1
;
node
->
key
=
keyP
;
node
->
data
=
dataP
;
if
(
hashtblP
->
nodes
[
hash
])
{
node
->
next
=
hashtblP
->
nodes
[
hash
];
}
else
{
node
->
next
=
NULL
;
}
hashtblP
->
nodes
[
hash
]
=
node
;
return
HASH_TABLE_OK
;
}
...
...
@@ -160,8 +170,7 @@ hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/
hashtable_rc_t
obj_hashtable_remove
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
)
{
hashtable_rc_t
obj_hashtable_remove
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
)
{
obj_hash_node_t
*
node
,
*
prevnode
=
NULL
;
hash_size_t
hash
;
...
...
@@ -171,21 +180,25 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
((
node
->
key
==
keyP
)
||
((
node
->
key_size
==
key_sizeP
)
&&
(
memcmp
(
node
->
key
,
keyP
,
key_sizeP
)
==
0
)))
{
if
((
node
->
key
==
keyP
)
||
((
node
->
key_size
==
key_sizeP
)
&&
(
memcmp
(
node
->
key
,
keyP
,
key_sizeP
)
==
0
)))
{
if
(
prevnode
)
{
prevnode
->
next
=
node
->
next
;
}
else
{
hashtblP
->
nodes
[
hash
]
=
node
->
next
;
}
hashtblP
->
freekeyfunc
(
node
->
key
);
hashtblP
->
freedatafunc
(
node
->
data
);
free
(
node
);
return
HASH_TABLE_OK
;
}
prevnode
=
node
;
node
=
node
->
next
;
}
return
HASH_TABLE_KEY_NOT_EXISTS
;
}
//-------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -193,8 +206,7 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it.
*/
hashtable_rc_t
obj_hashtable_get
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
,
void
**
dataP
)
{
hashtable_rc_t
obj_hashtable_get
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
,
void
**
dataP
)
{
obj_hash_node_t
*
node
;
hash_size_t
hash
;
...
...
@@ -202,8 +214,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
*
dataP
=
NULL
;
return
HASH_TABLE_BAD_PARAMETER_HASHTABLE
;
}
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
(
node
->
key
==
keyP
)
{
*
dataP
=
node
->
data
;
...
...
@@ -214,8 +228,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
return
HASH_TABLE_OK
;
}
}
node
=
node
->
next
;
}
*
dataP
=
NULL
;
return
HASH_TABLE_KEY_NOT_EXISTS
;
}
...
...
@@ -223,14 +239,14 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
/*
* Function to return all keys of an object hash table
*/
hashtable_rc_t
obj_hashtable_get_keys
(
obj_hash_table_t
*
hashtblP
,
void
**
keysP
,
unsigned
int
*
sizeP
)
{
hashtable_rc_t
obj_hashtable_get_keys
(
obj_hash_table_t
*
hashtblP
,
void
**
keysP
,
unsigned
int
*
sizeP
)
{
size_t
n
=
0
;
obj_hash_node_t
*
node
=
NULL
;
obj_hash_node_t
*
next
=
NULL
;
*
sizeP
=
0
;
keysP
=
calloc
(
hashtblP
->
num_elements
,
sizeof
(
void
*
));
if
(
keysP
)
{
for
(
n
=
0
;
n
<
hashtblP
->
size
;
++
n
)
{
for
(
node
=
hashtblP
->
nodes
[
n
];
node
;
node
=
next
)
{
...
...
@@ -238,8 +254,11 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
next
=
node
->
next
;
}
}
// cppcheck-suppress memleak
return
HASH_TABLE_OK
;
}
return
HASH_TABLE_SYSTEM_ERROR
;
}
//-------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -253,8 +272,7 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/
hashtable_rc_t
obj_hashtable_resize
(
obj_hash_table_t
*
hashtblP
,
hash_size_t
sizeP
)
{
hashtable_rc_t
obj_hashtable_resize
(
obj_hash_table_t
*
hashtblP
,
hash_size_t
sizeP
)
{
obj_hash_table_t
newtbl
;
hash_size_t
n
;
obj_hash_node_t
*
node
,
*
next
;
...
...
@@ -266,7 +284,7 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size
newtbl
.
size
=
sizeP
;
newtbl
.
hashfunc
=
hashtblP
->
hashfunc
;
if
(
!
(
newtbl
.
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
return
HASH_TABLE_SYSTEM_ERROR
;
if
(
!
(
newtbl
.
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
return
HASH_TABLE_SYSTEM_ERROR
;
for
(
n
=
0
;
n
<
hashtblP
->
size
;
++
n
)
{
for
(
node
=
hashtblP
->
nodes
[
n
];
node
;
node
=
next
)
{
...
...
@@ -279,7 +297,6 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size
free
(
hashtblP
->
nodes
);
hashtblP
->
size
=
newtbl
.
size
;
hashtblP
->
nodes
=
newtbl
.
nodes
;
return
HASH_TABLE_OK
;
}
...
...
openair1/PHY/CODING/ccoding_byte.c
View file @
63143b87
...
...
@@ -130,7 +130,7 @@ ccodedot11_encode (unsigned int numbytes,
*
outPtr
++
=
(
out
>>
1
)
&
1
;
#ifdef DEBUG_CCODE
printf
(
"%
d
: %u -> %d (%u)
\n
"
,
dummy
,
state
,
out
,
ccodedot11_table
[
state
]);
printf
(
"%
u
: %u -> %d (%u)
\n
"
,
dummy
,
state
,
out
,
ccodedot11_table
[
state
]);
dummy
+=
2
;
#endif //DEBUG_CCODE
bit_index
=
(
bit_index
==
0
)
?
1
:
0
;
...
...
openair1/PHY/CODING/lte_rate_matching.c
View file @
63143b87
...
...
@@ -236,7 +236,7 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
ND
=
Kpi
-
D
;
#ifdef RM_DEBUG2
printf
(
"sub_block_interleaving_cc : D = %d (%d), d %p, w %p
\n
"
,
D
,
D
*
3
,
d
,
w
);
printf
(
"RCC = %d, Kpi=%d, ND=%ld
\n
"
,
RCC
,
Kpi
,
ND
);
printf
(
"RCC = %d, Kpi=%d, ND=%ld
\n
"
,
RCC
,
Kpi
,
(
long
)
ND
);
#endif
ND3
=
ND
*
3
;
k
=
0
;
...
...
@@ -253,7 +253,8 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
d
[
index3
-
ND3
+
1
]
=
w
[
Kpi
+
k
];
d
[
index3
-
ND3
+
2
]
=
w
[(
Kpi
<<
1
)
+
k
];
#ifdef RM_DEBUG2
printf
(
"row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)
\n
"
,
row
,
index
,
k
,
index3
-
ND3
,
w
[
k
],
w
[
Kpi
+
k
],
w
[(
Kpi
<<
1
)
+
k
]);
printf
(
"row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)
\n
"
,
row
,
index
,
k
,(
long
)(
index3
-
ND3
),
w
[
k
],
w
[
Kpi
+
k
],
w
[(
Kpi
<<
1
)
+
k
]);
#endif
index3
+=
96
;
index
+=
32
;
...
...
@@ -453,7 +454,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
int
threed
=
0
;
uint32_t
nulled
=
0
;
static
unsigned
char
*
counter_buffer
[
MAX_NUM_DLSCH_SEGMENTS
][
4
];
FILE
*
counter_fd
;
char
fname
[
512
];
#endif
...
...
@@ -476,7 +476,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
}
else
if
(
rvidx
==
3
)
{
sprintf
(
fname
,
"mcs%d_rate_matching_RB_%d.txt"
,
m
,
nb_rb
);
// sprintf(fname,"mcs0_rate_matching_RB_6.txt");
counter_fd
=
fopen
(
fname
,
"w"
);
}
#endif
...
...
openair1/PHY/CODING/lte_segmentation.c
View file @
63143b87
...
...
@@ -124,8 +124,8 @@ int lte_segmentation(unsigned char *input_buffer,
Bprime
,
*
Cplus
,
*
Kplus
,
*
Cminus
,
*
Kminus
);
*
F
=
((
*
Cplus
)
*
(
*
Kplus
)
+
(
*
Cminus
)
*
(
*
Kminus
)
-
(
Bprime
));
#ifdef DEBUG_SEGMENTATION
printf
(
"C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u
\n
"
,
*
C
,
*
Cplus
,
*
Cminus
,
*
Kplus
,
*
Kminus
,
Bprime
>>
3
,
Bprime
,
*
F
);
#endif
printf
(
"C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u
\n
"
,
*
C
,
*
Cplus
,
*
Cminus
,
*
Kplus
,
*
Kminus
,
Bprime
>>
3
,
Bprime
,
*
F
);
if
((
input_buffer
)
&&
(
output_buffers
))
{
for
(
k
=
0
;
k
<*
F
>>
3
;
k
++
)
{
...
...
openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
View file @
63143b87
...
...
@@ -35,30 +35,22 @@
int
lte_dl_mbsfn
(
PHY_VARS_eNB
*
eNB
,
int32_t
*
output
,
short
amp
,
int
subframe
,
unsigned
char
l
)
{
unsigned
char
l
)
{
unsigned
int
mprime
,
mprime_dword
,
mprime_qpsk_symb
,
m
;
unsigned
short
k
=
0
,
a
;
int32_t
qpsk
[
4
];
a
=
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
((
short
*
)
&
qpsk
[
0
])[
0
]
=
a
;
((
short
*
)
&
qpsk
[
0
])[
1
]
=
a
;
((
short
*
)
&
qpsk
[
1
])[
0
]
=
-
a
;
((
short
*
)
&
qpsk
[
1
])[
1
]
=
a
;
((
short
*
)
&
qpsk
[
2
])[
0
]
=
a
;
((
short
*
)
&
qpsk
[
2
])[
1
]
=
-
a
;
((
short
*
)
&
qpsk
[
3
])[
0
]
=
-
a
;
((
short
*
)
&
qpsk
[
3
])[
1
]
=
-
a
;
mprime
=
3
*
(
110
-
eNB
->
frame_parms
.
N_RB_DL
);
for
(
m
=
0
;
m
<
eNB
->
frame_parms
.
N_RB_DL
*
6
;
m
++
)
{
if
((
l
==
0
)
||
(
l
==
2
))
k
=
m
<<
1
;
else
if
(
l
==
1
)
...
...
@@ -69,7 +61,6 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
}
k
+=
eNB
->
frame_parms
.
first_carrier_offset
;
mprime_dword
=
mprime
>>
4
;
mprime_qpsk_symb
=
mprime
&
0xf
;
...
...
@@ -80,22 +71,18 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
output
[
k
]
=
qpsk
[(
eNB
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
];
//output[k] = (lte_gold_table[eNB_offset][subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_MBSFN
LOG_D
(
PHY
,
"subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d
\n
"
,
subframe
,
l
,
m
,
mprime
,
mprime_dword
,
mprime_qpsk_symb
);
LOG_D
(
PHY
,
"index = %d (k %d)(%x)
\n
"
,(
eNB
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
,
k
,
eNB
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]);
#endif
mprime
++
;
#ifdef DEBUG_DL_MBSFN
if
(
m
<
18
)
printf
(
"subframe %d, l %d output[%d] = (%d,%d)
\n
"
,
subframe
,
l
,
k
,((
short
*
)
&
output
[
k
])[
0
],((
short
*
)
&
output
[
k
])[
1
]);
#endif
}
return
(
0
);
...
...
@@ -106,15 +93,11 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
int
lte_dl_mbsfn_rx
(
PHY_VARS_UE
*
ue
,
int
*
output
,
int
subframe
,
unsigned
char
l
)
{
unsigned
char
l
)
{
unsigned
int
mprime
,
mprime_dword
,
mprime_qpsk_symb
,
m
;
unsigned
short
k
=
0
;
unsigned
int
qpsk
[
4
];
// This includes complex conjugate for channel estimation
((
short
*
)
&
qpsk
[
0
])[
0
]
=
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
0
])[
1
]
=
-
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
1
])[
0
]
=
-
ONE_OVER_SQRT2_Q15
;
...
...
@@ -123,23 +106,18 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
((
short
*
)
&
qpsk
[
2
])[
1
]
=
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
3
])[
0
]
=
-
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
3
])[
1
]
=
ONE_OVER_SQRT2_Q15
;
mprime
=
3
*
(
110
-
ue
->
frame_parms
.
N_RB_DL
);
for
(
m
=
0
;
m
<
ue
->
frame_parms
.
N_RB_DL
*
6
;
m
++
)
{
mprime_dword
=
mprime
>>
4
;
mprime_qpsk_symb
=
mprime
&
0xf
;
// this is r_mprime from 3GPP 36-211 6.10.1.2
output
[
k
]
=
qpsk
[(
ue
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
];
#ifdef DEBUG_DL_MBSFN
printf
(
"subframe %d, l %d, m %
d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d
\n
"
,
printf
(
"subframe %d, l %d, m %
u, mprime %u, mprime_dword %u, mprime_qpsk_symbol %u
\n
"
,
subframe
,
l
,
m
,
mprime
,
mprime_dword
,
mprime_qpsk_symb
);
printf
(
"index = %d (k %d) (%x)
\n
"
,(
ue
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
,
k
,
ue
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]);
#endif
mprime
++
;
#ifdef DEBUG_DL_MBSFN
...
...
@@ -148,7 +126,6 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
#endif
k
++
;
}
return
(
0
);
...
...
openair1/PHY/LTE_REFSIG/lte_ul_ref.c
View file @
63143b87
...
...
@@ -20,9 +20,9 @@
*/
#ifdef MAIN
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#endif
#include "lte_refsig.h"
#include "PHY/defs_eNB.h"
...
...
@@ -43,8 +43,7 @@ char ref24[720] = {
-
1
,
3
,
1
,
-
3
,
3
,
-
1
,
1
,
3
,
-
3
,
3
,
1
,
3
,
-
3
,
3
,
1
,
1
,
-
1
,
1
,
3
,
-
3
,
3
,
-
3
,
-
1
,
-
3
,
-
3
,
3
,
-
3
,
-
3
,
-
3
,
1
,
-
3
,
-
3
,
3
,
-
1
,
1
,
1
,
1
,
3
,
1
,
-
1
,
3
,
-
3
,
-
3
,
1
,
3
,
1
,
1
,
-
3
,
3
,
-
1
,
3
,
3
,
1
,
1
,
-
3
,
3
,
3
,
3
,
3
,
1
,
-
1
,
3
,
-
1
,
1
,
1
,
-
1
,
-
3
,
-
1
,
-
1
,
1
,
3
,
3
,
-
1
,
-
3
,
1
,
1
,
3
,
-
3
,
1
,
1
,
-
3
,
-
1
,
-
1
,
1
,
3
,
1
,
3
,
1
,
-
1
,
3
,
1
,
1
,
-
3
,
-
1
,
-
3
,
-
1
,
-
1
,
-
1
,
-
1
,
-
3
,
-
3
,
-
1
,
1
,
1
,
3
,
3
,
-
1
,
3
,
-
1
,
1
,
-
1
,
-
3
,
1
,
-
1
,
-
3
,
-
3
,
1
,
-
3
,
-
1
,
-
1
,
-
3
,
1
,
1
,
3
,
-
1
,
1
,
3
,
1
,
-
3
,
1
,
-
3
,
1
,
1
,
-
1
,
-
1
,
3
,
-
1
,
-
3
,
3
,
-
3
,
-
3
,
-
3
,
1
,
1
,
1
,
1
,
-
1
,
-
1
,
3
,
-
3
,
-
3
,
3
,
-
3
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
-
1
,
-
3
,
-
1
,
1
,
-
1
,
3
,
-
1
,
-
3
,
-
3
,
3
,
3
,
-
1
,
-
1
,
-
3
,
-
1
,
3
,
1
,
3
,
1
,
3
,
1
,
1
,
-
1
,
3
,
1
,
-
1
,
1
,
3
,
-
3
,
-
1
,
-
1
,
1
,
-
3
,
1
,
3
,
-
3
,
1
,
-
1
,
-
3
,
3
,
-
3
,
3
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
-
3
,
-
3
,
-
3
,
1
,
-
3
,
-
3
,
-
3
,
1
,
-
3
,
1
,
1
,
-
3
,
3
,
3
,
-
1
,
-
3
,
-
1
,
3
,
-
3
,
3
,
3
,
3
,
-
1
,
1
,
1
,
-
3
,
1
,
-
1
,
1
,
1
,
-
3
,
1
,
1
,
-
1
,
1
,
-
3
,
-
3
,
3
,
-
1
,
3
,
-
1
,
-
1
,
-
3
,
-
3
,
-
3
,
-
1
,
-
3
,
-
3
,
1
,
-
1
,
1
,
3
,
3
,
-
1
,
1
,
-
1
,
3
,
1
,
3
,
3
,
-
3
,
-
3
,
1
,
3
,
1
,
-
1
,
-
3
,
-
3
,
-
3
,
3
,
3
,
-
3
,
3
,
3
,
-
1
,
-
3
,
3
,
-
1
,
1
,
-
3
,
1
,
1
,
3
,
3
,
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
3
,
3
,
-
1
,
1
,
1
,
-
3
,
3
,
3
,
-
1
,
-
3
,
3
,
-
3
,
-
1
,
-
3
,
-
1
,
3
,
-
1
,
-
1
,
-
1
,
-
1
,
-
3
,
-
1
,
3
,
3
,
1
,
-
1
,
1
,
3
,
3
,
3
,
-
1
,
1
,
1
,
-
3
,
1
,
3
,
-
1
,
-
3
,
3
,
-
3
,
-
3
,
3
,
1
,
3
,
1
,
-
3
,
3
,
1
,
3
,
1
,
1
,
3
,
3
,
-
1
,
-
1
,
-
3
,
1
,
-
3
,
-
1
,
3
,
1
,
1
,
3
,
-
1
,
-
1
,
1
,
-
3
,
1
,
3
,
-
3
,
1
,
-
1
,
-
3
,
-
1
,
3
,
1
,
3
,
1
,
-
1
,
-
3
,
-
3
,
-
1
,
-
1
,
-
3
,
-
3
,
-
3
,
-
1
,
-
1
,
-
3
,
3
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
-
3
,
3
,
1
,
3
,
3
,
1
,
-
1
,
1
,
-
3
,
1
,
-
3
,
1
,
1
,
-
3
,
-
1
,
1
,
3
,
-
1
,
3
,
3
,
-
1
,
-
3
,
1
,
-
1
,
-
3
,
3
,
3
,
3
,
-
1
,
1
,
1
,
3
,
-
1
,
-
3
,
-
1
,
3
,
-
1
,
-
1
,
-
1
,
1
,
1
,
1
,
1
,
1
,
-
1
,
3
,
-
1
,
-
3
,
1
,
1
,
3
,
-
3
,
1
,
-
3
,
-
1
,
1
,
1
,
-
3
,
-
3
,
3
,
1
,
1
,
-
3
,
1
,
3
,
3
,
1
,
-
1
,
-
3
,
3
,
-
1
,
3
,
3
,
3
,
-
3
,
1
,
-
1
,
1
,
-
1
,
-
3
,
-
1
,
1
,
3
,
-
1
,
3
,
-
3
,
-
3
,
-
1
,
-
3
,
3
,
-
3
,
-
3
,
-
3
,
-
1
,
-
1
,
-
3
,
-
1
,
-
3
,
3
,
1
,
3
,
-
3
,
-
1
,
3
,
-
1
,
1
,
-
1
,
3
,
-
3
,
1
,
-
1
,
-
3
,
-
3
,
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
3
,
1
,
-
3
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
3
,
3
,
-
3
,
-
1
,
1
,
-
3
,
-
3
,
-
1
,
-
3
,
3
,
1
,
-
1
,
-
3
,
-
1
,
-
3
,
-
3
,
3
,
-
3
,
3
,
-
3
,
-
1
,
1
,
3
,
1
,
-
3
,
1
,
3
,
3
,
-
1
,
-
3
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
3
,
3
,
1
,
3
,
3
,
-
3
,
1
,
3
,
-
1
,
3
,
-
1
,
3
,
3
,
-
3
,
3
,
1
,
-
1
,
3
,
3
,
1
,
-
1
,
3
,
3
,
-
1
,
-
3
,
3
,
-
3
,
-
1
,
-
1
,
3
,
-
1
,
3
,
-
1
,
-
1
,
1
,
1
,
1
,
1
,
-
1
,
-
1
,
-
3
,
-
1
,
3
,
1
,
-
1
,
1
,
-
1
,
3
,
-
1
,
3
,
1
,
1
,
-
1
,
-
1
,
-
3
,
1
,
1
,
-
3
,
1
,
3
,
-
3
,
1
,
1
,
-
3
,
-
3
,
-
1
,
-
1
,
-
3
,
-
1
,
1
,
3
,
1
,
1
,
-
3
,
-
1
,
-
1
,
-
3
,
3
,
-
3
,
3
,
1
,
-
3
,
3
,
-
3
,
1
,
-
1
,
1
,
-
3
,
1
,
1
,
1
,
-
1
,
-
3
,
3
,
3
,
1
,
1
,
3
,
-
1
,
-
3
,
-
1
,
-
1
,
-
1
,
3
,
1
,
-
3
,
-
3
,
-
1
,
3
,
-
3
,
-
1
,
-
3
,
-
1
,
-
3
,
-
1
,
-
1
,
-
3
,
-
1
,
-
1
,
1
,
-
3
,
-
1
,
-
1
,
1
,
-
1
,
-
3
,
1
,
1
,
-
3
,
1
,
-
3
,
-
3
,
3
,
1
,
1
,
-
1
,
3
,
-
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
-
3
,
-
1
,
3
,
-
1
,
3
,
-
1
,
1
,
3
,
1
,
-
1
,
3
,
1
,
3
,
-
3
,
-
3
,
1
,
-
1
,
-
1
,
1
,
3
};
void
generate_ul_ref_sigs
(
void
)
{
void
generate_ul_ref_sigs
(
void
)
{
double
qbar
,
phase
;
unsigned
int
u
,
v
,
Msc_RS
,
q
,
m
,
n
;
...
...
@@ -53,7 +52,7 @@ void generate_ul_ref_sigs(void)
for
(
u
=
0
;
u
<
30
;
u
++
)
{
for
(
v
=
0
;
v
<
2
;
v
++
)
{
qbar
=
ref_primes
[
Msc_RS
]
*
(
u
+
1
)
/
(
double
)
31
;
ul_ref_sigs
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
ul_ref_sigs
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
if
((((
int
)
floor
(
2
*
qbar
))
&
1
)
==
0
)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
-
v
;
...
...
@@ -61,7 +60,7 @@ void generate_ul_ref_sigs(void)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
+
v
;
#ifdef MAIN
printf
(
"Msc_RS %
d (%d), u %d, v %d -> q %d
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
printf
(
"Msc_RS %
u (%d), u %u, v %u -> q %u
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
#endif
for
(
n
=
0
;
n
<
dftsizes
[
Msc_RS
];
n
++
)
{
...
...
@@ -89,32 +88,26 @@ void generate_ul_ref_sigs(void)
// These are the sequences for RB 1
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
ul_ref_sigs
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
for
(
n
=
0
;
n
<
dftsizes
[
0
];
n
++
)
{
ul_ref_sigs
[
u
][
0
][
0
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref12
[(
u
*
12
)
+
n
]
/
4
)));
ul_ref_sigs
[
u
][
0
][
0
][
1
+
(
n
<<
1
)]
=
(
int16_t
)(
floor
(
32767
*
sin
(
M_PI
*
ref12
[(
u
*
12
)
+
n
]
/
4
)));
}
}
// These are the sequences for RB 2
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
ul_ref_sigs
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
for
(
n
=
0
;
n
<
dftsizes
[
1
];
n
++
)
{
ul_ref_sigs
[
u
][
0
][
1
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
ul_ref_sigs
[
u
][
0
][
1
][
1
+
(
n
<<
1
)]
=
(
int16_t
)(
floor
(
32767
*
sin
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
}
}
}
void
generate_ul_ref_sigs_rx
(
void
)
{
void
generate_ul_ref_sigs_rx
(
void
)
{
double
qbar
,
phase
;
unsigned
int
u
,
v
,
Msc_RS
,
q
,
m
,
n
;
...
...
@@ -123,7 +116,7 @@ void generate_ul_ref_sigs_rx(void)
for
(
u
=
0
;
u
<
30
;
u
++
)
{
for
(
v
=
0
;
v
<
2
;
v
++
)
{
qbar
=
ref_primes
[
Msc_RS
]
*
(
u
+
1
)
/
(
double
)
31
;
ul_ref_sigs_rx
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
ul_ref_sigs_rx
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
if
((((
int
)
floor
(
2
*
qbar
))
&
1
)
==
0
)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
-
v
;
...
...
@@ -131,7 +124,7 @@ void generate_ul_ref_sigs_rx(void)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
+
v
;
#ifdef MAIN
printf
(
"Msc_RS %
d (%d), u %d, v %d -> q %d
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
printf
(
"Msc_RS %
u (%d), u %u, v %u -> q %u
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
#endif
for
(
n
=
0
;
n
<
dftsizes
[
Msc_RS
];
n
++
)
{
...
...
@@ -159,7 +152,7 @@ void generate_ul_ref_sigs_rx(void)
// These are the sequences for RB 1
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
ul_ref_sigs_rx
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
for
(
n
=
0
;
n
<
dftsizes
[
0
];
n
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
0
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref12
[(
u
*
12
)
+
n
]
/
4
)));
...
...
@@ -169,21 +162,17 @@ void generate_ul_ref_sigs_rx(void)
// These are the sequences for RB 2
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
ul_ref_sigs_rx
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
for
(
n
=
0
;
n
<
dftsizes
[
1
];
n
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
1
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
ul_ref_sigs_rx
[
u
][
0
][
1
][
1
+
(
n
<<
1
)]
=
(
int16_t
)(
floor
(
32767
*
sin
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
}
}
}
void
free_ul_ref_sigs
(
void
)
{
void
free_ul_ref_sigs
(
void
)
{
unsigned
int
u
,
v
,
Msc_RS
;
for
(
Msc_RS
=
0
;
Msc_RS
<
34
;
Msc_RS
++
)
{
...
...
@@ -204,9 +193,7 @@ void free_ul_ref_sigs(void)
}
#ifdef MAIN
main
()
{
main
()
{
generate_ul_ref_sigs
();
generate_ul_ref_sigs_rx
();
free_ul_ref_sigs
();
...
...
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
View file @
63143b87
...
...
@@ -60,43 +60,46 @@
extern
WORKER_CONF_t
get_thread_worker_conf
(
void
);
void
free_eNB_dlsch
(
LTE_eNB_DLSCH_t
*
dlsch
)
{
void
free_eNB_dlsch
(
LTE_eNB_DLSCH_t
*
dlsch
)
{
int
i
,
r
,
aa
,
layer
;
if
(
dlsch
)
{
for
(
layer
=
0
;
layer
<
4
;
layer
++
)
{
for
(
aa
=
0
;
aa
<
64
;
aa
++
)
free16
(
dlsch
->
ue_spec_bf_weights
[
layer
][
aa
],
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES
*
sizeof
(
int32_t
));
free16
(
dlsch
->
ue_spec_bf_weights
[
layer
],
64
*
sizeof
(
int32_t
*
));
free16
(
dlsch
->
ue_spec_bf_weights
[
layer
],
64
*
sizeof
(
int32_t
*
));
}
for
(
i
=
0
;
i
<
dlsch
->
Mdlharq
;
i
++
)
{
if
(
dlsch
->
harq_processes
[
i
])
{
if
(
dlsch
->
harq_processes
[
i
]
->
b
)
{
free16
(
dlsch
->
harq_processes
[
i
]
->
b
,
MAX_DLSCH_PAYLOAD_BYTES
);
dlsch
->
harq_processes
[
i
]
->
b
=
NULL
;
}
for
(
r
=
0
;
r
<
MAX_NUM_DLSCH_SEGMENTS
;
r
++
)
{
if
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
])
{
free16
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
],((
r
==
0
)
?
8
:
0
)
+
3
+
768
);
dlsch
->
harq_processes
[
i
]
->
c
[
r
]
=
NULL
;
}
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
{
free16
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
],(
96
+
12
+
3
+
(
3
*
6144
)));
dlsch
->
harq_processes
[
i
]
->
d
[
r
]
=
NULL
;
}
}
free16
(
dlsch
->
harq_processes
[
i
],
sizeof
(
LTE_DL_eNB_HARQ_t
));
dlsch
->
harq_processes
[
i
]
=
NULL
;
}
}
free16
(
dlsch
,
sizeof
(
LTE_eNB_DLSCH_t
));
dlsch
=
NULL
;
}
}
LTE_eNB_DLSCH_t
*
new_eNB_dlsch
(
unsigned
char
Kmimo
,
unsigned
char
Mdlharq
,
uint32_t
Nsoft
,
unsigned
char
N_RB_DL
,
uint8_t
abstraction_flag
,
LTE_DL_FRAME_PARMS
*
frame_parms
)
{
LTE_eNB_DLSCH_t
*
new_eNB_dlsch
(
unsigned
char
Kmimo
,
unsigned
char
Mdlharq
,
uint32_t
Nsoft
,
unsigned
char
N_RB_DL
,
uint8_t
abstraction_flag
,
LTE_DL_FRAME_PARMS
*
frame_parms
)
{
LTE_eNB_DLSCH_t
*
dlsch
;
unsigned
char
exit_flag
=
0
,
i
,
j
,
r
,
aa
,
layer
;
int
re
;
...
...
@@ -130,11 +133,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
dlsch
->
Nsoft
=
Nsoft
;
for
(
layer
=
0
;
layer
<
4
;
layer
++
)
{
dlsch
->
ue_spec_bf_weights
[
layer
]
=
(
int32_t
**
)
malloc16
(
64
*
sizeof
(
int32_t
*
));
dlsch
->
ue_spec_bf_weights
[
layer
]
=
(
int32_t
**
)
malloc16
(
64
*
sizeof
(
int32_t
*
));
for
(
aa
=
0
;
aa
<
64
;
aa
++
)
{
dlsch
->
ue_spec_bf_weights
[
layer
][
aa
]
=
(
int32_t
*
)
malloc16
(
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES
*
sizeof
(
int32_t
));
for
(
re
=
0
;
re
<
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES
;
re
++
)
{
for
(
re
=
0
;
re
<
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES
;
re
++
)
{
dlsch
->
ue_spec_bf_weights
[
layer
][
aa
][
re
]
=
0x00007fff
;
}
}
...
...
@@ -159,7 +163,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
if
(
dlsch
->
harq_processes
[
i
])
{
bzero
(
dlsch
->
harq_processes
[
i
],
sizeof
(
LTE_DL_eNB_HARQ_t
));
// dlsch->harq_processes[i]->first_tx=1;
dlsch
->
harq_processes
[
i
]
->
b
=
(
unsigned
char
*
)
malloc16
(
MAX_DLSCH_PAYLOAD_BYTES
/
bw_scaling
);
dlsch
->
harq_processes
[
i
]
->
b
=
(
unsigned
char
*
)
malloc16
(
MAX_DLSCH_PAYLOAD_BYTES
/
bw_scaling
);
if
(
dlsch
->
harq_processes
[
i
]
->
b
)
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
b
,
MAX_DLSCH_PAYLOAD_BYTES
/
bw_scaling
);
...
...
@@ -171,14 +175,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
if
(
abstraction_flag
==
0
)
{
for
(
r
=
0
;
r
<
MAX_NUM_DLSCH_SEGMENTS
/
bw_scaling
;
r
++
)
{
// account for filler in first segment and CRCs for multiple segment case
dlsch
->
harq_processes
[
i
]
->
c
[
r
]
=
(
uint8_t
*
)
malloc16
(((
r
==
0
)
?
8
:
0
)
+
3
+
768
);
dlsch
->
harq_processes
[
i
]
->
d
[
r
]
=
(
uint8_t
*
)
malloc16
((
96
+
12
+
3
+
(
3
*
6144
)));
dlsch
->
harq_processes
[
i
]
->
c
[
r
]
=
(
uint8_t
*
)
malloc16
(((
r
==
0
)
?
8
:
0
)
+
3
+
768
);
dlsch
->
harq_processes
[
i
]
->
d
[
r
]
=
(
uint8_t
*
)
malloc16
((
96
+
12
+
3
+
(
3
*
6144
)));
if
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
])
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
c
[
r
],((
r
==
0
)
?
8
:
0
)
+
3
+
768
);
}
else
{
printf
(
"Can't get c
\n
"
);
exit_flag
=
2
;
}
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
{
bzero
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
],(
96
+
12
+
3
+
(
3
*
6144
)));
}
else
{
...
...
@@ -203,7 +209,6 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
dlsch
->
harq_processes
[
i
]
->
d
[
r
][
j
]
=
LTE_NULL
;
}
}
return
(
dlsch
);
...
...
@@ -214,13 +219,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
exit_flag
,
sizeof
(
LTE_eNB_DLSCH_t
));
free_eNB_dlsch
(
dlsch
);
return
(
NULL
);
}
void
clean_eNb_dlsch
(
LTE_eNB_DLSCH_t
*
dlsch
)
{
void
clean_eNb_dlsch
(
LTE_eNB_DLSCH_t
*
dlsch
)
{
unsigned
char
Mdlharq
;
unsigned
char
i
,
j
,
r
;
...
...
@@ -228,8 +229,10 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
Mdlharq
=
dlsch
->
Mdlharq
;
dlsch
->
rnti
=
0
;
#ifdef PHY_TX_THREAD
for
(
i
=
0
;
i
<
10
;
i
++
)
dlsch
->
active
[
i
]
=
0
;
#else
dlsch
->
active
=
0
;
#endif
...
...
@@ -248,7 +251,6 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
for
(
r
=
0
;
r
<
MAX_NUM_DLSCH_SEGMENTS
;
r
++
)
if
(
dlsch
->
harq_processes
[
i
]
->
d
[
r
])
dlsch
->
harq_processes
[
i
]
->
d
[
r
][
j
]
=
LTE_NULL
;
}
}
}
...
...
@@ -258,31 +260,24 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
int
dlsch_encoding_2threads0
(
te_params
*
tep
)
{
LTE_eNB_DLSCH_t
*
dlsch
=
tep
->
dlsch
;
unsigned
int
G
=
tep
->
G
;
unsigned
char
harq_pid
=
tep
->
harq_pid
;
unsigned
int
total_worker
=
tep
->
total_worker
;
unsigned
int
current_worker
=
tep
->
current_worker
;
unsigned
short
nb_rb
=
dlsch
->
harq_processes
[
harq_pid
]
->
nb_rb
;
unsigned
int
Kr
=
0
,
Kr_bytes
,
r
,
r_offset
=
0
;
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W
,
VCD_FUNCTION_IN
);
if
(
dlsch
->
harq_processes
[
harq_pid
]
->
round
==
0
)
{
// this is a new packet
for
(
r
=
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
total_worker
+
1
))
*
current_worker
;
r
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
total_worker
+
1
))
*
(
current_worker
+
1
);
r
++
)
{
if
(
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
Cminus
)
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
Kminus
;
else
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
Kplus
;
Kr_bytes
=
Kr
>>
3
;
encoder
(
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
],
Kr
>>
3
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
][
96
],
...
...
@@ -293,25 +288,24 @@ int dlsch_encoding_2threads0(te_params *tep) {
&
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
r
][
96
],
dlsch
->
harq_processes
[
harq_pid
]
->
w
[
r
]);
}
}
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
// outputs for each code segment, see Section 5.1.5 p.20
for
(
r
=
0
,
r_offset
=
0
;
r
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
total_worker
+
1
))
*
(
current_worker
+
1
);
r
++
)
{
if
(
r
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
total_worker
+
1
))
*
(
current_worker
)){
if
(
r
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
total_worker
+
1
))
*
(
current_worker
))
{
int
Nl
=
dlsch
->
harq_processes
[
harq_pid
]
->
Nl
;
int
Qm
=
dlsch
->
harq_processes
[
harq_pid
]
->
Qm
;
int
C
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
int
Gp
=
G
/
Nl
/
Qm
;
int
GpmodC
=
Gp
%
C
;
if
(
r
<
(
C
-
(
GpmodC
)))
r_offset
+=
Nl
*
Qm
*
(
Gp
/
C
);
else
r_offset
+=
Nl
*
Qm
*
((
GpmodC
==
0
?
0
:
1
)
+
(
Gp
/
C
));
}
else
{
}
else
{
r_offset
+=
lte_rate_matching_turbo
(
dlsch
->
harq_processes
[
harq_pid
]
->
RTC
[
r
],
G
,
//G
dlsch
->
harq_processes
[
harq_pid
]
->
w
[
r
],
...
...
@@ -330,7 +324,6 @@ int dlsch_encoding_2threads0(te_params *tep) {
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W
,
VCD_FUNCTION_OUT
);
return
(
0
);
}
...
...
@@ -339,19 +332,16 @@ extern int oai_exit;
void
*
te_thread
(
void
*
param
)
{
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
thread_top_init
(
"te_thread"
,
1
,
200000
,
250000
,
500000
);
pthread_setname_np
(
pthread_self
(),
"te processing"
);
LOG_I
(
PHY
,
"thread te created id=%ld
\n
"
,
syscall
(
__NR_gettid
));
te_params
*
tep
=
(
te_params
*
)
param
;
//wait_sync("te_thread");
while
(
!
oai_exit
)
{
if
(
wait_on_condition
(
&
tep
->
mutex_te
,
&
tep
->
cond_te
,
&
tep
->
instance_cnt_te
,
"te thread"
)
<
0
)
break
;
if
(
oai_exit
)
break
;
dlsch_encoding_2threads0
(
tep
);
...
...
@@ -363,6 +353,7 @@ void *te_thread(void *param) {
exit_fun
(
"ERROR pthread_cond_signal"
);
return
(
NULL
);
}
/*if(opp_enabled == 1 && te_wakeup_stats0->p_time>50*3000){
print_meas_now(te_wakeup_stats0,"coding_wakeup",stderr);
printf("te_thread0 delay for waking up in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
...
...
@@ -387,49 +378,44 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
time_stats_t
*
te_wakeup_stats0
,
time_stats_t
*
te_wakeup_stats1
,
time_stats_t
*
i_stats
,
int
worker_num
)
{
int
worker_num
)
{
//start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
LTE_DL_FRAME_PARMS
*
frame_parms
=
&
eNB
->
frame_parms
;
L1_proc_t
*
proc
=
&
eNB
->
proc
;
unsigned
int
G
;
unsigned
int
crc
=
1
;
unsigned
char
harq_pid
=
dlsch
->
harq_ids
[
frame
%
2
][
subframe
];
if
(
harq_pid
>=
dlsch
->
Mdlharq
)
{
LOG_E
(
PHY
,
"dlsch_encoding_2threads illegal harq_pid %d
\n
"
,
harq_pid
);
return
(
-
1
);
}
unsigned
short
nb_rb
=
dlsch
->
harq_processes
[
harq_pid
]
->
nb_rb
;
unsigned
int
A
;
unsigned
char
mod_order
;
unsigned
int
Kr
=
0
,
Kr_bytes
,
r
,
r_offset
=
0
;
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING
,
VCD_FUNCTION_IN
);
A
=
dlsch
->
harq_processes
[
harq_pid
]
->
TBS
;
//6228
mod_order
=
dlsch
->
harq_processes
[
harq_pid
]
->
Qm
;
G
=
get_G
(
frame_parms
,
nb_rb
,
dlsch
->
harq_processes
[
harq_pid
]
->
rb_alloc
,
mod_order
,
dlsch
->
harq_processes
[
harq_pid
]
->
Nl
,
num_pdcch_symbols
,
frame
,
subframe
,
dlsch
->
harq_processes
[
harq_pid
]
->
mimo_mode
==
TM7
?
7
:
0
);
G
=
get_G
(
frame_parms
,
nb_rb
,
dlsch
->
harq_processes
[
harq_pid
]
->
rb_alloc
,
mod_order
,
dlsch
->
harq_processes
[
harq_pid
]
->
Nl
,
num_pdcch_symbols
,
frame
,
subframe
,
dlsch
->
harq_processes
[
harq_pid
]
->
mimo_mode
==
TM7
?
7
:
0
);
if
(
dlsch
->
harq_processes
[
harq_pid
]
->
round
==
0
)
{
// this is a new packet
start_meas
(
&
eNB
->
dlsch_turbo_encoding_preperation_stats
);
// Add 24-bit crc (polynomial A) to payload
crc
=
crc24a
(
a
,
A
)
>>
8
;
stop_meas
(
&
eNB
->
dlsch_turbo_encoding_preperation_stats
);
a
[
A
>>
3
]
=
((
uint8_t
*
)
&
crc
)[
2
];
a
[
1
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
1
];
a
[
2
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
0
];
a
[
A
>>
3
]
=
((
uint8_t
*
)
&
crc
)[
2
];
a
[
1
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
1
];
a
[
2
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
0
];
dlsch
->
harq_processes
[
harq_pid
]
->
B
=
A
+
24
;
memcpy
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
a
,(
A
/
8
)
+
4
);
//stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
start_meas
(
&
eNB
->
dlsch_turbo_encoding_segmentation_stats
);
if
(
lte_segmentation
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
...
...
@@ -442,18 +428,17 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
return
(
-
1
);
stop_meas
(
&
eNB
->
dlsch_turbo_encoding_segmentation_stats
);
start_meas
(
&
eNB
->
dlsch_turbo_encoding_signal_stats
);
for
(
int
i
=
0
;
i
<
worker_num
;
i
++
)
{
for
(
int
i
=
0
;
i
<
worker_num
;
i
++
)
{
proc
->
tep
[
i
].
eNB
=
eNB
;
proc
->
tep
[
i
].
dlsch
=
dlsch
;
proc
->
tep
[
i
].
G
=
G
;
proc
->
tep
[
i
].
harq_pid
=
harq_pid
;
proc
->
tep
[
i
].
total_worker
=
worker_num
;
proc
->
tep
[
i
].
current_worker
=
i
;
pthread_mutex_lock
(
&
proc
->
tep
[
i
].
mutex_te
);
if
(
proc
->
tep
[
i
].
instance_cnt_te
==
0
)
{
printf
(
"[eNB] TE thread busy
\n
"
);
exit_fun
(
"TE thread busy"
);
...
...
@@ -475,15 +460,14 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
stop_meas
(
&
eNB
->
dlsch_turbo_encoding_signal_stats
);
start_meas
(
te_main_stats
);
for
(
r
=
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
worker_num
+
1
))
*
worker_num
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
for
(
r
=
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
worker_num
+
1
))
*
worker_num
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
if
(
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
Cminus
)
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
Kminus
;
else
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
Kplus
;
Kr_bytes
=
Kr
>>
3
;
start_meas
(
te_stats
);
encoder
(
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
],
Kr
>>
3
,
...
...
@@ -491,7 +475,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
(
r
==
0
)
?
dlsch
->
harq_processes
[
harq_pid
]
->
F
:
0
);
stop_meas
(
te_stats
);
start_meas
(
i_stats
);
dlsch
->
harq_processes
[
harq_pid
]
->
RTC
[
r
]
=
sub_block_interleaving_turbo
(
4
+
(
Kr_bytes
*
8
),
...
...
@@ -499,17 +482,14 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
dlsch
->
harq_processes
[
harq_pid
]
->
w
[
r
]);
stop_meas
(
i_stats
);
}
}
else
{
for
(
int
i
=
0
;
i
<
worker_num
;
i
++
)
{
}
else
{
for
(
int
i
=
0
;
i
<
worker_num
;
i
++
)
{
proc
->
tep
[
i
].
eNB
=
eNB
;
proc
->
tep
[
i
].
dlsch
=
dlsch
;
proc
->
tep
[
i
].
G
=
G
;
proc
->
tep
[
i
].
total_worker
=
worker_num
;
proc
->
tep
[
i
].
current_worker
=
i
;
if
(
pthread_cond_signal
(
&
proc
->
tep
[
i
].
cond_te
)
!=
0
)
{
printf
(
"[eNB] ERROR pthread_cond_signal for te thread exit
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
...
...
@@ -521,7 +501,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
// outputs for each code segment, see Section 5.1.5 p.20
for
(
r
=
0
,
r_offset
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
// get information for E for the segments that are handled by the worker thread
if
(
r
<
(
dlsch
->
harq_processes
[
harq_pid
]
->
C
/
(
worker_num
+
1
))
*
worker_num
)
{
int
Nl
=
dlsch
->
harq_processes
[
harq_pid
]
->
Nl
;
...
...
@@ -529,12 +508,12 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
int
C
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
int
Gp
=
G
/
Nl
/
Qm
;
int
GpmodC
=
Gp
%
C
;
if
(
r
<
(
C
-
(
GpmodC
)))
r_offset
+=
Nl
*
Qm
*
(
Gp
/
C
);
else
r_offset
+=
Nl
*
Qm
*
((
GpmodC
==
0
?
0
:
1
)
+
(
Gp
/
C
));
}
else
{
}
else
{
start_meas
(
rm_stats
);
r_offset
+=
lte_rate_matching_turbo
(
dlsch
->
harq_processes
[
harq_pid
]
->
RTC
[
r
],
G
,
//G
...
...
@@ -553,34 +532,27 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
stop_meas
(
rm_stats
);
}
}
stop_meas
(
te_main_stats
);
stop_meas
(
te_main_stats
);
start_meas
(
te_wait_stats
);
if
(
worker_num
==
1
)
{
if
(
worker_num
==
1
)
{
wait_on_busy_condition
(
&
proc
->
tep
[
0
].
mutex_te
,
&
proc
->
tep
[
0
].
cond_te
,
&
proc
->
tep
[
0
].
instance_cnt_te
,
"te thread 0"
);
}
else
if
(
worker_num
==
2
)
{
}
else
if
(
worker_num
==
2
)
{
wait_on_busy_condition
(
&
proc
->
tep
[
0
].
mutex_te
,
&
proc
->
tep
[
0
].
cond_te
,
&
proc
->
tep
[
0
].
instance_cnt_te
,
"te thread 0"
);
wait_on_busy_condition
(
&
proc
->
tep
[
1
].
mutex_te
,
&
proc
->
tep
[
1
].
cond_te
,
&
proc
->
tep
[
1
].
instance_cnt_te
,
"te thread 1"
);
}
else
{
}
else
{
wait_on_busy_condition
(
&
proc
->
tep
[
0
].
mutex_te
,
&
proc
->
tep
[
0
].
cond_te
,
&
proc
->
tep
[
0
].
instance_cnt_te
,
"te thread 0"
);
wait_on_busy_condition
(
&
proc
->
tep
[
1
].
mutex_te
,
&
proc
->
tep
[
1
].
cond_te
,
&
proc
->
tep
[
1
].
instance_cnt_te
,
"te thread 1"
);
wait_on_busy_condition
(
&
proc
->
tep
[
2
].
mutex_te
,
&
proc
->
tep
[
2
].
cond_te
,
&
proc
->
tep
[
2
].
instance_cnt_te
,
"te thread 2"
);
}
stop_meas
(
te_wait_stats
);
stop_meas
(
te_wait_stats
);
/*if(opp_enabled == 1 && te_wait_stats->p_time>100*3000){
print_meas_now(te_wait_stats,"coding_wait",stderr);
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
}*/
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING
,
VCD_FUNCTION_OUT
);
return
(
0
);
}
int
dlsch_encoding_all
(
PHY_VARS_eNB
*
eNB
,
...
...
@@ -595,31 +567,25 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
time_stats_t
*
te_main_stats
,
time_stats_t
*
te_wakeup_stats0
,
time_stats_t
*
te_wakeup_stats1
,
time_stats_t
*
i_stats
)
{
time_stats_t
*
i_stats
)
{
int
encoding_return
=
0
;
unsigned
int
L
,
C
,
B
;
B
=
dlsch
->
harq_processes
[
dlsch
->
harq_ids
[
frame
%
2
][
subframe
]]
->
B
;
if
(
B
<=
6144
)
{
if
(
B
<=
6144
)
{
L
=
0
;
C
=
1
;
}
else
{
}
else
{
L
=
24
;
C
=
B
/
(
6144
-
L
);
if
((
6144
-
L
)
*
C
<
B
)
{
if
((
6144
-
L
)
*
C
<
B
)
{
C
=
C
+
1
;
}
}
if
(
get_thread_worker_conf
()
==
WORKER_ENABLE
)
{
if
(
C
>=
8
)
//one main three worker
{
if
(
get_thread_worker_conf
()
==
WORKER_ENABLE
)
{
if
(
C
>=
8
)
{
//one main three worker
encoding_return
=
dlsch_encoding_2threads
(
eNB
,
a
,
...
...
@@ -635,9 +601,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
te_wakeup_stats1
,
i_stats
,
3
);
}
else
if
(
C
>=
6
)
//one main two worker
{
}
else
if
(
C
>=
6
)
{
//one main two worker
encoding_return
=
dlsch_encoding_2threads
(
eNB
,
a
,
...
...
@@ -653,9 +617,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
te_wakeup_stats1
,
i_stats
,
2
);
}
else
if
(
C
>=
4
)
//one main one worker
{
}
else
if
(
C
>=
4
)
{
//one main one worker
encoding_return
=
dlsch_encoding_2threads
(
eNB
,
a
,
...
...
@@ -671,9 +633,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
te_wakeup_stats1
,
i_stats
,
1
);
}
else
{
}
else
{
encoding_return
=
dlsch_encoding
(
eNB
,
a
,
...
...
@@ -685,9 +645,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
te_stats
,
i_stats
);
}
}
else
{
}
else
{
encoding_return
=
dlsch_encoding
(
eNB
,
a
,
...
...
@@ -699,6 +657,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
te_stats
,
i_stats
);
}
return
encoding_return
;
}
...
...
@@ -711,27 +670,24 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t
subframe
,
time_stats_t
*
rm_stats
,
time_stats_t
*
te_stats
,
time_stats_t
*
i_stats
)
{
time_stats_t
*
i_stats
)
{
unsigned
int
G
;
unsigned
int
crc
=
1
;
LTE_DL_FRAME_PARMS
*
frame_parms
=
&
eNB
->
frame_parms
;
unsigned
char
harq_pid
=
dlsch
->
harq_ids
[
frame
%
2
][
subframe
];
if
(
harq_pid
>=
dlsch
->
Mdlharq
)
{
LOG_E
(
PHY
,
"dlsch_encoding illegal harq_pid %d
\n
"
,
harq_pid
);
return
(
-
1
);
}
unsigned
short
nb_rb
=
dlsch
->
harq_processes
[
harq_pid
]
->
nb_rb
;
unsigned
int
A
;
unsigned
char
mod_order
;
unsigned
int
Kr
=
0
,
Kr_bytes
,
r
,
r_offset
=
0
;
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
uint8_t
beamforming_mode
=
0
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING
,
VCD_FUNCTION_IN
);
A
=
dlsch
->
harq_processes
[
harq_pid
]
->
TBS
;
//6228
// printf("Encoder: A: %d\n",A);
mod_order
=
dlsch
->
harq_processes
[
harq_pid
]
->
Qm
;
...
...
@@ -742,8 +698,8 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
beamforming_mode
=
8
;
else
if
(
dlsch
->
harq_processes
[
harq_pid
]
->
mimo_mode
==
TM9_10
)
beamforming_mode
=
9
;
G
=
get_G
(
frame_parms
,
nb_rb
,
dlsch
->
harq_processes
[
harq_pid
]
->
rb_alloc
,
mod_order
,
dlsch
->
harq_processes
[
harq_pid
]
->
Nl
,
num_pdcch_symbols
,
frame
,
subframe
,
beamforming_mode
);
G
=
get_G
(
frame_parms
,
nb_rb
,
dlsch
->
harq_processes
[
harq_pid
]
->
rb_alloc
,
mod_order
,
dlsch
->
harq_processes
[
harq_pid
]
->
Nl
,
num_pdcch_symbols
,
frame
,
subframe
,
beamforming_mode
);
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
if
(
dlsch
->
harq_processes
[
harq_pid
]
->
round
==
0
)
{
// this is a new packet
...
...
@@ -758,14 +714,12 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("\n");
*/
// Add 24-bit crc (polynomial A) to payload
crc
=
crc24a
(
a
,
A
)
>>
8
;
a
[
A
>>
3
]
=
((
uint8_t
*
)
&
crc
)[
2
];
a
[
1
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
1
];
a
[
2
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
0
];
a
[
A
>>
3
]
=
((
uint8_t
*
)
&
crc
)[
2
];
a
[
1
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
1
];
a
[
2
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
0
];
// printf("CRC %x (A %d)\n",crc,A);
dlsch
->
harq_processes
[
harq_pid
]
->
B
=
A
+
24
;
// dlsch->harq_processes[harq_pid]->b = a;
memcpy
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
a
,(
A
/
8
)
+
4
);
...
...
@@ -782,25 +736,20 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
return
(
-
1
);
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
if
(
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
Cminus
)
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
Kminus
;
else
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
Kplus
;
Kr_bytes
=
Kr
>>
3
;
#ifdef DEBUG_DLSCH_CODING
printf
(
"Generating Code Segment %
d (%d
bits)
\n
"
,
r
,
Kr
);
printf
(
"Generating Code Segment %
u (%u
bits)
\n
"
,
r
,
Kr
);
// generate codewords
printf
(
"bits_per_codeword (Kr)= %d, A %d
\n
"
,
Kr
,
A
);
printf
(
"bits_per_codeword (Kr)= %u, A %u
\n
"
,
Kr
,
A
);
printf
(
"N_RB = %d
\n
"
,
nb_rb
);
printf
(
"Ncp %d
\n
"
,
frame_parms
->
Ncp
);
printf
(
"mod_order %d
\n
"
,
mod_order
);
#endif
start_meas
(
te_stats
);
encoder
(
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
r
],
Kr
>>
3
,
...
...
@@ -821,7 +770,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
dlsch
->
harq_processes
[
harq_pid
]
->
w
[
r
]);
stop_meas
(
i_stats
);
}
}
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
...
...
@@ -829,13 +777,12 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
for
(
r
=
0
;
r
<
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
r
++
)
{
#ifdef DEBUG_DLSCH_CODING
printf
(
"Rate Matching, Code segment %
d (coded bits (G) %d,unpunctured/repeated bits per code segment %d
,mod_order %d, nb_rb %d)...
\n
"
,
printf
(
"Rate Matching, Code segment %
u (coded bits (G) %u,unpunctured/repeated bits per code segment %u
,mod_order %d, nb_rb %d)...
\n
"
,
r
,
G
,
Kr
*
3
,
mod_order
,
nb_rb
);
#endif
start_meas
(
rm_stats
);
#ifdef DEBUG_DLSCH_CODING
printf
(
"rvidx in encoding = %d
\n
"
,
dlsch
->
harq_processes
[
harq_pid
]
->
rvidx
);
...
...
@@ -864,7 +811,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING
,
VCD_FUNCTION_OUT
);
return
(
0
);
}
...
...
openair1/SIMULATION/LTE_PHY/dlsim.c
View file @
63143b87
...
...
@@ -89,14 +89,11 @@ THREAD_STRUCT thread_struct;
int
emulate_rf
=
0
;
void
handler
(
int
sig
)
{
void
handler
(
int
sig
)
{
void
*
array
[
10
];
size_t
size
;
// get void*'s for all entries on the stack
size
=
backtrace
(
array
,
10
);
// print out all the frames to stderr
fprintf
(
stderr
,
"Error: signal %d:
\n
"
,
sig
);
backtrace_symbols_fd
(
array
,
size
,
2
);
...
...
@@ -114,17 +111,13 @@ uint64_t DLSCH_alloc_pdu_1[2];
#define CCCH_RB_ALLOC computeRIV(eNB->frame_parms.N_RB_UL,0,2)
//#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13
//#define DLSCH_RB_ALLOC 0x0001
void
do_OFDM_mod_l
(
int32_t
**
txdataF
,
int32_t
**
txdata
,
uint16_t
next_slot
,
LTE_DL_FRAME_PARMS
*
frame_parms
)
{
void
do_OFDM_mod_l
(
int32_t
**
txdataF
,
int32_t
**
txdata
,
uint16_t
next_slot
,
LTE_DL_FRAME_PARMS
*
frame_parms
)
{
int
aa
,
slot_offset
,
slot_offset_F
;
slot_offset_F
=
(
next_slot
)
*
(
frame_parms
->
ofdm_symbol_size
)
*
((
frame_parms
->
Ncp
==
1
)
?
6
:
7
);
slot_offset
=
(
next_slot
)
*
(
frame_parms
->
samples_per_tti
>>
1
);
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_tx
;
aa
++
)
{
// printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
if
(
frame_parms
->
Ncp
==
1
)
PHY_ofdm_mod
(
&
txdataF
[
aa
][
slot_offset_F
],
// input
&
txdata
[
aa
][
slot_offset
],
// output
...
...
@@ -138,15 +131,11 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
7
,
frame_parms
);
}
}
}
void
DL_channel
(
RU_t
*
ru
,
PHY_VARS_UE
*
UE
,
uint
subframe
,
int
awgn_flag
,
double
SNR
,
int
tx_lev
,
int
hold_channel
,
int
abstx
,
int
num_rounds
,
int
trials
,
int
round
,
channel_desc_t
*
eNB2UE
[
4
],
double
*
s_re
[
2
],
double
*
s_im
[
2
],
double
*
r_re
[
2
],
double
*
r_im
[
2
],
FILE
*
csv_fd
)
{
int
i
,
u
;
int
aa
,
aarx
,
aatx
;
double
channelx
,
channely
;
...
...
@@ -168,7 +157,6 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
r_re
[
aarx
][
i
]
+=
((
double
)(((
short
*
)
ru
->
common
.
txdata
[
aa
]))[(
2
*
subframe
*
UE
->
frame_parms
.
samples_per_tti
)
+
(
i
<<
1
)]);
r_im
[
aarx
][
i
]
+=
((
double
)(((
short
*
)
ru
->
common
.
txdata
[
aa
]))[(
2
*
subframe
*
UE
->
frame_parms
.
samples_per_tti
)
+
(
i
<<
1
)
+
1
]);
}
}
}
}
...
...
@@ -197,7 +185,6 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
}
}
if
(
abstx
)
{
if
(
trials
==
0
&&
round
==
0
)
{
// calculate freq domain representation to compute SINR
...
...
@@ -264,9 +251,9 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for
(
i
=
0
;
i
<
2
*
UE
->
frame_parms
.
samples_per_tti
;
i
++
)
{
for
(
aa
=
0
;
aa
<
UE
->
frame_parms
.
nb_antennas_rx
;
aa
++
)
{
//printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[(
2
*
subframe
*
UE
->
frame_parms
.
samples_per_tti
)
+
2
*
i
]
=
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[(
2
*
subframe
*
UE
->
frame_parms
.
samples_per_tti
)
+
2
*
i
]
=
(
short
)
(
r_re
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
));
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[(
2
*
subframe
*
UE
->
frame_parms
.
samples_per_tti
)
+
2
*
i
+
1
]
=
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[(
2
*
subframe
*
UE
->
frame_parms
.
samples_per_tti
)
+
2
*
i
+
1
]
=
(
short
)
(
r_im
[
aa
][
i
]
+
(
iqim
*
r_re
[
aa
][
i
])
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
));
}
}
...
...
@@ -277,12 +264,10 @@ fill_tx_req(nfapi_tx_request_body_t *tx_req_body,
uint16_t
absSF
,
uint16_t
pdu_length
,
uint16_t
pdu_index
,
uint8_t
*
pdu
)
{
uint8_t
*
pdu
)
{
nfapi_tx_request_pdu_t
*
TX_req
=
&
tx_req_body
->
tx_pdu_list
[
tx_req_body
->
number_of_pdus
];
LOG_D
(
MAC
,
"Filling TX_req %d for pdu length %d
\n
"
,
tx_req_body
->
number_of_pdus
,
pdu_length
);
TX_req
->
pdu_length
=
pdu_length
;
TX_req
->
pdu_index
=
pdu_index
;
TX_req
->
num_segments
=
1
;
...
...
@@ -290,12 +275,11 @@ fill_tx_req(nfapi_tx_request_body_t *tx_req_body,
TX_req
->
segments
[
0
].
segment_data
=
pdu
;
tx_req_body
->
tl
.
tag
=
NFAPI_TX_REQUEST_BODY_TAG
;
tx_req_body
->
number_of_pdus
++
;
return
(((
absSF
/
10
)
<<
4
)
+
(
absSF
%
10
));
}
void
fill_dlsch_config
(
nfapi_dl_config_request_body_t
*
dl_req
,
fill_dlsch_config
(
nfapi_dl_config_request_body_t
*
dl_req
,
uint16_t
length
,
uint16_t
pdu_index
,
uint16_t
rnti
,
...
...
@@ -317,13 +301,11 @@ fill_dlsch_config(nfapi_dl_config_request_body_t * dl_req,
uint8_t
nprb
,
uint8_t
transmission_mode
,
uint8_t
num_bf_prb_per_subband
,
uint8_t
num_bf_vector
)
{
uint8_t
num_bf_vector
)
{
nfapi_dl_config_request_pdu_t
*
dl_config_pdu
=
&
dl_req
->
dl_config_pdu_list
[
dl_req
->
number_pdu
];
memset
((
void
*
)
dl_config_pdu
,
0
,
sizeof
(
nfapi_dl_config_request_pdu_t
));
dl_config_pdu
->
pdu_type
=
NFAPI_DL_CONFIG_DLSCH_PDU_TYPE
;
dl_config_pdu
->
pdu_size
=
(
uint8_t
)
(
2
+
sizeof
(
nfapi_dl_config_dlsch_pdu
));
dl_config_pdu
->
dlsch_pdu
.
dlsch_pdu_rel8
.
tl
.
tag
=
NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG
;
...
...
@@ -374,14 +356,11 @@ void fill_DCI(PHY_VARS_eNB *eNB,
int
*
num_common_dci
,
int
*
num_ue_spec_dci
,
int
*
num_dci
)
{
int
k
;
nfapi_dl_config_request_body_t
*
dl_req
=&
sched_resp
->
DL_req
->
dl_config_request_body
;
nfapi_dl_config_request_pdu_t
*
dl_config_pdu
;
nfapi_tx_request_body_t
*
TX_req
=&
sched_resp
->
TX_req
->
tx_request_body
;
int
NB_RB4TBS
=
common_flag
==
0
?
NB_RB
:
(
2
+
TPC
);
dl_req
->
number_dci
=
0
;
dl_req
->
number_pdu
=
0
;
TX_req
->
number_of_pdus
=
0
;
...
...
@@ -389,9 +368,7 @@ void fill_DCI(PHY_VARS_eNB *eNB,
for
(
k
=
0
;
k
<
n_users
;
k
++
)
{
switch
(
transmission_mode
)
{
case
1
:
case
2
:
case
7
:
dl_config_pdu
=
&
dl_req
->
dl_config_pdu_list
[
dl_req
->
number_pdu
];
memset
((
void
*
)
dl_config_pdu
,
0
,
...
...
@@ -404,7 +381,6 @@ void fill_DCI(PHY_VARS_eNB *eNB,
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
rnti
=
(
common_flag
==
0
)
?
n_rnti
+
k
:
SI_RNTI
;
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
rnti_type
=
(
common_flag
==
0
)
?
1
:
2
;
// CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
transmission_power
=
6000
;
// equal to RS power
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
harq_process
=
0
;
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
tpc
=
TPC
;
// dont adjust power when retransmitting
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
new_data_indicator_1
=
(
common_flag
==
0
)
?
ndi
:
0
;
...
...
@@ -414,16 +390,12 @@ void fill_DCI(PHY_VARS_eNB *eNB,
//deactivate second codeword
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
mcs_2
=
0
;
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
redundancy_version_2
=
1
;
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
downlink_assignment_index
=
0
;
dl_config_pdu
->
dci_dl_pdu
.
dci_dl_pdu_rel8
.
cce_idx
=
0
;
dl_req
->
number_dci
++
;
dl_req
->
number_pdu
++
;
dl_req
->
tl
.
tag
=
NFAPI_DL_CONFIG_REQUEST_BODY_TAG
;
AssertFatal
(
TPC
>=
0
&&
TPC
<
2
,
"TPC should be 0 or 1
\n
"
);
fill_dlsch_config
(
dl_req
,
get_TBS_DL
(
mcs1
,
NB_RB4TBS
),
(
retrans
>
0
)
?
-
1
:
0
,
/* retransmission, no pdu_index */
...
...
@@ -453,52 +425,34 @@ void fill_DCI(PHY_VARS_eNB *eNB,
get_TBS_DL
(
mcs1
,
NB_RB4TBS
),
0
,
input_buffer
[
k
]);
break
;
case
3
:
if
(
common_flag
==
0
)
{
if
(
eNB
->
frame_parms
.
nb_antennas_tx
==
2
)
{
if
(
eNB
->
frame_parms
.
frame_type
==
TDD
)
{
}
else
{
}
else
{
}
}
}
break
;
case
4
:
if
(
common_flag
==
0
)
{
if
(
eNB
->
frame_parms
.
nb_antennas_tx
==
2
)
{
if
(
eNB
->
frame_parms
.
frame_type
==
TDD
)
{
}
else
{
}
else
{
}
}
else
if
(
eNB
->
frame_parms
.
nb_antennas_tx
==
4
)
{
}
}
else
{
}
else
{
}
break
;
case
5
:
case
6
:
break
;
default:
...
...
@@ -507,6 +461,7 @@ void fill_DCI(PHY_VARS_eNB *eNB,
break
;
}
}
*
num_dci
=
dl_req
->
number_dci
;
*
num_ue_spec_dci
=
dl_req
->
number_dci
;
*
num_common_dci
=
0
;
...
...
@@ -541,46 +496,33 @@ int verbose=0, help=0;
double
SNR
,
snr0
=-
2
.
0
,
snr1
,
rate
=
0
;
int
print_perf
=
0
;
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
int
k
,
i
,
j
,
aa
;
int
re
;
int
s
,
Kr
,
Kr_bytes
;
LTE_DL_FRAME_PARMS
*
frame_parms
;
double
s_re0
[
30720
*
2
],
s_im0
[
30720
*
2
],
r_re0
[
30720
*
2
],
r_im0
[
30720
*
2
];
double
s_re1
[
30720
*
2
],
s_im1
[
30720
*
2
],
r_re1
[
30720
*
2
],
r_im1
[
30720
*
2
];
double
*
s_re
[
2
]
=
{
s_re0
,
s_re1
};
double
*
s_im
[
2
]
=
{
s_im0
,
s_im1
};
double
*
r_re
[
2
]
=
{
r_re0
,
r_re1
};
double
*
r_im
[
2
]
=
{
r_im0
,
r_im1
};
double
*
s_re
[
2
]
=
{
s_re0
,
s_re1
};
double
*
s_im
[
2
]
=
{
s_im0
,
s_im1
};
double
*
r_re
[
2
]
=
{
r_re0
,
r_re1
};
double
*
r_im
[
2
]
=
{
r_im0
,
r_im1
};
uint8_t
transmission_mode
=
1
,
n_tx_port
=
1
,
n_tx_phy
=
1
,
n_rx
=
2
;
int
eNB_id
=
0
;
unsigned
char
round
;
unsigned
char
i_mod
=
2
;
int
NB_RB
;
SCM_t
channel_model
=
Rayleigh1
;
// unsigned char *input_data,*decoded_output;
DCI_ALLOC_t
da
;
DCI_ALLOC_t
*
dci_alloc
=
&
da
;
unsigned
int
coded_bits_per_codeword
=
0
,
nsymb
;
//,tbs=0;
unsigned
int
tx_lev
=
0
,
tx_lev_dB
=
0
,
trials
;
unsigned
int
errs
[
4
],
errs2
[
4
],
round_trials
[
4
],
dci_errors
[
4
];
//,num_layers;
memset
(
errs
,
0
,
4
*
sizeof
(
unsigned
int
));
memset
(
errs2
,
0
,
4
*
sizeof
(
unsigned
int
));
memset
(
round_trials
,
0
,
4
*
sizeof
(
unsigned
int
));
memset
(
dci_errors
,
0
,
4
*
sizeof
(
unsigned
int
));
//int re_allocated;
char
fname
[
32
],
vname
[
32
];
FILE
*
bler_fd
;
...
...
@@ -589,25 +531,20 @@ int main(int argc, char **argv)
char
time_meas_fname
[
256
];
// FILE *tikz_fd;
// char tikz_fname[256];
FILE
*
input_trch_fd
=
NULL
;
unsigned
char
input_trch_file
=
0
;
FILE
*
input_fd
=
NULL
;
unsigned
char
input_file
=
0
;
channel_desc_t
*
eNB2UE
[
4
];
//uint8_t num_pdcch_symbols_2=0;
//char stats_buffer[4096];
//int len;
//int u;
int
n
=
0
;
//int iii;
int
ch_realization
;
//int pmi_feedback=0;
int
hold_channel
=
0
;
// void *data;
// int ii;
// int bler;
...
...
@@ -617,23 +554,18 @@ int main(int argc, char **argv)
frame_t
frame_type
=
FDD
;
FD_lte_phy_scope_ue
*
form_ue
=
NULL
;
char
title
[
255
];
int
numCCE
=
0
;
//int dci_length_bytes=0,dci_length=0;
//double channel_bandwidth = 5.0, sampling_rate=7.68;
int
common_flag
=
0
,
TPC
=
0
;
double
cpu_freq_GHz
;
// time_stats_t ts;//,sts,usts;
int
avg_iter
,
iter_trials
;
int
rballocset
=
0
;
int
test_passed
=
0
;
double
effective_rate
=
0
.
0
;
char
channel_model_input
[
10
]
=
"I"
;
int
TB0_active
=
1
;
// LTE_DL_UE_HARQ_t *dlsch0_ue_harq;
// LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq;
uint8_t
Kmimo
;
...
...
@@ -642,11 +574,9 @@ int main(int argc, char **argv)
int
sf
;
int
CCE_table
[
800
];
opp_enabled
=
1
;
// to enable the time meas
FILE
*
csv_fd
=
NULL
;
char
csv_fname
[
FILENAME_MAX
];
int
DLSCH_RB_ALLOC
=
0
;
int
dci_received
;
PHY_VARS_eNB
*
eNB
;
RU_t
*
ru
;
...
...
@@ -659,42 +589,40 @@ int main(int argc, char **argv)
nfapi_tx_request_t
TX_req
;
Sched_Rsp_t
sched_resp
;
int
pa
=
dB0
;
#if defined(__arm__)
FILE
*
proc_fd
=
NULL
;
char
buf
[
64
];
memset
(
buf
,
0
,
sizeof
(
buf
));
proc_fd
=
fopen
(
"/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq"
,
"r"
);
if
(
!
proc_fd
)
printf
(
"cannot open /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq"
);
else
{
while
(
fgets
(
buf
,
63
,
proc_fd
))
printf
(
"%s"
,
buf
);
}
fclose
(
proc_fd
);
cpu_freq_GHz
=
((
double
)
atof
(
buf
))
/
1e6
;
#else
cpu_freq_GHz
=
get_cpu_freq_GHz
();
#endif
printf
(
"Detected cpu_freq %f GHz
\n
"
,
cpu_freq_GHz
);
memset
((
void
*
)
&
sched_resp
,
0
,
sizeof
(
sched_resp
));
memset
((
void
*
)
&
sched_resp
,
0
,
sizeof
(
sched_resp
));
sched_resp
.
DL_req
=
&
DL_req
;
sched_resp
.
UL_req
=
&
UL_req
;
sched_resp
.
HI_DCI0_req
=
&
HI_DCI0_req
;
sched_resp
.
TX_req
=
&
TX_req
;
memset
((
void
*
)
&
DL_req
,
0
,
sizeof
(
DL_req
));
memset
((
void
*
)
&
UL_req
,
0
,
sizeof
(
UL_req
));
memset
((
void
*
)
&
HI_DCI0_req
,
0
,
sizeof
(
HI_DCI0_req
));
memset
((
void
*
)
&
TX_req
,
0
,
sizeof
(
TX_req
));
memset
((
void
*
)
&
DL_req
,
0
,
sizeof
(
DL_req
));
memset
((
void
*
)
&
UL_req
,
0
,
sizeof
(
UL_req
));
memset
((
void
*
)
&
HI_DCI0_req
,
0
,
sizeof
(
HI_DCI0_req
));
memset
((
void
*
)
&
TX_req
,
0
,
sizeof
(
TX_req
));
DL_req
.
dl_config_request_body
.
dl_config_pdu_list
=
dl_config_pdu_list
;
TX_req
.
tx_request_body
.
tx_pdu_list
=
tx_pdu_list
;
set_parallel_conf
(
"PARALLEL_SINGLE_THREAD"
);
cpuf
=
cpu_freq_GHz
;
//signal(SIGSEGV, handler);
//signal(SIGABRT, handler);
// default parameters
n_frames
=
1000
;
snr0
=
0
;
...
...
@@ -748,13 +676,8 @@ int main(int argc, char **argv)
{
"help"
,
"display help and exit"
,
PARAMFLAG_BOOL
,
iptr
:&
help
,
defintval
:
0
,
TYPE_INT
,
0
},
{
""
,
""
,
0
,
iptr
:
NULL
,
defintval
:
0
,
TYPE_INT
,
0
},
};
struct
option
*
long_options
=
parse_oai_options
(
options
);
struct
option
*
long_options
=
parse_oai_options
(
options
);
int
option_index
;
int
res
;
while
((
res
=
getopt_long_only
(
argc
,
argv
,
""
,
long_options
,
&
option_index
))
==
0
)
{
...
...
@@ -889,7 +812,6 @@ int main(int argc, char **argv)
break
;
case
'x'
:
transmission_mode
=
atoi
(
optarg
);
...
...
@@ -958,6 +880,7 @@ int main(int argc, char **argv)
if
(
help
||
verbose
)
display_options_values
(
options
,
true
);
if
(
help
)
exit
(
0
);
...
...
@@ -965,8 +888,8 @@ int main(int argc, char **argv)
set_worker_conf
(
"WORKER_ENABLE"
);
if
(
transmission_mode
>
1
)
pa
=
dBm3
;
printf
(
"dlsim: tmode %d, pa %d
\n
"
,
transmission_mode
,
pa
);
printf
(
"dlsim: tmode %d, pa %d
\n
"
,
transmission_mode
,
pa
);
AssertFatal
(
load_configmodule
(
argc
,
argv
,
CONFIG_ENABLECMDLINEONLY
)
!=
NULL
,
"cannot load configuration module, exiting
\n
"
);
logInit
();
...
...
@@ -983,27 +906,31 @@ int main(int argc, char **argv)
switch
(
N_RB_DL
)
{
case
6
:
if
(
rballocset
==
0
)
DLSCH_RB_ALLOC
=
0x3f
;
num_pdcch_symbols
=
3
;
break
;
case
25
:
if
(
rballocset
==
0
)
DLSCH_RB_ALLOC
=
0x1fff
;
break
;
case
50
:
if
(
rballocset
==
0
)
DLSCH_RB_ALLOC
=
0x1ffff
;
break
;
case
100
:
if
(
rballocset
==
0
)
DLSCH_RB_ALLOC
=
0x1ffffff
;
break
;
}
NB_RB
=
conv_nprb
(
0
,
DLSCH_RB_ALLOC
,
N_RB_DL
);
}
else
{
}
else
{
if
(
rballocset
==
0
)
NB_RB
=
8
;
else
NB_RB
=
DLSCH_RB_ALLOC
;
AssertFatal
(
NB_RB
<=
N_RB_DL
,
"illegal NB_RB %d
\n
"
,
NB_RB
);
}
...
...
@@ -1025,9 +952,9 @@ int main(int argc, char **argv)
n_users
=
2
;
printf
(
"dual_stream_UE=%d
\n
"
,
dual_stream_UE
);
}
RC
.
nb_L1_inst
=
1
;
RC
.
nb_RU
=
1
;
lte_param_init
(
&
eNB
,
&
UE
,
&
ru
,
n_tx_port
,
n_tx_phy
,
...
...
@@ -1043,12 +970,13 @@ int main(int argc, char **argv)
threequarter_fs
,
osf
,
perfect_ce
);
RC
.
eNB
=
(
PHY_VARS_eNB
***
)
malloc
(
sizeof
(
PHY_VARS_eNB
**
));
RC
.
eNB
=
(
PHY_VARS_eNB
**
*
)
malloc
(
sizeof
(
PHY_VARS_eNB
**
));
RC
.
eNB
[
0
]
=
(
PHY_VARS_eNB
**
)
malloc
(
sizeof
(
PHY_VARS_eNB
*
));
RC
.
ru
=
(
RU_t
**
)
malloc
(
sizeof
(
RC
.
ru
));
RC
.
eNB
[
0
][
0
]
=
eNB
;
RC
.
ru
[
0
]
=
ru
;
printf
(
"lte_param_init done
\n
"
);
if
((
transmission_mode
==
1
)
||
(
transmission_mode
==
7
))
{
for
(
aa
=
0
;
aa
<
ru
->
nb_tx
;
aa
++
)
for
(
re
=
0
;
re
<
ru
->
frame_parms
.
ofdm_symbol_size
;
re
++
)
...
...
@@ -1061,6 +989,7 @@ int main(int argc, char **argv)
ru
->
do_precoding
=
1
;
eNB
->
mac_enabled
=
1
;
if
(
get_thread_worker_conf
()
==
WORKER_ENABLE
)
{
extern
void
init_td_thread
(
PHY_VARS_eNB
*
);
extern
void
init_te_thread
(
PHY_VARS_eNB
*
);
...
...
@@ -1069,27 +998,21 @@ int main(int argc, char **argv)
}
// callback functions required for phy_procedures_tx
// eNB_id_i = UE->n_connected_eNB;
printf
(
"Setting mcs1 = %d
\n
"
,
mcs1
);
printf
(
"Setting mcs2 = %d
\n
"
,
mcs2
);
printf
(
"NPRB = %d
\n
"
,
NB_RB
);
printf
(
"n_frames = %d
\n
"
,
n_frames
);
printf
(
"Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d
\n
"
,
transmission_mode
,
n_tx_phy
,
n_rx
,
extended_prefix_flag
);
snr1
=
snr0
+
snr_int
;
printf
(
"SNR0 %f, SNR1 %f
\n
"
,
snr0
,
snr1
);
uint8_t
input_buffer
[
NUMBER_OF_UE_MAX
][
20000
];
for
(
i
=
0
;
i
<
n_users
;
i
++
)
for
(
j
=
0
;
j
<
20000
;
j
++
)
input_buffer
[
i
][
j
]
=
(
uint8_t
)((
taus
())
&
255
);
for
(
i
=
0
;
i
<
n_users
;
i
++
)
for
(
j
=
0
;
j
<
20000
;
j
++
)
input_buffer
[
i
][
j
]
=
(
uint8_t
)((
taus
())
&
255
);
frame_parms
=
&
eNB
->
frame_parms
;
nsymb
=
(
eNB
->
frame_parms
.
Ncp
==
0
)
?
14
:
12
;
printf
(
"Channel Model= (%s,%d)
\n
"
,
channel_model_input
,
channel_model
);
printf
(
"SCM-A=%d, SCM-B=%d, SCM-C=%d, SCM-D=%d, EPA=%d, EVA=%d, ETU=%d, Rayleigh8=%d, Rayleigh1=%d, Rayleigh1_corr=%d, Rayleigh1_anticorr=%d, Rice1=%d, Rice8=%d
\n
"
,
SCM_A
,
SCM_B
,
SCM_C
,
SCM_D
,
EPA
,
EVA
,
ETU
,
Rayleigh8
,
Rayleigh1
,
Rayleigh1_corr
,
Rayleigh1_anticorr
,
Rice1
,
Rice8
);
...
...
@@ -1100,10 +1023,12 @@ int main(int argc, char **argv)
sprintf
(
bler_fname
,
"bler_tx%d_chan%d_nrx%d_mcs%d.csv"
,
transmission_mode
,
channel_model
,
n_rx
,
mcs1
);
bler_fd
=
fopen
(
bler_fname
,
"w"
);
if
(
bler_fd
==
NULL
)
{
fprintf
(
stderr
,
"Cannot create file %s!
\n
"
,
bler_fname
);
exit
(
-
1
);
}
fprintf
(
bler_fd
,
"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err
\n
"
);
if
(
test_perf
!=
0
)
{
...
...
@@ -1117,6 +1042,7 @@ int main(int argc, char **argv)
N_RB_DL
,
mcs1
,
n_tx_phy
,
n_rx
,
num_pdcch_symbols
,
channel_model_input
,
transmission_mode
);
//mkdir(dirname,0777);
time_meas_fd
=
fopen
(
time_meas_fname
,
"w"
);
if
(
time_meas_fd
==
NULL
)
{
fprintf
(
stderr
,
"Cannot create file %s!
\n
"
,
time_meas_fname
);
exit
(
-
1
);
...
...
@@ -1127,11 +1053,13 @@ int main(int argc, char **argv)
// CSV file
sprintf
(
csv_fname
,
"dataout_tx%d_u2%d_mcs%d_chan%d_nsimus%d_R%d.m"
,
transmission_mode
,
dual_stream_UE
,
mcs1
,
channel_model
,
n_frames
,
num_rounds
);
csv_fd
=
fopen
(
csv_fname
,
"w"
);
fprintf
(
csv_fd
,
"data_all%d=["
,
mcs1
);
if
(
csv_fd
==
NULL
)
{
fprintf
(
stderr
,
"Cannot create file %s!
\n
"
,
csv_fname
);
exit
(
-
1
);
}
fprintf
(
csv_fd
,
"data_all%d=["
,
mcs1
);
}
/*
...
...
@@ -1230,11 +1158,8 @@ int main(int argc, char **argv)
break;
}
*/
UE
->
pdcch_vars
[
UE
->
current_thread_id
[
subframe
]][
0
]
->
crnti
=
n_rnti
;
UE
->
n_connected_eNB
=
1
;
printf
(
"Allocating %dx%d eNB->UE channel descriptor
\n
"
,
eNB
->
frame_parms
.
nb_antennas_tx
,
UE
->
frame_parms
.
nb_antennas_rx
);
eNB2UE
[
0
]
=
new_channel_desc_scm
(
eNB
->
frame_parms
.
nb_antennas_tx
,
UE
->
frame_parms
.
nb_antennas_rx
,
...
...
@@ -1244,9 +1169,9 @@ int main(int argc, char **argv)
forgetting_factor
,
rx_sample_offset
,
0
);
reset_meas
(
&
eNB2UE
[
0
]
->
random_channel
);
reset_meas
(
&
eNB2UE
[
0
]
->
interp_time
);
if
(
num_rounds
>
1
)
{
for
(
n
=
1
;
n
<
4
;
n
++
)
{
eNB2UE
[
n
]
=
new_channel_desc_scm
(
eNB
->
frame_parms
.
nb_antennas_tx
,
...
...
@@ -1276,13 +1201,16 @@ int main(int argc, char **argv)
case
1
:
Nsoft
=
250368
;
break
;
case
2
:
case
3
:
Nsoft
=
1237248
;
break
;
case
4
:
Nsoft
=
1827072
;
break
;
default:
printf
(
"Unsupported UE category %d
\n
"
,
ue_category
);
exit
(
-
1
);
...
...
@@ -1324,12 +1252,10 @@ int main(int argc, char **argv)
UE
->
dlsch_SI
[
0
]
=
new_ue_dlsch
(
1
,
1
,
Nsoft
,
MAX_TURBO_ITERATIONS
,
N_RB_DL
,
0
);
UE
->
dlsch_ra
[
0
]
=
new_ue_dlsch
(
1
,
1
,
Nsoft
,
MAX_TURBO_ITERATIONS
,
N_RB_DL
,
0
);
UE
->
ulsch
[
0
]
=
new_ue_ulsch
(
N_RB_DL
,
0
);
// structure for SIC at UE
UE
->
dlsch_eNB
[
0
]
=
new_eNB_dlsch
(
Kmimo
,
8
,
Nsoft
,
N_RB_DL
,
0
,
&
eNB
->
frame_parms
);
if
(
DLSCH_alloc_pdu2_1E
[
0
].
tpmi
==
5
)
{
eNB
->
UE_stats
[
0
].
DL_pmi_single
=
(
unsigned
short
)(
taus
()
&
0xffff
);
if
(
n_users
>
1
)
...
...
@@ -1344,7 +1270,6 @@ int main(int argc, char **argv)
L1_rxtx_proc_t
*
proc_eNB
=
&
eNB
->
proc
.
L1_proc
;
if
(
input_fd
==
NULL
)
{
DL_req
.
dl_config_request_body
.
number_pdcch_ofdm_symbols
=
num_pdcch_symbols
;
DL_req
.
sfn_sf
=
(
proc_eNB
->
frame_tx
<<
4
)
+
subframe
;
TX_req
.
sfn_sf
=
(
proc_eNB
->
frame_tx
<<
4
)
+
subframe
;
...
...
@@ -1369,13 +1294,9 @@ int main(int argc, char **argv)
&
num_common_dci
,
&
num_ue_spec_dci
,
&
num_dci
);
numCCE
=
get_nCCE
(
num_pdcch_symbols
,
&
eNB
->
frame_parms
,
get_mi
(
&
eNB
->
frame_parms
,
subframe
));
if
(
n_frames
==
1
)
printf
(
"num_pdcch_symbols %d, numCCE %d, num_dci %d/%d/%d
\n
"
,
num_pdcch_symbols
,
numCCE
,
num_dci
,
num_ue_spec_dci
,
num_common_dci
);
}
snr_step
=
input_snr_step
;
...
...
@@ -1401,13 +1322,11 @@ int main(int argc, char **argv)
round_trials
[
1
]
=
0
;
round_trials
[
2
]
=
0
;
round_trials
[
3
]
=
0
;
dci_errors
[
0
]
=
0
;
dci_errors
[
1
]
=
0
;
dci_errors
[
2
]
=
0
;
dci_errors
[
3
]
=
0
;
// avg_ber = 0;
round
=
0
;
avg_iter
=
0
;
iter_trials
=
0
;
...
...
@@ -1422,6 +1341,7 @@ int main(int argc, char **argv)
reset_meas
(
&
eNB
->
dlsch_turbo_encoding_stats
);
reset_meas
(
&
eNB
->
dlsch_common_and_dci
);
reset_meas
(
&
eNB
->
dlsch_ue_specific
);
for
(
int
i
=
0
;
i
<
RX_NB_TH
;
i
++
)
{
reset_meas
(
&
UE
->
phy_proc_rx
[
i
]);
// total UE rx
reset_meas
(
&
UE
->
ue_front_end_stat
[
i
]);
...
...
@@ -1431,6 +1351,7 @@ int main(int argc, char **argv)
reset_meas
(
&
UE
->
dlsch_llr_stats_parallelization
[
i
][
0
]);
reset_meas
(
&
UE
->
dlsch_llr_stats_parallelization
[
i
][
1
]);
}
reset_meas
(
&
UE
->
ofdm_demod_stats
);
reset_meas
(
&
UE
->
crnti_procedures_stats
);
reset_meas
(
&
UE
->
dlsch_channel_estimation_stats
);
...
...
@@ -1469,7 +1390,6 @@ int main(int argc, char **argv)
//printf("Trial %d\n",trials);
fflush
(
stdout
);
round
=
0
;
//if (trials%100==0)
eNB2UE
[
0
]
->
first_run
=
1
;
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
eNB_id
][
0
]
->
harq_ack
[
subframe
].
ack
=
0
;
...
...
@@ -1500,26 +1420,22 @@ int main(int argc, char **argv)
}
if
(
input_fd
==
NULL
)
{
// Simulate HARQ procedures!!!
memset
(
CCE_table
,
0
,
800
*
sizeof
(
int
));
if
(
/*common_flag == 0*/
1
)
{
if
(
/*common_flag == 0*/
1
)
{
num_dci
=
0
;
num_common_dci
=
0
;
num_ue_spec_dci
=
0
;
if
(
round
==
0
)
{
// First round
TB0_active
=
1
;
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
rvidx
=
round
&
3
;
DL_req
.
sfn_sf
=
(
proc_eNB
->
frame_tx
<<
4
)
+
subframe
;
TX_req
.
sfn_sf
=
(
proc_eNB
->
frame_tx
<<
4
)
+
subframe
;
fill_DCI
(
eNB
,
proc_eNB
->
frame_tx
,
subframe
,
&
sched_resp
,
input_buffer
,
n_rnti
,
n_users
,
transmission_mode
,
0
,
common_flag
,
NB_RB
,
DLSCH_RB_ALLOC
,
TPC
,
mcs1
,
mcs2
,
!
(
trials
&
1
),
round
&
3
,
pa
,
&
num_common_dci
,
&
num_ue_spec_dci
,
&
num_dci
);
}
else
{
}
else
{
DL_req
.
sfn_sf
=
(
proc_eNB
->
frame_tx
<<
4
)
+
subframe
;
TX_req
.
sfn_sf
=
(
proc_eNB
->
frame_tx
<<
4
)
+
subframe
;
fill_DCI
(
eNB
,
proc_eNB
->
frame_tx
,
subframe
,
&
sched_resp
,
input_buffer
,
n_rnti
,
n_users
,
transmission_mode
,
1
,
common_flag
,
NB_RB
,
DLSCH_RB_ALLOC
,
TPC
,
...
...
@@ -1530,7 +1446,6 @@ int main(int argc, char **argv)
proc_eNB
->
subframe_tx
=
subframe
;
sched_resp
.
subframe
=
subframe
;
sched_resp
.
frame
=
proc_eNB
->
frame_tx
;
eNB
->
abstraction_flag
=
0
;
schedule_response
(
&
sched_resp
);
phy_procedures_eNB_TX
(
eNB
,
proc_eNB
,
1
);
...
...
@@ -1541,7 +1456,6 @@ int main(int argc, char **argv)
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
nb_rb
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
rb_alloc
[
0
],
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
mcs
);
coded_bits_per_codeword
=
get_G
(
&
eNB
->
frame_parms
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
nb_rb
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
rb_alloc
,
...
...
@@ -1551,24 +1465,17 @@ int main(int argc, char **argv)
0
,
subframe
,
transmission_mode
>=
7
?
transmission_mode
:
0
);
uncoded_ber_bit
=
(
short
*
)
malloc
(
sizeof
(
short
)
*
coded_bits_per_codeword
);
uncoded_ber_bit
=
(
short
*
)
malloc
(
sizeof
(
short
)
*
coded_bits_per_codeword
);
printf
(
"uncoded_ber_bit=%p
\n
"
,
uncoded_ber_bit
);
}
start_meas
(
&
eNB
->
ofdm_mod_stats
);
ru
->
proc
.
subframe_tx
=
subframe
;
memcpy
((
void
*
)
&
ru
->
frame_parms
,(
void
*
)
&
eNB
->
frame_parms
,
sizeof
(
LTE_DL_FRAME_PARMS
));
memcpy
((
void
*
)
&
ru
->
frame_parms
,(
void
*
)
&
eNB
->
frame_parms
,
sizeof
(
LTE_DL_FRAME_PARMS
));
feptx_prec
(
ru
);
feptx_ofdm
(
ru
);
stop_meas
(
&
eNB
->
ofdm_mod_stats
);
// generate next subframe for channel estimation
DL_req
.
dl_config_request_body
.
number_dci
=
0
;
DL_req
.
dl_config_request_body
.
number_pdu
=
0
;
TX_req
.
tx_request_body
.
number_of_pdus
=
0
;
...
...
@@ -1576,15 +1483,10 @@ int main(int argc, char **argv)
sched_resp
.
subframe
=
subframe
+
1
;
schedule_response
(
&
sched_resp
);
phy_procedures_eNB_TX
(
eNB
,
proc_eNB
,
0
);
ru
->
proc
.
subframe_tx
=
(
subframe
+
1
)
%
10
;
feptx_prec
(
ru
);
feptx_ofdm
(
ru
);
proc_eNB
->
frame_tx
++
;
tx_lev
=
0
;
for
(
aa
=
0
;
aa
<
eNB
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
...
...
@@ -1595,11 +1497,8 @@ int main(int argc, char **argv)
tx_lev_dB
=
(
unsigned
int
)
dB_fixed
(
tx_lev
);
if
(
n_frames
==
1
)
{
printf
(
"tx_lev = %d (%d dB)
\n
"
,
tx_lev
,
tx_lev_dB
);
printf
(
"tx_lev = %u (%u dB)
\n
"
,
tx_lev
,
tx_lev_dB
);
LOG_M
(
"txsig0.m"
,
"txs0"
,
&
ru
->
common
.
txdata
[
0
][
subframe
*
eNB
->
frame_parms
.
samples_per_tti
],
eNB
->
frame_parms
.
samples_per_tti
,
1
,
1
);
if
(
transmission_mode
<
7
)
{
...
...
@@ -1612,12 +1511,9 @@ int main(int argc, char **argv)
}
DL_channel
(
ru
,
UE
,
subframe
,
awgn_flag
,
SNR
,
tx_lev
,
hold_channel
,
abstx
,
num_rounds
,
trials
,
round
,
eNB2UE
,
s_re
,
s_im
,
r_re
,
r_im
,
csv_fd
);
UE_rxtx_proc_t
*
proc
=
&
UE
->
proc
.
proc_rxtx
[
UE
->
current_thread_id
[
subframe
]];
proc
->
subframe_rx
=
subframe
;
UE
->
UE_mode
[
0
]
=
PUSCH
;
// first symbol has to be done separately in one-shot mode
slot_fep
(
UE
,
0
,
...
...
@@ -1631,8 +1527,10 @@ int main(int argc, char **argv)
if
(
dci_flag
==
0
)
{
memcpy
(
dci_alloc
,
eNB
->
pdcch_vars
[
subframe
&
1
].
dci_alloc
,
num_dci
*
sizeof
(
DCI_ALLOC_t
));
UE
->
pdcch_vars
[
UE
->
current_thread_id
[
proc
->
subframe_rx
]][
eNB_id
]
->
num_pdcch_symbols
=
num_pdcch_symbols
;
if
(
n_frames
==
1
)
printf
(
"bypassing PDCCH/DCI detection
\n
"
);
if
(
generate_ue_dlsch_params_from_dci
(
proc
->
frame_rx
,
proc
->
subframe_rx
,
(
void
*
)
&
dci_alloc
[
0
].
dci_pdu
,
...
...
@@ -1648,14 +1546,10 @@ int main(int argc, char **argv)
P_RNTI
,
UE
->
transmission_mode
[
eNB_id
]
<
7
?
0
:
UE
->
transmission_mode
[
eNB_id
],
0
)
==
0
)
{
dump_dci
(
&
UE
->
frame_parms
,
&
dci_alloc
[
0
]);
//UE->dlsch[UE->current_thread_id[proc->subframe_rx]][eNB_id][0]->active = 1;
//UE->dlsch[UE->current_thread_id[proc->subframe_rx]][eNB_id][1]->active = 1;
UE
->
pdcch_vars
[
UE
->
current_thread_id
[
proc
->
subframe_rx
]][
eNB_id
]
->
num_pdcch_symbols
=
num_pdcch_symbols
;
UE
->
dlsch_received
[
eNB_id
]
++
;
}
else
{
LOG_E
(
PHY
,
"Problem in DCI!
\n
"
);
...
...
@@ -1663,32 +1557,24 @@ int main(int argc, char **argv)
}
dci_received
=
UE
->
pdcch_vars
[
UE
->
current_thread_id
[
proc
->
subframe_rx
]][
eNB_id
]
->
dci_received
;
phy_procedures_UE_RX
(
UE
,
proc
,
0
,
0
,
dci_flag
,
normal_txrx
);
dci_received
=
dci_received
-
UE
->
pdcch_vars
[
UE
->
current_thread_id
[
proc
->
subframe_rx
]][
eNB_id
]
->
dci_received
;
if
(
dci_flag
&&
(
dci_received
==
0
))
{
printf
(
"DCI not received
\n
"
);
dci_errors
[
round
]
++
;
LOG_M
(
"pdcchF0_ext.m"
,
"pdcchF_ext"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
rxdataF_ext
[
0
],
2
*
3
*
UE
->
frame_parms
.
ofdm_symbol_size
,
1
,
1
);
LOG_M
(
"pdcch00_ch0_ext.m"
,
"pdcch00_ch0_ext"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
dl_ch_estimates_ext
[
0
],
300
*
3
,
1
,
1
);
LOG_M
(
"pdcch_rxF_comp0.m"
,
"pdcch0_rxF_comp0"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
rxdataF_comp
[
0
],
4
*
300
,
1
,
1
);
LOG_M
(
"pdcch_rxF_llr.m"
,
"pdcch_llr"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
llr
,
2400
,
1
,
4
);
LOG_M
(
"rxsig0.m"
,
"rxs0"
,
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
10
*
UE
->
frame_parms
.
samples_per_tti
,
1
,
1
);
LOG_M
(
"rxsigF0.m"
,
"rxsF0"
,
&
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
UE
->
current_thread_id
[
subframe
]].
rxdataF
[
0
][
0
],
UE
->
frame_parms
.
ofdm_symbol_size
*
nsymb
,
1
,
1
);
exit
(
-
1
);
}
int
bit_errors
=
0
;
if
((
test_perf
==
0
)
&&
(
n_frames
==
1
))
{
if
((
test_perf
==
0
)
&&
(
n_frames
==
1
))
{
dlsch_unscrambling
(
&
eNB
->
frame_parms
,
0
,
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
],
...
...
@@ -1696,15 +1582,15 @@ int main(int argc, char **argv)
UE
->
pdsch_vars
[
UE
->
current_thread_id
[
subframe
]][
0
]
->
llr
[
0
],
0
,
subframe
<<
1
);
for
(
i
=
0
;
i
<
coded_bits_per_codeword
;
i
++
)
for
(
i
=
0
;
i
<
coded_bits_per_codeword
;
i
++
)
if
((
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
e
[
i
]
==
1
&&
UE
->
pdsch_vars
[
UE
->
current_thread_id
[
subframe
]][
0
]
->
llr
[
0
][
i
]
>
0
)
||
(
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
e
[
i
]
==
0
&&
UE
->
pdsch_vars
[
UE
->
current_thread_id
[
subframe
]][
0
]
->
llr
[
0
][
i
]
<
0
))
{
uncoded_ber_bit
[
bit_errors
++
]
=
1
;
printf
(
"error in pos %d : %d => %d
\n
"
,
i
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
e
[
i
],
UE
->
pdsch_vars
[
UE
->
current_thread_id
[
subframe
]][
0
]
->
llr
[
0
][
i
]);
}
else
{
}
else
{
/*
printf("no error in pos %d : %d => %d\n",i,
eNB->dlsch[0][0]->harq_processes[0]->e[i],
...
...
@@ -1720,7 +1606,6 @@ int main(int argc, char **argv)
//common vars
LOG_M
(
"rxsig0.m"
,
"rxs0"
,
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
10
*
UE
->
frame_parms
.
samples_per_tti
,
1
,
1
);
LOG_M
(
"rxsigF0.m"
,
"rxsF0"
,
&
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
UE
->
current_thread_id
[
subframe
]].
rxdataF
[
0
][
0
],
UE
->
frame_parms
.
ofdm_symbol_size
*
nsymb
,
1
,
1
);
if
(
UE
->
frame_parms
.
nb_antennas_rx
>
1
)
{
...
...
@@ -1748,23 +1633,17 @@ int main(int argc, char **argv)
UE
->
frame_parms
.
ofdm_symbol_size
*
nsymb
/
2
,
1
,
1
);
//pdsch_vars
printf
(
"coded_bits_per_codeword %d
\n
"
,
coded_bits_per_codeword
);
printf
(
"coded_bits_per_codeword %u
\n
"
,
coded_bits_per_codeword
);
dump_dlsch2
(
UE
,
eNB_id
,
subframe
,
&
coded_bits_per_codeword
,
round
,
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
current_harq_pid
);
LOG_M
(
"dlsch_e.m"
,
"e"
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
e
,
coded_bits_per_codeword
,
1
,
4
);
//pdcch_vars
LOG_M
(
"pdcchF0_ext.m"
,
"pdcchF_ext"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
rxdataF_ext
[
0
],
2
*
3
*
UE
->
frame_parms
.
ofdm_symbol_size
,
1
,
1
);
LOG_M
(
"pdcch00_ch0_ext.m"
,
"pdcch00_ch0_ext"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
dl_ch_estimates_ext
[
0
],
300
*
3
,
1
,
1
);
LOG_M
(
"pdcch_rxF_comp0.m"
,
"pdcch0_rxF_comp0"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
rxdataF_comp
[
0
],
4
*
300
,
1
,
1
);
LOG_M
(
"pdcch_rxF_llr.m"
,
"pdcch_llr"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
llr
,
2400
,
1
,
4
);
}
if
(
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
eNB_id
][
0
]
->
harq_ack
[
subframe
].
ack
==
1
)
{
avg_iter
+=
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
eNB_id
][
0
]
->
last_iteration_cnt
;
iter_trials
++
;
...
...
@@ -1773,18 +1652,13 @@ int main(int argc, char **argv)
UE
->
total_TBS
[
eNB_id
]
=
UE
->
total_TBS
[
eNB_id
]
+
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
eNB_id
][
0
]
->
harq_processes
[
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
eNB_id
][
0
]
->
current_harq_pid
]
->
TBS
;
TB0_active
=
0
;
}
// DLSCH received ok
else
{
errs
[
round
]
++
;
avg_iter
+=
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
eNB_id
][
0
]
->
last_iteration_cnt
-
1
;
iter_trials
++
;
if
(
n_frames
==
1
)
{
//if ((n_frames==1) || (SNR>=30)) {
printf
(
"DLSCH errors found (round %d), uncoded ber %f
\n
"
,
round
,(
double
)
bit_errors
/
coded_bits_per_codeword
);
...
...
@@ -1795,11 +1669,11 @@ int main(int argc, char **argv)
Kr
=
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
Kplus
;
Kr_bytes
=
Kr
>>
3
;
printf
(
"Decoded_output (Segment %d):
\n
"
,
s
);
for
(
i
=
0
;
i
<
Kr_bytes
;
i
++
)
printf
(
"%d : %x (%x)
\n
"
,
i
,
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
c
[
s
][
i
],
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
c
[
s
][
i
]
^
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
c
[
s
][
i
]);
printf
(
"%d : %x (%x)
\n
"
,
i
,
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
c
[
s
][
i
],
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
c
[
s
][
i
]
^
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
c
[
s
][
i
]);
}
sprintf
(
fname
,
"rxsig0_r%d.m"
,
round
);
...
...
@@ -1807,7 +1681,6 @@ int main(int argc, char **argv)
LOG_M
(
fname
,
vname
,
&
UE
->
common_vars
.
rxdata
[
0
][
0
],
10
*
UE
->
frame_parms
.
samples_per_tti
,
1
,
1
);
sprintf
(
fname
,
"rxsigF0_r%d.m"
,
round
);
sprintf
(
vname
,
"rxs0F_r%d"
,
round
);
LOG_M
(
fname
,
vname
,
&
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
UE
->
current_thread_id
[
subframe
]].
rxdataF
[
0
][
0
],
UE
->
frame_parms
.
ofdm_symbol_size
*
nsymb
,
1
,
1
);
if
(
UE
->
frame_parms
.
nb_antennas_rx
>
1
)
{
...
...
@@ -1851,8 +1724,6 @@ int main(int argc, char **argv)
//pdsch_vars
dump_dlsch2
(
UE
,
eNB_id
,
subframe
,
&
coded_bits_per_codeword
,
round
,
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
current_harq_pid
);
//LOG_M("dlsch_e.m","e",eNB->dlsch[0][0]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
//LOG_M("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
//LOG_M("dlsch_w.m","w",eNB->dlsch[0][0]->harq_processes[0]->w[0],3*(tbs+64),1,4);
...
...
@@ -1860,7 +1731,6 @@ int main(int argc, char **argv)
//pdcch_vars
LOG_M
(
"pdcchF0_ext.m"
,
"pdcchF_ext"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
rxdataF_ext
[
0
],
2
*
3
*
UE
->
frame_parms
.
ofdm_symbol_size
,
1
,
1
);
LOG_M
(
"pdcch00_ch0_ext.m"
,
"pdcch00_ch0_ext"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
dl_ch_estimates_ext
[
0
],
300
*
3
,
1
,
1
);
LOG_M
(
"pdcch_rxF_comp0.m"
,
"pdcch0_rxF_comp0"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
rxdataF_comp
[
0
],
4
*
300
,
1
,
1
);
LOG_M
(
"pdcch_rxF_llr.m"
,
"pdcch_llr"
,
UE
->
pdcch_vars
[
0
][
eNB_id
]
->
llr
,
2400
,
1
,
4
);
...
...
@@ -1868,7 +1738,6 @@ int main(int argc, char **argv)
}
// printf("round %d errors %d/%d\n",round,errs[round],trials);
round
++
;
// UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->round++;
}
...
...
@@ -1899,9 +1768,6 @@ int main(int argc, char **argv)
UE
->
total_TBS_last
[
eNB_id
]
=
UE
->
total_TBS
[
eNB_id
];
}
/* calculate the total processing time for each packet,
* get the max, min, and number of packets that exceed t>2000us
*/
...
...
@@ -1914,8 +1780,6 @@ int main(int argc, char **argv)
sumUpStats
(
&
dlsch_procedures_tot
,
UE
->
dlsch_procedures_stat
,
UE
->
current_thread_id
[
subframe
]);
sumUpStats
(
&
dlsch_decoding_tot
,
UE
->
dlsch_decoding_stats
,
UE
->
current_thread_id
[
subframe
]);
sumUpStatsSlot
(
&
dlsch_llr_tot
,
UE
->
dlsch_llr_stats_parallelization
,
UE
->
current_thread_id
[
subframe
]);
double
t_rx_fft
=
inMicroS
(
UE
->
ofdm_demod_stats
.
p_time
);
double
t_rx_demod
=
inMicroS
(
UE
->
dlsch_rx_pdcch_stats
.
p_time
);
double
t_rx_dec
=
inMicroS
(
UE
->
dlsch_decoding_stats
[
UE
->
current_thread_id
[
subframe
]].
p_time
);
...
...
@@ -1932,7 +1796,6 @@ int main(int argc, char **argv)
appendVarArray
(
table_rx_fft
,
&
t_rx_fft
);
appendVarArray
(
table_rx_demod
,
&
t_rx_demod
);
appendVarArray
(
table_rx_dec
,
&
t_rx_dec
);
}
//trials
// round_trials[0]: number of code word : goodput the protocol
...
...
@@ -1953,12 +1816,10 @@ int main(int argc, char **argv)
}
effective_rate
=
1
.
0
-
((
double
)(
errs
[
0
]
+
errs
[
1
]
+
errs
[
2
]
+
errs
[
3
])
/
((
double
)
round_trials
[
0
]
+
round_trials
[
1
]
+
round_trials
[
2
]
+
round_trials
[
3
]));
printf
(
"
\n
**********************SNR = %f dB (tx_lev %f)**************************
\n
"
,
SNR
,
(
double
)
tx_lev_dB
+
10
*
log10
(
UE
->
frame_parms
.
ofdm_symbol_size
/
(
NB_RB
*
12
)));
printf
(
"Errors (%d(%d)/%d %d/%d %d/%d %d/%d), Pe = (%e,%e,%e,%e), dci_errors %d/%d, Pe = %e => effective rate %f, normalized delay %f (%f)
\n
"
,
printf
(
"Errors (%u(%u)/%u %u/%u %u/%u %u/%u), Pe = (%e,%e,%e,%e), dci_errors %u/%u, Pe = %e => effective rate %f, normalized delay %f (%f)
\n
"
,
errs
[
0
],
errs2
[
0
],
round_trials
[
0
],
...
...
@@ -1982,8 +1843,8 @@ int main(int argc, char **argv)
(
1
.
0
*
(
round_trials
[
0
]
-
errs
[
0
])
+
2
.
0
*
(
round_trials
[
1
]
-
errs
[
1
])
+
3
.
0
*
(
round_trials
[
2
]
-
errs
[
2
])
+
4
.
0
*
(
round_trials
[
3
]
-
errs
[
3
]))
/
((
double
)
round_trials
[
0
])
/
(
double
)
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
(
1
.
0
*
(
round_trials
[
0
]
-
errs
[
0
])
+
2
.
0
*
(
round_trials
[
1
]
-
errs
[
1
])
+
3
.
0
*
(
round_trials
[
2
]
-
errs
[
2
])
+
4
.
0
*
(
round_trials
[
3
]
-
errs
[
3
]))
/
((
double
)
round_trials
[
0
]));
double
timeBase
=
1
/
(
1000
*
cpu_freq_GHz
);
if
(
print_perf
==
1
)
{
printf
(
"
\n
eNB TX function statistics (per 1ms subframe)
\n
"
);
printDistribution
(
&
eNB
->
phy_proc_tx
,
table_tx
,
"PHY proc tx"
);
...
...
@@ -1996,7 +1857,6 @@ int main(int argc, char **argv)
printStatIndent2
(
&
eNB
->
dlsch_scrambling_stats
,
"DLSCH scrambling time"
);
printStatIndent2
(
&
eNB
->
dlsch_modulation_stats
,
"DLSCH modulation time"
);
printDistribution
(
&
eNB
->
ofdm_mod_stats
,
table_tx_ifft
,
"OFDM_mod (idft) time"
);
printf
(
"
\n
UE RX function statistics (per 1ms subframe)
\n
"
);
printDistribution
(
&
phy_proc_rx_tot
,
table_rx
,
"Total PHY proc rx"
);
printStatIndent
(
&
ue_front_end_tot
,
"Front end processing"
);
...
...
@@ -2014,7 +1874,6 @@ int main(int argc, char **argv)
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
Cminus
?
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
Kminus
:
UE
->
dlsch
[
UE
->
current_thread_id
[
subframe
]][
0
][
0
]
->
harq_processes
[
0
]
->
Kplus
,
UE
->
dlsch_tc_intl1_stats
.
trials
/
(
double
)
UE
->
dlsch_tc_init_stats
.
trials
,
(
double
)
UE
->
dlsch_turbo_decoding_stats
.
diff
/
UE
->
dlsch_turbo_decoding_stats
.
trials
*
timeBase
,
(
int
)((
double
)
UE
->
dlsch_turbo_decoding_stats
.
diff
/
UE
->
dlsch_turbo_decoding_stats
.
trials
),
...
...
@@ -2026,11 +1885,10 @@ int main(int argc, char **argv)
printStatIndent2
(
&
UE
->
dlsch_tc_ext_stats
,
"ext"
);
printStatIndent2
(
&
UE
->
dlsch_tc_intl1_stats
,
"turbo internal interleaver"
);
printStatIndent2
(
&
UE
->
dlsch_tc_intl2_stats
,
"intl2+HardDecode+CRC"
);
}
if
((
transmission_mode
!=
3
)
&&
(
transmission_mode
!=
4
))
{
fprintf
(
bler_fd
,
"%f;%d;%d;%f;%
d;%d;%d;%d;%d;%d;%d;%d;%d
\n
"
,
fprintf
(
bler_fd
,
"%f;%d;%d;%f;%
u;%u;%u;%u;%u;%u;%u;%u;%u
\n
"
,
SNR
,
mcs1
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
...
...
@@ -2045,7 +1903,7 @@ int main(int argc, char **argv)
round_trials
[
3
],
dci_errors
[
0
]);
}
else
{
fprintf
(
bler_fd
,
"%f;%d;%d;%d;%d;%f;%
d;%d;%d;%d;%d;%d;%d;%d;%d
\n
"
,
fprintf
(
bler_fd
,
"%f;%d;%d;%d;%d;%f;%
u;%u;%u;%u;%u;%u;%u;%u;%u
\n
"
,
SNR
,
mcs1
,
mcs2
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
...
...
@@ -2062,7 +1920,6 @@ int main(int argc, char **argv)
dci_errors
[
0
]);
}
if
(
abstx
)
{
//ABSTRACTION
blerr
[
0
]
=
(
double
)
errs
[
0
]
/
(
round_trials
[
0
]);
...
...
@@ -2079,7 +1936,7 @@ int main(int argc, char **argv)
if
(
(
test_perf
!=
0
)
&&
(
100
*
effective_rate
>
test_perf
))
{
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n");
if
((
transmission_mode
!=
3
)
&&
(
transmission_mode
!=
4
))
{
fprintf
(
time_meas_fd
,
"%f;%d;%d;%f;%
d;%d;%d;%d;%d;%d;%d;%d;%d
;"
,
fprintf
(
time_meas_fd
,
"%f;%d;%d;%f;%
u;%u;%u;%u;%u;%u;%u;%u;%u
;"
,
SNR
,
mcs1
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
...
...
@@ -2093,9 +1950,8 @@ int main(int argc, char **argv)
errs
[
3
],
round_trials
[
3
],
dci_errors
[
0
]);
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; DL_DECOD_ITER; err0; trials0; err1; trials1; err2; trials2; err3; trials3; PE; dci_err;PE;ND;\n");
fprintf
(
time_meas_fd
,
"%f;%d;%d;%f; %2.1f%%;%f;%f;%
d;%d;%d;%d;%d;%d;%d;%d;%e;%e;%e;%e;%d;%d
;%e;%f;%f;"
,
fprintf
(
time_meas_fd
,
"%f;%d;%d;%f; %2.1f%%;%f;%f;%
u;%u;%u;%u;%u;%u;%u;%u;%e;%e;%e;%e;%u;%u
;%e;%f;%f;"
,
SNR
,
mcs1
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
...
...
@@ -2122,7 +1978,7 @@ int main(int argc, char **argv)
(
double
)
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
(
1
.
0
*
(
round_trials
[
0
]
-
errs
[
0
])
+
2
.
0
*
(
round_trials
[
1
]
-
errs
[
1
])
+
3
.
0
*
(
round_trials
[
2
]
-
errs
[
2
])
+
4
.
0
*
(
round_trials
[
3
]
-
errs
[
3
]))
/
((
double
)
round_trials
[
0
]));
}
else
{
fprintf
(
time_meas_fd
,
"%f;%d;%d;%d;%d;%f;%
d;%d;%d;%d;%d;%d;%d;%d;%d
;"
,
fprintf
(
time_meas_fd
,
"%f;%d;%d;%d;%d;%f;%
u;%u;%u;%u;%u;%u;%u;%u;%u
;"
,
SNR
,
mcs1
,
mcs2
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
...
...
@@ -2137,9 +1993,8 @@ int main(int argc, char **argv)
errs
[
3
],
round_trials
[
3
],
dci_errors
[
0
]);
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; DL_DECOD_ITER; err0; trials0; err1; trials1; err2; trials2; err3; trials3; PE; dci_err;PE;ND;\n");
fprintf
(
time_meas_fd
,
"%f;%d;%d;%d;%d;%f;%2.1f;%f;%f;%
d;%d;%d;%d;%d;%d;%d;%d;%e;%e;%e;%e;%d;%d
;%e;%f;%f;"
,
fprintf
(
time_meas_fd
,
"%f;%d;%d;%d;%d;%f;%2.1f;%f;%f;%
u;%u;%u;%u;%u;%u;%u;%u;%e;%e;%e;%e;%u;%u
;%e;%f;%f;"
,
SNR
,
mcs1
,
mcs2
,
eNB
->
dlsch
[
0
][
0
]
->
harq_processes
[
0
]
->
TBS
,
...
...
@@ -2225,7 +2080,6 @@ int main(int argc, char **argv)
fprintf
(
time_meas_fd
,
"%f;%f;%f;%f
\n
"
,
squareRoot
(
&
UE
->
dlsch_decoding_stats
[
subframe
]),
median
(
table_rx_dec
),
q1
(
table_rx_dec
),
q3
(
table_rx_dec
));
printf
(
"[passed] effective rate : %f (%2.1f%%,%f)): log and break
\n
"
,
rate
*
effective_rate
,
100
*
effective_rate
,
rate
);
test_passed
=
1
;
break
;
...
...
@@ -2237,11 +2091,8 @@ int main(int argc, char **argv)
if
(((
double
)
errs
[
0
]
/
(
round_trials
[
0
]))
<
(
10
.
0
/
n_frames
))
break
;
}
// SNR
}
//ch_realization
fclose
(
bler_fd
);
if
(
test_perf
!=
0
)
...
...
@@ -2265,7 +2116,6 @@ int main(int argc, char **argv)
free
(
uncoded_ber_bit
);
uncoded_ber_bit
=
NULL
;
printf
(
"Freeing dlsch structures
\n
"
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
...
...
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