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
canghaiwuhen
OpenXG-RAN
Commits
17e4f0f1
Commit
17e4f0f1
authored
Aug 22, 2019
by
Ahmed Hussein
Committed by
Thomas Schlichter
Oct 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reordering frame and SNR loops
parent
675c0dff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
102 deletions
+109
-102
openair1/SIMULATION/NR_PHY/ulsim.c
openair1/SIMULATION/NR_PHY/ulsim.c
+109
-102
No files found.
openair1/SIMULATION/NR_PHY/ulsim.c
View file @
17e4f0f1
...
...
@@ -393,9 +393,9 @@ int main(int argc, char **argv)
unsigned
char
*
estimated_output_bit
;
unsigned
char
*
test_input_bit
;
uint32_t
errors_
bit
=
0
;
uint32_t
errors_
decoding
=
0
;
uint32_t
errors_scrambling
=
0
;
uint32_t
frames_in_error
=
0
;
uint32_t
is_frame_in_error
=
0
;
test_input_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
estimated_output_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
...
...
@@ -403,11 +403,17 @@ int main(int argc, char **argv)
nr_scheduled_response_t
scheduled_response
;
fapi_nr_ul_config_request_t
ul_config
;
printf
(
"
\n
"
);
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
snr_step
)
{
printf
(
"-------------------
\n
"
);
printf
(
"SNR %f
\n
"
,
SNR
);
printf
(
"-------------------
\n
"
);
is_frame_in_error
=
0
;
for
(
int
frame
=
0
;
frame
<
number_of_frames
;
frame
++
)
{
// printf("***********\n");
// printf("frame = %d\n", frame);
// printf("***********\n");
UE_proc
.
nr_tti_tx
=
slot
;
UE_proc
.
frame_tx
=
frame
;
...
...
@@ -469,8 +475,6 @@ int main(int argc, char **argv)
txlev_float
=
(
double
)
txlev
/
(
double
)
AMP
;
// output of signal_energy is fixed point representation
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
snr_step
)
{
n_errors
=
0
;
n_false_positive
=
0
;
...
...
@@ -481,21 +485,29 @@ int main(int argc, char **argv)
for
(
trial
=
0
;
trial
<
n_trials
;
trial
++
)
{
errors_scrambling
=
0
;
errors_
bit
=
0
;
errors_
decoding
=
0
;
//----------------------------------------------------------
//------------------------ add noise -----------------------
//----------------------------------------------------------
for
(
i
=
0
;
i
<
frame_length_complex_samples
;
i
++
)
{
for
(
ap
=
0
;
ap
<
frame_parms
->
nb_antennas_rx
;
ap
++
)
{
((
short
*
)
gNB
->
common_vars
.
rxdata
[
ap
])[
2
*
i
]
=
(((
int16_t
*
)
UE
->
common_vars
.
txdata
[
ap
])[(
i
<<
1
)])
+
(
int16_t
)(
sqrt
(
sigma
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
double
)
AMP
);
// convert to fixed point
((
short
*
)
gNB
->
common_vars
.
rxdata
[
ap
])[
2
*
i
+
1
]
=
(((
int16_t
*
)
UE
->
common_vars
.
txdata
[
ap
])[(
i
<<
1
)
+
1
])
+
(
int16_t
)(
sqrt
(
sigma
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
double
)
AMP
);
}
}
////////////////////////////////////////////////////////////
//----------------------------------------------------------
//------------------- gNB phy procedures -------------------
//----------------------------------------------------------
phy_procedures_gNB_common_RX
(
gNB
,
frame
,
slot
);
phy_procedures_gNB_uespec_RX
(
gNB
,
frame
,
slot
,
rel15_ul
->
ulsch_pdu_rel15
.
start_symbol
,
rel15_ul
->
ulsch_pdu_rel15
.
start_symbol
+
rel15_ul
->
ulsch_pdu_rel15
.
number_symbols
);
////////////////////////////////////////////////////////////
//----------------------------------------------------------
//-----------------
----- count errors -----
-----------------
//-----------------
count and print errors
-----------------
//----------------------------------------------------------
for
(
i
=
0
;
i
<
available_bits
;
i
++
)
{
...
...
@@ -503,54 +515,49 @@ int main(int argc, char **argv)
if
(((
ulsch_ue
[
0
]
->
g
[
i
]
==
0
)
&&
(
gNB
->
pusch_vars
[
UE_id
]
->
llr
[
i
]
<=
0
))
||
((
ulsch_ue
[
0
]
->
g
[
i
]
==
1
)
&&
(
gNB
->
pusch_vars
[
UE_id
]
->
llr
[
i
]
>=
0
)))
{
if
(
errors_scrambling
==
0
)
{
printf
(
"
\n
"
);
printf
(
"First bit in error in unscrambling in frame %d = %d
\n
"
,
frame
,
i
);
}
if
(
errors_scrambling
==
0
)
printf
(
"
\x1B
[34m"
"[frame %d][trial %d]
\t
1st bit in error in unscrambling = %d
\n
"
"
\x1B
[0m"
,
frame
,
trial
,
i
);
errors_scrambling
++
;
}
}
if
(
errors_scrambling
>
0
)
{
printf
(
"
\x1B
[31m""[frame %d][trial %d]
\t
number of errors in unscrambling = %d
\n
"
"
\x1B
[0m"
,
frame
,
trial
,
errors_scrambling
);
}
for
(
i
=
0
;
i
<
TBS
;
i
++
)
{
estimated_output_bit
[
i
]
=
(
ulsch_gNB
->
harq_processes
[
harq_pid
]
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
test_input_bit
[
i
]
=
(
ulsch_ue
[
0
]
->
harq_processes
[
harq_pid
]
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
// Further correct for multiple segments
test_input_bit
[
i
]
=
(
ulsch_ue
[
0
]
->
harq_processes
[
harq_pid
]
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
if
(
estimated_output_bit
[
i
]
!=
test_input_bit
[
i
])
{
if
(
errors_
bit
==
0
)
printf
(
"
First bit in error in decoding in frame %d = %d
\n
"
,
frame
,
i
);
errors_
bit
++
;
if
(
errors_
decoding
==
0
)
printf
(
"
\x1B
[34m""[frame %d][trial %d]
\t
1st bit in error in decoding = %d
\n
"
"
\x1B
[0m"
,
frame
,
trial
,
i
);
errors_
decoding
++
;
}
}
////////////////////////////////////////////////////////////
if
(
errors_scrambling
>
0
)
{
if
(
n_trials
==
1
)
printf
(
"frame %d, errors_scrambling = %d (trial %d)
\n
"
,
frame
,
errors_scrambling
,
trial
);
}
if
(
errors_bit
>
0
)
{
frames_in_error
++
;
if
(
errors_decoding
>
0
)
{
is_frame_in_error
=
1
;
n_false_positive
++
;
if
(
n_trials
==
1
)
printf
(
"frame %d, errors_bit = %d (trial %d)
\n
"
,
frame
,
errors_bit
,
trial
);
printf
(
"*****************************************
\n
"
);
printf
(
"SNR %f, (false positive %f)
\n
"
,
SNR
,
(
float
)
n_false_positive
/
(
float
)
n_trials
);
printf
(
"*****************************************
\n
"
);
printf
(
"
\n
"
);
printf
(
"
\x1B
[31m""[frame %d][trial %d]
\t
number of errors in decoding = %d
\n
"
"
\x1B
[0m"
,
frame
,
trial
,
errors_decoding
);
}
else
{
is_frame_in_error
=
0
;
break
;
}
}
// [hna] for (trial = 0; trial < n_trials; trial++)
////////////////////////////////////////////////////////////
}
// trial loop
if
(
errors_bit
==
0
)
if
(
is_frame_in_error
==
1
)
break
;
}
// [hna] for (SNR = snr0; SNR < snr1; SNR += snr_step)
}
// frame loop
if
(
frames_in_error
==
0
)
{
if
(
is_frame_in_error
==
0
)
break
;
}
// SNR loop
if
(
is_frame_in_error
==
0
)
{
printf
(
"
\n
"
);
printf
(
"*************
\n
"
);
printf
(
"PUSCH test OK
\n
"
);
printf
(
"*************
\n
"
);
...
...
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