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
540b472e
Commit
540b472e
authored
Oct 08, 2020
by
Sakthivel Velumani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified dlsim to accept external signal
parent
bd84277d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
96 deletions
+116
-96
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+109
-94
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+6
-2
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+1
-0
No files found.
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
540b472e
...
...
@@ -209,6 +209,7 @@ int main(int argc, char **argv)
int
pusch_tgt_snrx10
=
200
;
int
pucch_tgt_snrx10
=
200
;
int
loglvl
=
OAILOG_INFO
;
int
file_offset
=
0
;
//float target_error_rate = 0.01;
int
css_flag
=
0
;
...
...
@@ -226,7 +227,7 @@ int main(int argc, char **argv)
FILE
*
scg_fd
=
NULL
;
while
((
c
=
getopt
(
argc
,
argv
,
"f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:w"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:G
:
R:dPIL:Ea:b:e:m:w"
))
!=
-
1
)
{
switch
(
c
)
{
case
'f'
:
scg_fd
=
fopen
(
optarg
,
"r"
);
...
...
@@ -362,9 +363,14 @@ int main(int argc, char **argv)
printf
(
"Problem with filename %s
\n
"
,
optarg
);
exit
(
-
1
);
}
num_rounds
=
1
;
break
;
case
'G'
:
file_offset
=
atoi
(
optarg
);
break
;
case
'P'
:
print_perf
=
1
;
opp_enabled
=
1
;
...
...
@@ -677,7 +683,6 @@ int main(int argc, char **argv)
estimated_output_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
// generate signal
AssertFatal
(
input_fd
==
NULL
,
"Not ready for input signal file
\n
"
);
gNB
->
pbch_configured
=
1
;
gNB
->
ssb_pdu
.
ssb_pdu_rel15
.
bchPayload
=
0x001234
;
...
...
@@ -714,6 +719,8 @@ int main(int argc, char **argv)
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
0
]
->
UE_info
;
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
snrRun
=
0
;
int
slot_offset
=
0
;
int
slot_length
=
0
;
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
.
2
)
{
...
...
@@ -793,103 +800,111 @@ int main(int argc, char **argv)
Sched_INFO
.
TX_req
=
&
gNB_mac
->
TX_req
[
0
];
nr_schedule_response
(
&
Sched_INFO
);
if
(
run_initial_sync
)
nr_common_signal_procedures
(
gNB
,
frame
,
slot
);
else
phy_procedures_gNB_TX
(
gNB
,
frame
,
slot
,
0
);
int
txdataF_offset
=
(
slot
%
2
)
*
frame_parms
->
samples_per_slot_wCP
;
if
(
n_trials
==
1
)
{
LOG_M
(
"txsigF0.m"
,
"txsF0"
,
&
gNB
->
common_vars
.
txdataF
[
0
][
txdataF_offset
],
frame_parms
->
samples_per_slot_wCP
,
1
,
1
);
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
)
LOG_M
(
"txsigF1.m"
,
"txsF1"
,
&
gNB
->
common_vars
.
txdataF
[
1
][
txdataF_offset
],
frame_parms
->
samples_per_slot_wCP
,
1
,
1
);
}
int
tx_offset
=
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
);
if
(
n_trials
==
1
)
printf
(
"tx_offset %d, txdataF_offset %d
\n
"
,
tx_offset
,
txdataF_offset
);
//TODO: loop over slots
for
(
aa
=
0
;
aa
<
gNB
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
if
(
cyclic_prefix_type
==
1
)
{
PHY_ofdm_mod
(
&
gNB
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
&
txdata
[
aa
][
tx_offset
],
frame_parms
->
ofdm_symbol_size
,
12
,
frame_parms
->
nb_prefix_samples
,
CYCLIC_PREFIX
);
}
else
{
/*
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
&txdata[aa][tx_offset],
14,
frame_parms);
*/
PHY_ofdm_mod
(
&
gNB
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
(
int
*
)
&
txdata
[
aa
][
tx_offset
],
frame_parms
->
ofdm_symbol_size
,
1
,
frame_parms
->
nb_prefix_samples0
,
CYCLIC_PREFIX
);
apply_nr_rotation
(
frame_parms
,
(
int16_t
*
)
&
txdata
[
aa
][
tx_offset
],
slot
,
0
,
1
,
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples0
);
PHY_ofdm_mod
(
&
gNB
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
+
frame_parms
->
ofdm_symbol_size
],
(
int
*
)
&
txdata
[
aa
][
tx_offset
+
frame_parms
->
nb_prefix_samples0
+
frame_parms
->
ofdm_symbol_size
],
frame_parms
->
ofdm_symbol_size
,
13
,
frame_parms
->
nb_prefix_samples
,
CYCLIC_PREFIX
);
apply_nr_rotation
(
frame_parms
,
(
int16_t
*
)
&
txdata
[
aa
][
tx_offset
+
frame_parms
->
nb_prefix_samples0
+
frame_parms
->
ofdm_symbol_size
],
slot
,
1
,
13
,
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
if
(
input_fd
==
NULL
)
{
if
(
run_initial_sync
)
nr_common_signal_procedures
(
gNB
,
frame
,
slot
);
else
phy_procedures_gNB_TX
(
gNB
,
frame
,
slot
,
0
);
int
txdataF_offset
=
(
slot
%
2
)
*
frame_parms
->
samples_per_slot_wCP
;
if
(
n_trials
==
1
)
{
LOG_M
(
"txsigF0.m"
,
"txsF0"
,
&
gNB
->
common_vars
.
txdataF
[
0
][
txdataF_offset
],
frame_parms
->
samples_per_slot_wCP
,
1
,
1
);
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
)
LOG_M
(
"txsigF1.m"
,
"txsF1"
,
&
gNB
->
common_vars
.
txdataF
[
1
][
txdataF_offset
],
frame_parms
->
samples_per_slot_wCP
,
1
,
1
);
}
}
if
(
n_trials
==
1
)
{
LOG_M
(
"txsig0.m"
,
"txs0"
,
&
txdata
[
0
][
tx_offset
],
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
),
1
,
1
);
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
)
LOG_M
(
"txsig1.m"
,
"txs1"
,
&
txdata
[
1
][
tx_offset
],
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
),
1
,
1
);
}
if
(
output_fd
)
{
printf
(
"writing txdata to binary file
\n
"
);
fwrite
(
txdata
[
0
],
sizeof
(
int32_t
),
frame_length_complex_samples
,
output_fd
);
}
int
txlev
=
signal_energy
(
&
txdata
[
0
][
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
)
+
5
*
frame_parms
->
ofdm_symbol_size
+
4
*
frame_parms
->
nb_prefix_samples
+
frame_parms
->
nb_prefix_samples0
],
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
// if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev));
int
tx_offset
=
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
);
if
(
n_trials
==
1
)
printf
(
"tx_offset %d, txdataF_offset %d
\n
"
,
tx_offset
,
txdataF_offset
);
//TODO: loop over slots
for
(
aa
=
0
;
aa
<
gNB
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
if
(
cyclic_prefix_type
==
1
)
{
PHY_ofdm_mod
(
&
gNB
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
&
txdata
[
aa
][
tx_offset
],
frame_parms
->
ofdm_symbol_size
,
12
,
frame_parms
->
nb_prefix_samples
,
CYCLIC_PREFIX
);
}
else
{
/*
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
&txdata[aa][tx_offset],
14,
frame_parms);
*/
PHY_ofdm_mod
(
&
gNB
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
(
int
*
)
&
txdata
[
aa
][
tx_offset
],
frame_parms
->
ofdm_symbol_size
,
1
,
frame_parms
->
nb_prefix_samples0
,
CYCLIC_PREFIX
);
apply_nr_rotation
(
frame_parms
,
(
int16_t
*
)
&
txdata
[
aa
][
tx_offset
],
slot
,
0
,
1
,
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples0
);
PHY_ofdm_mod
(
&
gNB
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
+
frame_parms
->
ofdm_symbol_size
],
(
int
*
)
&
txdata
[
aa
][
tx_offset
+
frame_parms
->
nb_prefix_samples0
+
frame_parms
->
ofdm_symbol_size
],
frame_parms
->
ofdm_symbol_size
,
13
,
frame_parms
->
nb_prefix_samples
,
CYCLIC_PREFIX
);
apply_nr_rotation
(
frame_parms
,
(
int16_t
*
)
&
txdata
[
aa
][
tx_offset
+
frame_parms
->
nb_prefix_samples0
+
frame_parms
->
ofdm_symbol_size
],
slot
,
1
,
13
,
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
for
(
i
=
(
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
));
i
<
(
frame_parms
->
get_samples_slot_timestamp
(
slot
+
1
,
frame_parms
,
0
));
i
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_tx
;
aa
++
)
{
r_re
[
aa
][
i
]
=
((
double
)(((
short
*
)
txdata
[
aa
]))[(
i
<<
1
)]);
r_im
[
aa
][
i
]
=
((
double
)(((
short
*
)
txdata
[
aa
]))[(
i
<<
1
)
+
1
]);
}
}
if
(
n_trials
==
1
)
{
LOG_M
(
"txsig0.m"
,
"txs0"
,
&
txdata
[
0
][
tx_offset
],
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
),
1
,
1
);
if
(
gNB
->
frame_parms
.
nb_antennas_tx
>
1
)
LOG_M
(
"txsig1.m"
,
"txs1"
,
&
txdata
[
1
][
tx_offset
],
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
),
1
,
1
);
}
if
(
output_fd
)
{
printf
(
"writing txdata to binary file
\n
"
);
fwrite
(
txdata
[
0
],
sizeof
(
int32_t
),
frame_length_complex_samples
,
output_fd
);
}
}
//AWGN
sigma2_dB
=
10
*
log10
((
double
)
txlev
*
((
double
)
UE
->
frame_parms
.
ofdm_symbol_size
/
(
12
*
rel15
->
rbSize
)))
-
SNR
;
sigma2
=
pow
(
10
,
sigma2_dB
/
10
);
if
(
n_trials
==
1
)
printf
(
"sigma2 %f (%f dB), txlev %f (factor %f)
\n
"
,
sigma2
,
sigma2_dB
,
10
*
log10
((
double
)
txlev
),(
double
)(
double
)
UE
->
frame_parms
.
ofdm_symbol_size
/
(
12
*
rel15
->
rbSize
));
for
(
i
=
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
);
i
<
frame_parms
->
get_samples_slot_timestamp
(
slot
+
1
,
frame_parms
,
0
);
i
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_rx
;
aa
++
)
{
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[
2
*
i
]
=
(
short
)
((
r_re
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[
2
*
i
+
1
]
=
(
short
)
((
r_im
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
int
txlev
=
signal_energy
(
&
txdata
[
0
][
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
)
+
5
*
frame_parms
->
ofdm_symbol_size
+
4
*
frame_parms
->
nb_prefix_samples
+
frame_parms
->
nb_prefix_samples0
],
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
// if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev));
for
(
i
=
(
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
));
i
<
(
frame_parms
->
get_samples_slot_timestamp
(
slot
+
1
,
frame_parms
,
0
));
i
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_tx
;
aa
++
)
{
r_re
[
aa
][
i
]
=
((
double
)(((
short
*
)
txdata
[
aa
]))[(
i
<<
1
)]);
r_im
[
aa
][
i
]
=
((
double
)(((
short
*
)
txdata
[
aa
]))[(
i
<<
1
)
+
1
]);
}
}
//AWGN
sigma2_dB
=
10
*
log10
((
double
)
txlev
*
((
double
)
UE
->
frame_parms
.
ofdm_symbol_size
/
(
12
*
rel15
->
rbSize
)))
-
SNR
;
sigma2
=
pow
(
10
,
sigma2_dB
/
10
);
if
(
n_trials
==
1
)
printf
(
"sigma2 %f (%f dB), txlev %f (factor %f)
\n
"
,
sigma2
,
sigma2_dB
,
10
*
log10
((
double
)
txlev
),(
double
)(
double
)
UE
->
frame_parms
.
ofdm_symbol_size
/
(
12
*
rel15
->
rbSize
));
for
(
i
=
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
);
i
<
frame_parms
->
get_samples_slot_timestamp
(
slot
+
1
,
frame_parms
,
0
);
i
++
)
{
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_rx
;
aa
++
)
{
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[
2
*
i
]
=
(
short
)
((
r_re
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
((
short
*
)
UE
->
common_vars
.
rxdata
[
aa
])[
2
*
i
+
1
]
=
(
short
)
((
r_im
[
aa
][
i
]
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
}
}
}
else
{
fseek
(
input_fd
,
file_offset
*
sizeof
(
int16_t
)
*
2
,
SEEK_SET
);
slot_offset
=
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
);
slot_length
=
get_samples_per_slot
(
slot
,
frame_parms
);
fread
((
void
*
)
&
UE
->
common_vars
.
rxdata
[
0
][
slot_offset
],
sizeof
(
int16_t
),
slot_length
<<
1
,
input_fd
);
}
nr_ue_dcireq
(
&
dcireq
);
//to be replaced with function pointer later
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
View file @
540b472e
...
...
@@ -382,7 +382,7 @@ int configure_fapi_dl_pdu_phytest(int Mod_idP,
dci_pdu_rel15
[
0
].
antenna_ports
.
val
=
0
;
// nb of cdm groups w/o data 1 and dmrs port 0
// dmrs sequence initialization
dci_pdu_rel15
[
0
].
dmrs_sequence_initialization
.
val
=
pdsch_pdu_rel15
->
SCID
;
LOG_D
(
MAC
,
"[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d
\n
"
,
LOG_D
(
MAC
,
"[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d
dai %d tpc %d pucch_res_indi %d harq_timing_indi %d
\n
"
,
dci_pdu_rel15
[
0
].
frequency_domain_assignment
.
val
,
pdsch_pdu_rel15
->
rbStart
,
pdsch_pdu_rel15
->
rbSize
,
...
...
@@ -392,7 +392,11 @@ int configure_fapi_dl_pdu_phytest(int Mod_idP,
dci_pdu_rel15
[
0
].
mcs
,
dci_pdu_rel15
[
0
].
tb_scaling
,
dci_pdu_rel15
[
0
].
ndi
,
dci_pdu_rel15
[
0
].
rv
);
dci_pdu_rel15
[
0
].
rv
,
dci_pdu_rel15
[
0
].
dai
[
0
].
val
,
dci_pdu_rel15
[
0
].
tpc
,
dci_pdu_rel15
[
0
].
pucch_resource_indicator
,
dci_pdu_rel15
[
0
].
pdsch_to_harq_feedback_timing_indicator
.
val
);
NR_SearchSpace_t
*
ss
;
int
target_ss
=
NR_SearchSpace__searchSpaceType_PR_ue_Specific
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
540b472e
...
...
@@ -1002,6 +1002,7 @@ void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc,
int
bwp_id
)
{
uint8_t
fsize
=
0
,
pos
=
0
;
LOG_D
(
MAC
,
"Number of DL DCIs %d
\n
"
,
pdcch_pdu_rel15
->
numDlDci
);
for
(
int
d
=
0
;
d
<
pdcch_pdu_rel15
->
numDlDci
;
d
++
)
{
...
...
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