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'); [tidin msg]=fopen(filename,'r');
if (tidin==-1) if (tidin==-1)

@ -1,20 +1,22 @@
clear clear
ueConfig=struct('NCellID',1,'NULRB',25,'DuplexMode','FDD','NSubframe',0,'NFrame',0,'CyclicPrefixUL','Normal','NTxAnts',1); ueConfig=struct('NCellID',1,'NULRB',100,'DuplexMode','FDD','NSubframe',0,'CyclicPrefixUL','Normal','NTxAnts',1);
srsConfig=struct('NTxAnts',1,'ConfigIdx',0,'SeqGroup',1,'SeqIdx',0,'TxComb',0); srsConfig=struct('NTxAnts',1,'ConfigIdx',317,'SeqGroup',1,'SeqIdx',0,'TxComb',0);
addpath('../../build/srslte/lib/ch_estimation/test') addpath('../../build/srslte/lib/ch_estimation/test')
for csbw=2:7 for k=0:50
for csbw=0:7
for uebw=0:3 for uebw=0:3
for hop=0:3 for hop=0:3
for ncs=0:7 for ncs=0
for n_rrc=0:23 for n_rrc=1:5:20
ueConfig.NFrame=mod(32*k,1024);
srsConfig.BWConfig = csbw; srsConfig.BWConfig = csbw;
srsConfig.BW = uebw; srsConfig.BW = uebw;
srsConfig.CyclicShift = ncs; srsConfig.CyclicShift = ncs;
srsConfig.HoppingBW = hop; srsConfig.HoppingBW = hop;
srsConfig.FreqPosition = n_rrc; 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); 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); [sym_mat, info]=lteSRS(ueConfig,srsConfig);
[idx, info2]=lteSRSIndices(ueConfig,srsConfig); [idx, info2]=lteSRSIndices(ueConfig,srsConfig);
@ -26,13 +28,13 @@ for csbw=2:7
error_sym=max(abs(sym-sym_mat)); error_sym=max(abs(sym-sym_mat));
error_sf=max(abs(subframe_mat(:)-subframe)); error_sf=max(abs(subframe_mat(:)-subframe));
if (error_sym > 1e-3) if (error_sym > 3.5e-3)
disp(info) disp(info)
plot(1:length(sym),sym,1:length(sym_mat),sym_mat) plot(abs(sym-sym_mat))
legend('srsLTE','Matlab') legend('srsLTE','Matlab')
error('Error in symbols'); error('Error in symbols');
end end
if (error_sf > 1e-3) if (error_sf > 3.5e-3)
disp(info2) disp(info2)
plot(abs(subframe-subframe_mat(:))) plot(abs(subframe-subframe_mat(:)))
error('Error in subframe'); error('Error in subframe');
@ -42,3 +44,4 @@ for csbw=2:7
end end
end end
end end
end

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

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

@ -42,6 +42,7 @@ bool radio_uhd::init(char *args)
fprintf(stderr, "Error opening uhd\n"); fprintf(stderr, "Error opening uhd\n");
return false; return false;
} }
bzero(zeros, burst_settle_max_samples*sizeof(cf_t));
return true; 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() bool radio_uhd::tx_end()
{ {
save_trace(2, &end_of_burst_time); 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; is_start_of_burst = true;
} }

@ -61,7 +61,7 @@ typedef _Complex float cf_t;
class mac : public timer_callback class mac : public timer_callback
{ {
public: 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); bool init(phy *phy_h, tti_sync *ttisync, log *log_h);
void stop(); void stop();
int get_tti(); int get_tti();
@ -107,6 +107,7 @@ public:
public: public:
bool init(mac *parent, tti_sync_cv *ttysync); bool init(mac *parent, tti_sync_cv *ttysync);
void run(); void run();
void run_tti(uint32_t tti);
void stop(); void stop();
private: private:
bool started; bool started;
@ -120,7 +121,7 @@ private:
// TTI processing threads // 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_thread tti_threads[NOF_TTI_THREADS];
tti_sync_cv tti_threads_sync[NOF_TTI_THREADS]; tti_sync_cv tti_threads_sync[NOF_TTI_THREADS];
@ -176,12 +177,18 @@ private:
mac_pcap* pcap; mac_pcap* pcap;
// Variables for Execution time Trace // Variables for Execution time Trace
trace<uint32_t> tr_start_time; trace<uint32_t> tr_exec_total;
trace<uint32_t> tr_end_time; 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 tr_enabled;
bool is_first_of_burst; bool is_first_of_burst;
void tr_log_start(uint32_t tti); void tr_log_start(uint32_t tti);
void tr_log_end(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); 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; started = true;
} }
@ -108,21 +108,49 @@ void mac::start_trace()
void mac::write_trace(std::string filename) void mac::write_trace(std::string filename)
{ {
tr_start_time.writeToBinary(filename + ".start"); tr_exec_total.writeToBinary(filename + ".total");
tr_end_time.writeToBinary(filename + ".end"); tr_exec_dl.writeToBinary(filename + ".dl");
tr_exec_ul.writeToBinary(filename + ".ul");
} }
void mac::tr_log_start(uint32_t tti) void mac::tr_log_start(uint32_t tti)
{ {
if (tr_enabled) { 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) void mac::tr_log_end(uint32_t tti)
{ {
if (tr_enabled) { 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) { if (is_synchronized) {
/* Warning: Here order of invocation of procedures is important!! */ /* Warning: Here order of invocation of procedures is important!! */
tr_log_end(tti);
tti = ttisync->wait(); tti = ttisync->wait();
tr_log_start(tti); tr_log_start(tti);
log_h->step(tti); log_h->step(tti);
@ -252,7 +279,8 @@ void mac::main_radio_loop() {
timers_db.step_all(); timers_db.step_all();
// Trigger execution of corresponding TTI processor thread // 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; log_h = parent->log_h;
sync = sync_; sync = sync_;
started = threads_new_rt(&thread, tti_thread_runner, this); //started = threads_new_rt(&thread, tti_thread_runner, this);
return started; return started;
} }
@ -614,6 +642,12 @@ void mac::tti_thread::run()
uint32_t tti = sync->wait(); uint32_t tti = sync->wait();
if (parent->is_synchronized) { if (parent->is_synchronized) {
run_tti(tti);
}
}
}
void mac::tti_thread::run_tti(uint32_t tti) {
// Receive PCH, if requested // Receive PCH, if requested
parent->receive_pch(tti); parent->receive_pch(tti);
@ -653,7 +687,7 @@ void mac::tti_thread::run()
parent->is_first_of_burst = false; parent->is_first_of_burst = false;
} else { } else {
if (!parent->is_first_of_burst) { if (!parent->is_first_of_burst) {
ul_buffer->set_end_of_burst(); ul_buffer->send_end_of_burst();
parent->is_first_of_burst = true; parent->is_first_of_burst = true;
} }
} }
@ -674,8 +708,3 @@ void mac::tti_thread::run()
} }
} }
} }
}
}

@ -333,7 +333,7 @@ bool mux::allocate_sdu(uint32_t lcid, sch_pdu *pdu_msg, uint32_t *sdu_sz, bool *
return true; return true;
} else { } else {
if (pdu_msg->rem_size() > 10) { 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->rem_size());
} }
pdu_msg->del_subh(); 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, uint8_t *payload);
bool generate_data(ul_sched_grant *pusch_grant, srslte_softbuffer_tx_t *softbuffer, 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_tx_params(float cfo, float time_adv_sec, srslte_timestamp_t tx_time);
void set_end_of_burst(); void send_end_of_burst();
bool is_end_of_burst();
static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission
static const bool normalize_amp = true; static const bool normalize_amp = true;
private: private:
@ -71,7 +70,6 @@ namespace ue {
phy_params *params_db; phy_params *params_db;
radio *radio_h; radio *radio_h;
float cfo; float cfo;
bool tti_is_end_of_burst;
srslte_timestamp_t tx_time; srslte_timestamp_t tx_time;
srslte_cell_t cell; srslte_cell_t cell;
srslte_ue_ul_t ue_ul; 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_PSS_CORRELATION_THRESHOLD, 160);
params_db.set_param(phy_params::CELLSEARCH_TIMEOUT_MIB_NFRAMES, 100); 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; started = true;
} }
return started; return started;
@ -358,6 +358,7 @@ bool phy::init_prach() {
ul_buffer* phy::get_ul_buffer(uint32_t tti) ul_buffer* phy::get_ul_buffer(uint32_t tti)
{ {
tti=tti%10240;
if (tti + 1 < get_current_tti() && tti > NOF_ULDL_QUEUES) { 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()); 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) dl_buffer* phy::get_dl_buffer(uint32_t tti)
{ {
tti=tti%10240;
if (tti + 4 < get_current_tti()) { 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()); Warning("Warning access to PHY DL buffer too late. Requested TTI=%d while PHY is in %d\n", tti, get_current_tti());
// return NULL; // return NULL;
@ -545,8 +547,6 @@ void phy::run_rx_tx_state()
radio_handler->set_tx_gain(old_gain); radio_handler->set_tx_gain(old_gain);
srslte_agc_lock(&ue_sync.agc, false); srslte_agc_lock(&ue_sync.agc, false);
Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain); 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 // Receive alligned buffer for the current tti

@ -47,7 +47,7 @@ bool ul_buffer::init_cell(srslte_cell_t cell_, phy_params *params_db_, log *log_
radio_h = radio_h_; radio_h = radio_h_;
params_db = params_db_; params_db = params_db_;
current_tx_nb = 0; current_tx_nb = 0;
tti_is_end_of_burst = false;
if (!srslte_ue_ul_init(&ue_ul, cell)) { if (!srslte_ue_ul_init(&ue_ul, cell)) {
srslte_ue_ul_set_normalization(&ue_ul, false); 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)); 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, bool ul_buffer::generate_data(ul_sched_grant *grant,
uint8_t *payload) uint8_t *payload)
{ {
generate_data(grant, &ue_ul.softbuffer, payload); return generate_data(grant, &ue_ul.softbuffer, payload);
} }
//int nof_tx=0; //int nof_tx=0;
@ -245,10 +245,9 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
signal_buffer); signal_buffer);
if (ue_ul.pusch.shortened) { 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", 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], 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, 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 // 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); 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_) 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_; cfo = cfo_;
srslte_timestamp_copy(&tx_time, &tx_time_); 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); Info("TTI %d sending end of burst\n", tti);
tti_is_end_of_burst = true; radio_h->tx_end();
} }
bool ul_buffer::is_end_of_burst()
{
return tti_is_end_of_burst;
}
} // namespace ue } // namespace ue
} // namespace srslte } // 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 */ /* m_srs for 40<n_rb<60. Table 5.5.3.2-2 */
{48, 48, 40, 36, 32, 24, 20, 16}, {48, 48, 40, 36, 32, 24, 20, 16},
{24, 16, 20, 12, 16, 4, 4, 4}, {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}}, { 4, 4, 4, 4, 4, 4, 4, 4}},
{ {
/* m_srs for 60<n_rb<80. Table 5.5.3.2-3 */ /* 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); uint32_t N_sz = largest_prime_lower_than(M_sc);
float q = get_q(u,v,N_sz); float q = get_q(u,v,N_sz);
float n_sz = (float) N_sz; float n_sz = (float) N_sz;
for (uint32_t i = 0; i < M_sc; i++) { for (uint32_t i = 0; i < M_sc; i++) {
float m = (float) (i%N_sz); float m = (float) (i%N_sz);
arg[i] = -M_PI * q * m * (m + 1) / 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 */ /* 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) { if (nof_prb == 1) {
srslte_refsignal_r_uv_arg_1prb(q->tmp_arg, u); srslte_refsignal_r_uv_arg_1prb(q->tmp_arg, u);
} else if (nof_prb == 2) { } else if (nof_prb == 2) {
@ -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 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; 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_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; uint32_t prod_1=1;
for (uint32_t b=cfg->b_hop;b<cfg->B-1;b++) { for (uint32_t bp=cfg->b_hop+1;bp<b;bp++) {
prod_1 *= Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg]; 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]; uint32_t prod_2 = prod_1*Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
if (N_b%2) { uint32_t Fb;
return N_b/2*((n_srs%prod_2)/prod_1)+((n_srs%prod_2)/prod_1/2); if ((N_b%2) == 0) {
Fb = (N_b/2)*((n_srs%prod_2)/prod_1)+((n_srs%prod_2)/prod_1/2);
} else { } 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 */ /* 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) { if (b <= cfg->b_hop) {
nb = (4*cfg->n_rrc/m_srs)%Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg]; nb = (4*cfg->n_rrc/m_srs)%Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
} else { } 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; 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); compute_r(q, M_sc/SRSLTE_NRE, ns, 0);
float alpha = 2*M_PI*q->srs_cfg.n_srs/8; float alpha = 2*M_PI*q->srs_cfg.n_srs/8;
// Do complex exponential and adjust amplitude // Do complex exponential and adjust amplitude
for (int i=0;i<M_sc;i++) { 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)); r_srs[(ns%2)*M_sc+i] = q->srs_cfg.beta_srs * cexpf(I*(q->tmp_arg[i] + alpha*i));

Loading…
Cancel
Save