testing...

master
ismagom 10 years ago
commit f5370bd23d

@ -1,4 +1,4 @@
function [ tti, values ] = read_trace_uint( filename, count )
function [ values, tti] = read_trace_uint( filename, count )
[tidin msg]=fopen(filename,'r');
if (tidin==-1)

@ -1,44 +1,47 @@
clear
ueConfig=struct('NCellID',1,'NULRB',25,'DuplexMode','FDD','NSubframe',0,'NFrame',0,'CyclicPrefixUL','Normal','NTxAnts',1);
srsConfig=struct('NTxAnts',1,'ConfigIdx',0,'SeqGroup',1,'SeqIdx',0,'TxComb',0);
ueConfig=struct('NCellID',1,'NULRB',100,'DuplexMode','FDD','NSubframe',0,'CyclicPrefixUL','Normal','NTxAnts',1);
srsConfig=struct('NTxAnts',1,'ConfigIdx',317,'SeqGroup',1,'SeqIdx',0,'TxComb',0);
addpath('../../build/srslte/lib/ch_estimation/test')
for csbw=2:7
for uebw=0:3
for hop=0:3
for ncs=0:7
for n_rrc=0:23
srsConfig.BWConfig = csbw;
srsConfig.BW = uebw;
srsConfig.CyclicShift = ncs;
srsConfig.HoppingBW = hop;
srsConfig.FreqPosition = n_rrc;
fprintf('Testing SRS: CSBW=%d, UEBW=%d, b_hop=%d n_rrc=%d, CyclicShift=%d\n',csbw, uebw, hop, n_rrc, ncs);
for k=0:50
for csbw=0:7
for uebw=0:3
for hop=0:3
for ncs=0
for n_rrc=1:5:20
ueConfig.NFrame=mod(32*k,1024);
srsConfig.BWConfig = csbw;
srsConfig.BW = uebw;
srsConfig.CyclicShift = ncs;
srsConfig.HoppingBW = hop;
srsConfig.FreqPosition = n_rrc;
fprintf('Testing SRS: Nframe=%d, CSBW=%d, UEBW=%d, b_hop=%d n_rrc=%d\n',ueConfig.NFrame, csbw, uebw, hop, n_rrc);
[sym_mat, info]=lteSRS(ueConfig,srsConfig);
[idx, info2]=lteSRSIndices(ueConfig,srsConfig);
subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(idx)=sym_mat;
[sym_mat, info]=lteSRS(ueConfig,srsConfig);
[idx, info2]=lteSRSIndices(ueConfig,srsConfig);
subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(idx)=sym_mat;
[sym, subframe]=srslte_refsignal_srs(ueConfig,srsConfig);
[sym, subframe]=srslte_refsignal_srs(ueConfig,srsConfig);
error_sym=max(abs(sym-sym_mat));
error_sf=max(abs(subframe_mat(:)-subframe));
error_sym=max(abs(sym-sym_mat));
error_sf=max(abs(subframe_mat(:)-subframe));
if (error_sym > 1e-3)
disp(info)
plot(1:length(sym),sym,1:length(sym_mat),sym_mat)
legend('srsLTE','Matlab')
error('Error in symbols');
end
if (error_sf > 1e-3)
disp(info2)
plot(abs(subframe-subframe_mat(:)))
error('Error in subframe');
if (error_sym > 3.5e-3)
disp(info)
plot(abs(sym-sym_mat))
legend('srsLTE','Matlab')
error('Error in symbols');
end
if (error_sf > 3.5e-3)
disp(info2)
plot(abs(subframe-subframe_mat(:)))
error('Error in subframe');
end
end
end
end
end
end
end
end

@ -69,7 +69,7 @@ public:
if (st >= nof_elems) {
st=0;
}
} while(st<rpm);
} while(st!=rpm);
fclose(f);
return true;
} else {

@ -42,7 +42,6 @@ namespace ue {
queue::~queue()
{
printf("destroying %d elements\n", nof_elements);
for (int i=0;i<nof_elements;i++) {
if (buffer_of_elements[i]) {
free(buffer_of_elements[i]);

@ -82,7 +82,7 @@ namespace srslte {
static const double lo_offset = 8e6; // LO offset (in Hz)
static const double burst_settle_time = 0.4e-3; // Start of burst settle time (off->on RF transition time)
const static uint32_t burst_settle_max_samples = 12288; // 30.72 MHz is maximum frequency
const static uint32_t burst_settle_max_samples = 30720000; // 30.72 MHz is maximum frequency
srslte_timestamp_t end_of_burst_time;
bool is_start_of_burst;

@ -42,6 +42,7 @@ bool radio_uhd::init(char *args)
fprintf(stderr, "Error opening uhd\n");
return false;
}
bzero(zeros, burst_settle_max_samples*sizeof(cf_t));
return true;
}
@ -118,7 +119,7 @@ bool radio_uhd::tx(void* buffer, uint32_t nof_samples, srslte_timestamp_t tx_tim
bool radio_uhd::tx_end()
{
save_trace(2, &end_of_burst_time);
cuhd_send_timed2(uhd, zeros, burst_settle_samples, end_of_burst_time.full_secs, end_of_burst_time.frac_secs, false, true);
cuhd_send_timed2(uhd, zeros, 10, end_of_burst_time.full_secs, end_of_burst_time.frac_secs, false, true);
is_start_of_burst = true;
}

@ -61,7 +61,7 @@ typedef _Complex float cf_t;
class mac : public timer_callback
{
public:
mac() : timers_db((uint32_t) NOF_MAC_TIMERS), tr_end_time(1024*10), tr_start_time(1024*10) {started=false; pcap = NULL; }
mac() : timers_db((uint32_t) NOF_MAC_TIMERS), tr_exec_total(1024*10), tr_exec_dl(1024*10), tr_exec_ul(1024*10) {started=false; pcap = NULL; }
bool init(phy *phy_h, tti_sync *ttisync, log *log_h);
void stop();
int get_tti();
@ -107,6 +107,7 @@ public:
public:
bool init(mac *parent, tti_sync_cv *ttysync);
void run();
void run_tti(uint32_t tti);
void stop();
private:
bool started;
@ -120,7 +121,7 @@ private:
// TTI processing threads
static const int NOF_TTI_THREADS = 2;
static const int NOF_TTI_THREADS = 1;
tti_thread tti_threads[NOF_TTI_THREADS];
tti_sync_cv tti_threads_sync[NOF_TTI_THREADS];
@ -176,12 +177,18 @@ private:
mac_pcap* pcap;
// Variables for Execution time Trace
trace<uint32_t> tr_start_time;
trace<uint32_t> tr_end_time;
trace<uint32_t> tr_exec_total;
trace<uint32_t> tr_exec_dl;
trace<uint32_t> tr_exec_ul;
struct timeval tr_time_total[3];
struct timeval tr_time_ul[3];
struct timeval tr_time_dl[3];
bool tr_enabled;
bool is_first_of_burst;
void tr_log_start(uint32_t tti);
void tr_log_end(uint32_t tti);
void tr_log_dl(uint32_t tti);
void tr_log_ul(uint32_t tti);
void set_phy_crnti(uint16_t phy_rnti);
};

@ -68,7 +68,7 @@ bool mac::init(phy *phy_h_, tti_sync* ttisync_, log* log_h_)
}
}
if (threads_new_rt_prio(&mac_thread, mac_thread_fnc, this, 5)) {
if (threads_new_rt_prio(&mac_thread, mac_thread_fnc, this, 0)) {
started = true;
}
@ -108,21 +108,49 @@ void mac::start_trace()
void mac::write_trace(std::string filename)
{
tr_start_time.writeToBinary(filename + ".start");
tr_end_time.writeToBinary(filename + ".end");
tr_exec_total.writeToBinary(filename + ".total");
tr_exec_dl.writeToBinary(filename + ".dl");
tr_exec_ul.writeToBinary(filename + ".ul");
}
void mac::tr_log_start(uint32_t tti)
{
if (tr_enabled) {
tr_start_time.push_cur_time_us(tti);
gettimeofday(&tr_time_total[1], NULL);
}
}
void mac::tr_log_end(uint32_t tti)
{
if (tr_enabled) {
tr_end_time.push_cur_time_us(tti);
/* compute total execution time */
gettimeofday(&tr_time_total[2], NULL);
get_time_interval(tr_time_total);
tr_exec_total.push(tti, tr_time_total[0].tv_usec);
/* ul execution time is from the call to tr_log_ul */
memcpy(&tr_time_ul[2], &tr_time_total[2], sizeof(struct timeval));
get_time_interval(tr_time_ul);
tr_exec_ul.push(tti, tr_time_ul[0].tv_usec);
}
}
void mac::tr_log_ul(uint32_t tti)
{
if (tr_enabled) {
/* DL execution time is from the call to tr_log_dl to the call to tr_log_ul */
gettimeofday(&tr_time_dl[2], NULL);
get_time_interval(tr_time_dl);
tr_exec_dl.push(tti, tr_time_dl[0].tv_usec);
memcpy(&tr_time_ul[1], &tr_time_dl[2], sizeof(struct timeval));
}
}
void mac::tr_log_dl(uint32_t tti)
{
if (tr_enabled) {
gettimeofday(&tr_time_dl[1], NULL);
}
}
@ -220,7 +248,6 @@ void mac::main_radio_loop() {
}
if (is_synchronized) {
/* Warning: Here order of invocation of procedures is important!! */
tr_log_end(tti);
tti = ttisync->wait();
tr_log_start(tti);
log_h->step(tti);
@ -248,11 +275,12 @@ void mac::main_radio_loop() {
ra_procedure.step(tti);
//phr_procedure.step(tti);
timers_db.step_all();
// Trigger execution of corresponding TTI processor thread
tti_threads_sync[tti%NOF_TTI_THREADS].increase();
//tti_threads_sync[tti%NOF_TTI_THREADS].increase();
tti_threads[0].run_tti(tti);
}
}
@ -598,7 +626,7 @@ bool mac::tti_thread::init(mac* parent_, tti_sync_cv *sync_)
log_h = parent->log_h;
sync = sync_;
started = threads_new_rt(&thread, tti_thread_runner, this);
//started = threads_new_rt(&thread, tti_thread_runner, this);
return started;
}
@ -614,68 +642,69 @@ void mac::tti_thread::run()
uint32_t tti = sync->wait();
if (parent->is_synchronized) {
// Receive PCH, if requested
parent->receive_pch(tti);
// Process DL grants always
parent->process_dl_grants(tti);
// Send pending HARQ ACK, if any, and contention resolution is resolved
if (parent->dl_harq.is_ack_pending_resolution()) {
parent->ra_procedure.step(tti);
if (parent->ra_procedure.is_successful() || parent->ra_procedure.is_response_error()) {
Info("Sending pending ACK for contention resolution PHY TTI: %d\n", parent->phy_h->get_current_tti());
parent->dl_harq.send_pending_ack_contention_resolution();
}
}
// Process UL grants if RA procedure is done or in contention resolution
if (parent->ra_procedure.is_contention_resolution() || parent->ra_procedure.is_successful()) {
parent->process_ul_grants(tti);
}
// If ACK/SR was pending but there was no PUSCH transmission, transmit now through PUCCH
ul_buffer *ul_buffer = parent->phy_h->get_ul_buffer(tti+4);
// Generate scheduling request if we have to
if (parent->phy_h->sr_is_ready_to_send(tti+4)) {
ul_buffer->generate_sr();
}
// The UL buffer is released when successfully transmitted.
if (ul_buffer->is_released()) {
ul_buffer->ready();
parent->is_first_of_burst = false;
} else if (ul_buffer->uci_ready() || ul_buffer->srs_is_ready_to_send()) {
// If the packet was not generated by a call from MAC, means it's PUCCH or SRS. Generate now the signal
ul_buffer->generate_data();
ul_buffer->ready();
parent->is_first_of_burst = false;
} else {
if (!parent->is_first_of_burst) {
ul_buffer->set_end_of_burst();
parent->is_first_of_burst = true;
}
}
// Check if there is pending CCCH SDU in Multiplexing Unit
if (parent->mux_unit.is_pending_ccch_sdu()) {
// Start RA procedure
if (!parent->ra_procedure.in_progress() && !parent->ra_procedure.is_successful()) {
parent->ra_procedure.start_rlc_order();
}
}
if (parent->ra_procedure.is_successful() && parent->phy_rnti != parent->params_db.get_param(mac_params::RNTI_C) &&
parent->params_db.get_param(mac_params::RNTI_C) > 0)
{
parent->phy_rnti = parent->params_db.get_param(mac_params::RNTI_C);
parent->set_phy_crnti(parent->phy_rnti);
}
run_tti(tti);
}
}
}
void mac::tti_thread::run_tti(uint32_t tti) {
// Receive PCH, if requested
parent->receive_pch(tti);
// Process DL grants always
parent->process_dl_grants(tti);
// Send pending HARQ ACK, if any, and contention resolution is resolved
if (parent->dl_harq.is_ack_pending_resolution()) {
parent->ra_procedure.step(tti);
if (parent->ra_procedure.is_successful() || parent->ra_procedure.is_response_error()) {
Info("Sending pending ACK for contention resolution PHY TTI: %d\n", parent->phy_h->get_current_tti());
parent->dl_harq.send_pending_ack_contention_resolution();
}
}
// Process UL grants if RA procedure is done or in contention resolution
if (parent->ra_procedure.is_contention_resolution() || parent->ra_procedure.is_successful()) {
parent->process_ul_grants(tti);
}
// If ACK/SR was pending but there was no PUSCH transmission, transmit now through PUCCH
ul_buffer *ul_buffer = parent->phy_h->get_ul_buffer(tti+4);
// Generate scheduling request if we have to
if (parent->phy_h->sr_is_ready_to_send(tti+4)) {
ul_buffer->generate_sr();
}
// The UL buffer is released when successfully transmitted.
if (ul_buffer->is_released()) {
ul_buffer->ready();
parent->is_first_of_burst = false;
} else if (ul_buffer->uci_ready() || ul_buffer->srs_is_ready_to_send()) {
// If the packet was not generated by a call from MAC, means it's PUCCH or SRS. Generate now the signal
ul_buffer->generate_data();
ul_buffer->ready();
parent->is_first_of_burst = false;
} else {
if (!parent->is_first_of_burst) {
ul_buffer->send_end_of_burst();
parent->is_first_of_burst = true;
}
}
// Check if there is pending CCCH SDU in Multiplexing Unit
if (parent->mux_unit.is_pending_ccch_sdu()) {
// Start RA procedure
if (!parent->ra_procedure.in_progress() && !parent->ra_procedure.is_successful()) {
parent->ra_procedure.start_rlc_order();
}
}
if (parent->ra_procedure.is_successful() && parent->phy_rnti != parent->params_db.get_param(mac_params::RNTI_C) &&
parent->params_db.get_param(mac_params::RNTI_C) > 0)
{
parent->phy_rnti = parent->params_db.get_param(mac_params::RNTI_C);
parent->set_phy_crnti(parent->phy_rnti);
}
}
}
}

@ -333,7 +333,7 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, uint32_t *sdu_sz, bool *
return true;
} else {
if (pdu_msg->rem_size() > 10) {
Warning("Could not allocate SDU in current grant. SDU length: %d bytes. Grant space: %d bytes\n", nbytes,
Info("Could not allocate SDU in current grant. SDU length: %d bytes. Grant space: %d bytes\n", nbytes,
pdu_msg->rem_size());
}
pdu_msg->del_subh();

@ -62,8 +62,7 @@ namespace ue {
bool generate_data(ul_sched_grant *pusch_grant, uint8_t *payload);
bool generate_data(ul_sched_grant *pusch_grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload);
void set_tx_params(float cfo, float time_adv_sec, srslte_timestamp_t tx_time);
void set_end_of_burst();
bool is_end_of_burst();
void send_end_of_burst();
static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission
static const bool normalize_amp = true;
private:
@ -71,7 +70,6 @@ namespace ue {
phy_params *params_db;
radio *radio_h;
float cfo;
bool tti_is_end_of_burst;
srslte_timestamp_t tx_time;
srslte_cell_t cell;
srslte_ue_ul_t ue_ul;

@ -106,7 +106,7 @@ bool phy::init_(srslte::radio* radio_handler_, srslte::ue::tti_sync* ttisync_, l
params_db.set_param(phy_params::CELLSEARCH_TIMEOUT_PSS_CORRELATION_THRESHOLD, 160);
params_db.set_param(phy_params::CELLSEARCH_TIMEOUT_MIB_NFRAMES, 100);
if (threads_new_rt(&phy_thread, phy_thread_fnc, this)) {
if (threads_new_rt_prio(&phy_thread, phy_thread_fnc, this, 1)) {
started = true;
}
return started;
@ -358,6 +358,7 @@ bool phy::init_prach() {
ul_buffer* phy::get_ul_buffer(uint32_t tti)
{
tti=tti%10240;
if (tti + 1 < get_current_tti() && tti > NOF_ULDL_QUEUES) {
Warning("Warning access to PHY UL buffer too late. Requested TTI=%d while PHY is in %d\n", tti, get_current_tti());
}
@ -371,6 +372,7 @@ ul_buffer* phy::get_ul_buffer_adv(uint32_t tti)
dl_buffer* phy::get_dl_buffer(uint32_t tti)
{
tti=tti%10240;
if (tti + 4 < get_current_tti()) {
Warning("Warning access to PHY DL buffer too late. Requested TTI=%d while PHY is in %d\n", tti, get_current_tti());
// return NULL;
@ -545,9 +547,7 @@ void phy::run_rx_tx_state()
radio_handler->set_tx_gain(old_gain);
srslte_agc_lock(&ue_sync.agc, false);
Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain);
} else if (get_ul_buffer_adv(current_tti)->is_end_of_burst()) {
radio_handler->tx_end();
}
}
// Receive alligned buffer for the current tti
tr_log_end();

@ -47,7 +47,7 @@ bool ul_buffer::init_cell(srslte_cell_t cell_, phy_params *params_db_, log *log_
radio_h = radio_h_;
params_db = params_db_;
current_tx_nb = 0;
tti_is_end_of_burst = false;
if (!srslte_ue_ul_init(&ue_ul, cell)) {
srslte_ue_ul_set_normalization(&ue_ul, false);
signal_buffer = (cf_t*) srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
@ -121,7 +121,7 @@ bool ul_buffer::generate_data() {
bool ul_buffer::generate_data(ul_sched_grant *grant,
uint8_t *payload)
{
generate_data(grant, &ue_ul.softbuffer, payload);
return generate_data(grant, &ue_ul.softbuffer, payload);
}
//int nof_tx=0;
@ -245,10 +245,9 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
signal_buffer);
if (ue_ul.pusch.shortened) {
Warning("PUSCH shortened on tti=%d\n", tti);
Info("PUSCH shortened on tti=%d\n", tti);
}
Info("PUSCH: TTI=%d, CFO= %.1f KHz TBS=%d, mod=%s, rb_start=%d n_prb=%d, ack=%s, sr=%s, rnti=%d, shortened=%s\n",
tti, cfo*15e3, grant->get_tbs(), srslte_mod_string(ue_ul.pusch_cfg.grant.mcs.mod), ue_ul.pusch_cfg.grant.n_prb[0],
ue_ul.pusch_cfg.grant.L_prb,
@ -283,7 +282,7 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
}
// Normalize before TX
srslte_vec_sc_prod_cfc(signal_buffer, 0.7/max, signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
srslte_vec_sc_prod_cfc(signal_buffer, 0.9/max, signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
}
radio_h->tx(signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb), tx_time);
@ -306,22 +305,17 @@ int nof_tx = 0;
void ul_buffer::set_tx_params(float cfo_, float time_adv_sec, srslte_timestamp_t tx_time_)
{
tti_is_end_of_burst = false;
cfo = cfo_;
srslte_timestamp_copy(&tx_time, &tx_time_);
srslte_timestamp_add(&tx_time, 0, 4e-3 - time_adv_sec);
srslte_timestamp_add(&tx_time, 0, 4e-3 - time_adv_sec); // UL buffer is configured for tti+4
}
void ul_buffer::set_end_of_burst()
void ul_buffer::send_end_of_burst()
{
Info("TTI %d Is end of burst\n", tti);
tti_is_end_of_burst = true;
Info("TTI %d sending end of burst\n", tti);
radio_h->tx_end();
}
bool ul_buffer::is_end_of_burst()
{
return tti_is_end_of_burst;
}
} // namespace ue
} // namespace srslte

@ -79,7 +79,7 @@ uint32_t m_srs_b[4][4][8] = {{
/* m_srs for 40<n_rb<60. Table 5.5.3.2-2 */
{48, 48, 40, 36, 32, 24, 20, 16},
{24, 16, 20, 12, 16, 4, 4, 4},
{12, 16, 4, 12, 8, 4, 4, 8},
{12, 8, 4, 4, 8, 4, 4, 4},
{ 4, 4, 4, 4, 4, 4, 4, 4}},
{
/* m_srs for 60<n_rb<80. Table 5.5.3.2-3 */
@ -281,7 +281,6 @@ static void arg_r_uv_mprb(float *arg, uint32_t M_sc, uint32_t u, uint32_t v) {
uint32_t N_sz = largest_prime_lower_than(M_sc);
float q = get_q(u,v,N_sz);
float n_sz = (float) N_sz;
for (uint32_t i = 0; i < M_sc; i++) {
float m = (float) (i%N_sz);
arg[i] = -M_PI * q * m * (m + 1) / n_sz;
@ -289,7 +288,7 @@ static void arg_r_uv_mprb(float *arg, uint32_t M_sc, uint32_t u, uint32_t v) {
}
/* Computes argument of r_u_v signal */
static void compute_r_uv_arg(srslte_refsignal_ul_t *q, srslte_refsignal_dmrs_pusch_cfg_t *cfg, uint32_t nof_prb, uint32_t u, uint32_t v) {
static void compute_r_uv_arg(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t u, uint32_t v) {
if (nof_prb == 1) {
srslte_refsignal_r_uv_arg_1prb(q->tmp_arg, u);
} else if (nof_prb == 2) {
@ -340,7 +339,7 @@ void compute_r(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t ns, uint32_t
f_gh = q->f_gh[ns];
}
uint32_t u = (f_gh + (q->cell.id%30)+delta_ss)%30;
// Get sequence hopping number v
uint32_t v = 0;
if (nof_prb >= 6 && q->sequence_hopping_en) {
@ -348,7 +347,7 @@ void compute_r(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t ns, uint32_t
}
// Compute signal argument
compute_r_uv_arg(q, &q->pusch_cfg, nof_prb, u, v);
compute_r_uv_arg(q, nof_prb, u, v);
}
@ -688,19 +687,23 @@ uint32_t srslte_refsignal_srs_rb_L_cs(uint32_t bw_cfg, uint32_t nof_prb) {
return 0;
}
uint32_t srs_Fb(srslte_refsignal_srs_cfg_t *cfg, uint32_t nof_prb, uint32_t tti) {
uint32_t srs_Fb(srslte_refsignal_srs_cfg_t *cfg, uint32_t b, uint32_t nof_prb, uint32_t tti) {
uint32_t n_srs = tti/T_srs_table(cfg->I_srs);
uint32_t N_b = Nb[srsbwtable_idx(nof_prb)][cfg->B][cfg->bw_cfg];
uint32_t N_b = Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
uint32_t prod_1=1;
for (uint32_t b=cfg->b_hop;b<cfg->B-1;b++) {
prod_1 *= Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
for (uint32_t bp=cfg->b_hop+1;bp<b;bp++) {
prod_1 *= Nb[srsbwtable_idx(nof_prb)][bp][cfg->bw_cfg];
}
uint32_t prod_2 = prod_1*Nb[srsbwtable_idx(nof_prb)][cfg->B][cfg->bw_cfg];
if (N_b%2) {
return N_b/2*((n_srs%prod_2)/prod_1)+((n_srs%prod_2)/prod_1/2);
uint32_t prod_2 = prod_1*Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
uint32_t Fb;
if ((N_b%2) == 0) {
Fb = (N_b/2)*((n_srs%prod_2)/prod_1)+((n_srs%prod_2)/prod_1/2);
} else {
return N_b/2*(n_srs/prod_1);
Fb = (N_b/2)*(n_srs/prod_1);
}
return Fb;
}
/* Returns k0: frequency-domain starting position for ue-specific SRS */
@ -716,9 +719,11 @@ uint32_t srs_k0_ue(srslte_refsignal_srs_cfg_t *cfg, uint32_t nof_prb, uint32_t t
if (b <= cfg->b_hop) {
nb = (4*cfg->n_rrc/m_srs)%Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
} else {
nb = ((4*cfg->n_rrc/m_srs)+srs_Fb(cfg, nof_prb, tti))%Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
uint32_t Fb=srs_Fb(cfg, b, nof_prb, tti);
nb = ((4*cfg->n_rrc/m_srs)+Fb)%Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
}
k0 += 2*m_sc*nb;
k0 += 2*m_sc*nb;
}
return k0;
}
@ -741,6 +746,7 @@ int srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, uint32_t sf_idx, cf_t *r_
compute_r(q, M_sc/SRSLTE_NRE, ns, 0);
float alpha = 2*M_PI*q->srs_cfg.n_srs/8;
// Do complex exponential and adjust amplitude
for (int i=0;i<M_sc;i++) {
r_srs[(ns%2)*M_sc+i] = q->srs_cfg.beta_srs * cexpf(I*(q->tmp_arg[i] + alpha*i));

Loading…
Cancel
Save