|
|
|
@ -19,10 +19,11 @@ test_bench::args_t::args_t(int argc, char** argv)
|
|
|
|
|
valid = true;
|
|
|
|
|
|
|
|
|
|
cell_list.resize(1);
|
|
|
|
|
cell_list[0].carrier.nof_prb = 52;
|
|
|
|
|
cell_list[0].carrier.nof_prb = 52;
|
|
|
|
|
cell_list[0].carrier.max_mimo_layers = 1;
|
|
|
|
|
cell_list[0].carrier.pci = 500;
|
|
|
|
|
|
|
|
|
|
phy_cfg.carrier = cell_list[0].carrier;
|
|
|
|
|
phy_cfg.carrier.pci = 500;
|
|
|
|
|
phy_cfg.carrier = cell_list[0].carrier;
|
|
|
|
|
|
|
|
|
|
phy_cfg.carrier.absolute_frequency_point_a = 633928;
|
|
|
|
|
phy_cfg.carrier.absolute_frequency_ssb = 634176;
|
|
|
|
@ -213,340 +214,307 @@ test_bench::args_t::args_t(int argc, char** argv)
|
|
|
|
|
phy_cfg.harq_ack.dl_data_to_ul_ack[6] = 11;
|
|
|
|
|
|
|
|
|
|
phy_cfg.prach.freq_offset = 2;
|
|
|
|
|
|
|
|
|
|
// pusch-Config: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// dmrs-UplinkForPUSCH-MappingTypeA: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// dmrs-AdditionalPosition: pos1 (1)
|
|
|
|
|
// transformPrecodingDisabled
|
|
|
|
|
// pusch-PowerControl
|
|
|
|
|
// msg3-Alpha: alpha1 (7)
|
|
|
|
|
// p0-NominalWithoutGrant: -90dBm
|
|
|
|
|
// p0-AlphaSets: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// P0-PUSCH-AlphaSet
|
|
|
|
|
// p0-PUSCH-AlphaSetId: 0
|
|
|
|
|
// p0: 0dB
|
|
|
|
|
// alpha: alpha1 (7)
|
|
|
|
|
// pathlossReferenceRSToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// PUSCH-PathlossReferenceRS
|
|
|
|
|
// pusch-PathlossReferenceRS-Id: 0
|
|
|
|
|
// referenceSignal: ssb-Index (0)
|
|
|
|
|
// ssb-Index: 0
|
|
|
|
|
// sri-PUSCH-MappingToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// SRI-PUSCH-PowerControl
|
|
|
|
|
// sri-PUSCH-PowerControlId: 0
|
|
|
|
|
// sri-PUSCH-PathlossReferenceRS-Id: 0
|
|
|
|
|
// sri-P0-PUSCH-AlphaSetId: 0
|
|
|
|
|
// sri-PUSCH-ClosedLoopIndex: i0 (0)
|
|
|
|
|
// resourceAllocation: resourceAllocationType1 (1)
|
|
|
|
|
// uci-OnPUSCH: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// betaOffsets: semiStatic (1)
|
|
|
|
|
// semiStatic
|
|
|
|
|
// betaOffsetACK-Index1: 9
|
|
|
|
|
// betaOffsetACK-Index2: 9
|
|
|
|
|
// betaOffsetACK-Index3: 9
|
|
|
|
|
// betaOffsetCSI-Part1-Index1: 6
|
|
|
|
|
// betaOffsetCSI-Part1-Index2: 6
|
|
|
|
|
// betaOffsetCSI-Part2-Index1: 6
|
|
|
|
|
// betaOffsetCSI-Part2-Index2: 6
|
|
|
|
|
// scaling: f1 (3)
|
|
|
|
|
// srs-Config: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// srs-ResourceSetToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// SRS-ResourceSet
|
|
|
|
|
// srs-ResourceSetId: 0
|
|
|
|
|
// srs-ResourceIdList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// SRS-ResourceId: 0
|
|
|
|
|
// resourceType: aperiodic (0)
|
|
|
|
|
// aperiodic
|
|
|
|
|
// aperiodicSRS-ResourceTrigger: 1
|
|
|
|
|
// slotOffset: 7
|
|
|
|
|
// usage: codebook (1)
|
|
|
|
|
// p0: -90dBm
|
|
|
|
|
// pathlossReferenceRS: ssb-Index (0)
|
|
|
|
|
// ssb-Index: 0
|
|
|
|
|
// srs-ResourceToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// SRS-Resource
|
|
|
|
|
// srs-ResourceId: 0
|
|
|
|
|
// nrofSRS-Ports: port1 (0)
|
|
|
|
|
// transmissionComb: n2 (0)
|
|
|
|
|
// n2
|
|
|
|
|
// combOffset-n2: 0
|
|
|
|
|
// cyclicShift-n2: 0
|
|
|
|
|
// resourceMapping
|
|
|
|
|
// startPosition: 0
|
|
|
|
|
// nrofSymbols: n1 (0)
|
|
|
|
|
// repetitionFactor: n1 (0)
|
|
|
|
|
// freqDomainPosition: 0
|
|
|
|
|
// freqDomainShift: 6
|
|
|
|
|
// freqHopping
|
|
|
|
|
// c-SRS: 11
|
|
|
|
|
// b-SRS: 3
|
|
|
|
|
// b-hop: 0
|
|
|
|
|
// groupOrSequenceHopping: neither (0)
|
|
|
|
|
// resourceType: aperiodic (0)
|
|
|
|
|
// aperiodic
|
|
|
|
|
// sequenceId: 500
|
|
|
|
|
// firstActiveUplinkBWP-Id: 0
|
|
|
|
|
// pusch-ServingCellConfig: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// pdcch-ServingCellConfig: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// pdsch-ServingCellConfig: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// nrofHARQ-ProcessesForPDSCH: n16 (5)
|
|
|
|
|
// csi-MeasConfig: setup (1)
|
|
|
|
|
// setup
|
|
|
|
|
// nzp-CSI-RS-ResourceToAddModList: 5 items
|
|
|
|
|
// Item 0
|
|
|
|
|
// NZP-CSI-RS-Resource
|
|
|
|
|
// nzp-CSI-RS-ResourceId: 0
|
|
|
|
|
// resourceMapping
|
|
|
|
|
// frequencyDomainAllocation: row2 (1)
|
|
|
|
|
// row2: 8000 [bit length 12, 4 LSB pad bits, 1000 0000 0000
|
|
|
|
|
// .... decimal value 2048]
|
|
|
|
|
// nrofPorts: p1 (0)
|
|
|
|
|
// firstOFDMSymbolInTimeDomain: 4
|
|
|
|
|
// cdm-Type: noCDM (0)
|
|
|
|
|
// density: one (1)
|
|
|
|
|
// one: NULL
|
|
|
|
|
// freqBand
|
|
|
|
|
// startingRB: 0
|
|
|
|
|
// nrofRBs: 52
|
|
|
|
|
// powerControlOffset: 0dB
|
|
|
|
|
// powerControlOffsetSS: db0 (1)
|
|
|
|
|
// scramblingID: 0
|
|
|
|
|
// periodicityAndOffset: slots80 (9)
|
|
|
|
|
// slots80: 1
|
|
|
|
|
// qcl-InfoPeriodicCSI-RS: 0
|
|
|
|
|
// Item 1
|
|
|
|
|
// NZP-CSI-RS-Resource
|
|
|
|
|
// nzp-CSI-RS-ResourceId: 1
|
|
|
|
|
// resourceMapping
|
|
|
|
|
// frequencyDomainAllocation: row1 (0)
|
|
|
|
|
// row1: 10 [bit length 4, 4 LSB pad bits, 0001 .... decimal
|
|
|
|
|
// value 1]
|
|
|
|
|
// nrofPorts: p1 (0)
|
|
|
|
|
// firstOFDMSymbolInTimeDomain: 4
|
|
|
|
|
// cdm-Type: noCDM (0)
|
|
|
|
|
// density: three (2)
|
|
|
|
|
// three: NULL
|
|
|
|
|
// freqBand
|
|
|
|
|
// startingRB: 0
|
|
|
|
|
// nrofRBs: 52
|
|
|
|
|
// powerControlOffset: 0dB
|
|
|
|
|
// powerControlOffsetSS: db0 (1)
|
|
|
|
|
// scramblingID: 0
|
|
|
|
|
// periodicityAndOffset: slots40 (7)
|
|
|
|
|
// slots40: 11
|
|
|
|
|
// qcl-InfoPeriodicCSI-RS: 0
|
|
|
|
|
// Item 2
|
|
|
|
|
// NZP-CSI-RS-Resource
|
|
|
|
|
// nzp-CSI-RS-ResourceId: 2
|
|
|
|
|
// resourceMapping
|
|
|
|
|
// frequencyDomainAllocation: row1 (0)
|
|
|
|
|
// row1: 10 [bit length 4, 4 LSB pad bits, 0001 .... decimal
|
|
|
|
|
// value 1]
|
|
|
|
|
// nrofPorts: p1 (0)
|
|
|
|
|
// firstOFDMSymbolInTimeDomain: 8
|
|
|
|
|
// cdm-Type: noCDM (0)
|
|
|
|
|
// density: three (2)
|
|
|
|
|
// three: NULL
|
|
|
|
|
// freqBand
|
|
|
|
|
// startingRB: 0
|
|
|
|
|
// nrofRBs: 52
|
|
|
|
|
// powerControlOffset: 0dB
|
|
|
|
|
// powerControlOffsetSS: db0 (1)
|
|
|
|
|
// scramblingID: 0
|
|
|
|
|
// periodicityAndOffset: slots40 (7)
|
|
|
|
|
// slots40: 11
|
|
|
|
|
// qcl-InfoPeriodicCSI-RS: 0
|
|
|
|
|
// Item 3
|
|
|
|
|
// NZP-CSI-RS-Resource
|
|
|
|
|
// nzp-CSI-RS-ResourceId: 3
|
|
|
|
|
// resourceMapping
|
|
|
|
|
// frequencyDomainAllocation: row1 (0)
|
|
|
|
|
// row1: 10 [bit length 4, 4 LSB pad bits, 0001 .... decimal
|
|
|
|
|
// value 1]
|
|
|
|
|
// nrofPorts: p1 (0)
|
|
|
|
|
// firstOFDMSymbolInTimeDomain: 4
|
|
|
|
|
// cdm-Type: noCDM (0)
|
|
|
|
|
// density: three (2)
|
|
|
|
|
// three: NULL
|
|
|
|
|
// freqBand
|
|
|
|
|
// startingRB: 0
|
|
|
|
|
// nrofRBs: 52
|
|
|
|
|
// powerControlOffset: 0dB
|
|
|
|
|
// powerControlOffsetSS: db0 (1)
|
|
|
|
|
// scramblingID: 0
|
|
|
|
|
// periodicityAndOffset: slots40 (7)
|
|
|
|
|
// slots40: 12
|
|
|
|
|
// qcl-InfoPeriodicCSI-RS: 0
|
|
|
|
|
// Item 4
|
|
|
|
|
// NZP-CSI-RS-Resource
|
|
|
|
|
// nzp-CSI-RS-ResourceId: 4
|
|
|
|
|
// resourceMapping
|
|
|
|
|
// frequencyDomainAllocation: row1 (0)
|
|
|
|
|
// row1: 10 [bit length 4, 4 LSB pad bits, 0001 .... decimal
|
|
|
|
|
// value 1]
|
|
|
|
|
// nrofPorts: p1 (0)
|
|
|
|
|
// firstOFDMSymbolInTimeDomain: 8
|
|
|
|
|
// cdm-Type: noCDM (0)
|
|
|
|
|
// density: three (2)
|
|
|
|
|
// three: NULL
|
|
|
|
|
// freqBand
|
|
|
|
|
// startingRB: 0
|
|
|
|
|
// nrofRBs: 52
|
|
|
|
|
// powerControlOffset: 0dB
|
|
|
|
|
// powerControlOffsetSS: db0 (1)
|
|
|
|
|
// scramblingID: 0
|
|
|
|
|
// periodicityAndOffset: slots40 (7)
|
|
|
|
|
// slots40: 12
|
|
|
|
|
// qcl-InfoPeriodicCSI-RS: 0
|
|
|
|
|
// nzp-CSI-RS-ResourceSetToAddModList: 2 items
|
|
|
|
|
// Item 0
|
|
|
|
|
// NZP-CSI-RS-ResourceSet
|
|
|
|
|
// nzp-CSI-ResourceSetId: 0
|
|
|
|
|
// nzp-CSI-RS-Resources: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// NZP-CSI-RS-ResourceId: 0
|
|
|
|
|
// Item 1
|
|
|
|
|
// NZP-CSI-RS-ResourceSet
|
|
|
|
|
// nzp-CSI-ResourceSetId: 1
|
|
|
|
|
// nzp-CSI-RS-Resources: 4 items
|
|
|
|
|
// Item 0
|
|
|
|
|
// NZP-CSI-RS-ResourceId: 1
|
|
|
|
|
// Item 1
|
|
|
|
|
// NZP-CSI-RS-ResourceId: 2
|
|
|
|
|
// Item 2
|
|
|
|
|
// NZP-CSI-RS-ResourceId: 3
|
|
|
|
|
// Item 3
|
|
|
|
|
// NZP-CSI-RS-ResourceId: 4
|
|
|
|
|
// trs-Info: true (0)
|
|
|
|
|
// csi-IM-ResourceToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// CSI-IM-Resource
|
|
|
|
|
// csi-IM-ResourceId: 0
|
|
|
|
|
// csi-IM-ResourceElementPattern: pattern1 (1)
|
|
|
|
|
// pattern1
|
|
|
|
|
// subcarrierLocation-p1: s8 (2)
|
|
|
|
|
// symbolLocation-p1: 8
|
|
|
|
|
// freqBand
|
|
|
|
|
// startingRB: 0
|
|
|
|
|
// nrofRBs: 52
|
|
|
|
|
// periodicityAndOffset: slots80 (9)
|
|
|
|
|
// slots80: 1
|
|
|
|
|
// csi-IM-ResourceSetToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// CSI-IM-ResourceSet
|
|
|
|
|
// csi-IM-ResourceSetId: 0
|
|
|
|
|
// csi-IM-Resources: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// CSI-IM-ResourceId: 0
|
|
|
|
|
// csi-ResourceConfigToAddModList: 3 items
|
|
|
|
|
// Item 0
|
|
|
|
|
// CSI-ResourceConfig
|
|
|
|
|
// csi-ResourceConfigId: 0
|
|
|
|
|
// csi-RS-ResourceSetList: nzp-CSI-RS-SSB (0)
|
|
|
|
|
// nzp-CSI-RS-SSB
|
|
|
|
|
// nzp-CSI-RS-ResourceSetList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// NZP-CSI-RS-ResourceSetId: 0
|
|
|
|
|
// bwp-Id: 0
|
|
|
|
|
// resourceType: periodic (2)
|
|
|
|
|
// Item 1
|
|
|
|
|
// CSI-ResourceConfig
|
|
|
|
|
// csi-ResourceConfigId: 1
|
|
|
|
|
// csi-RS-ResourceSetList: csi-IM-ResourceSetList (1)
|
|
|
|
|
// csi-IM-ResourceSetList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// CSI-IM-ResourceSetId: 0
|
|
|
|
|
// bwp-Id: 0
|
|
|
|
|
// resourceType: periodic (2)
|
|
|
|
|
// Item 2
|
|
|
|
|
// CSI-ResourceConfig
|
|
|
|
|
// csi-ResourceConfigId: 2
|
|
|
|
|
// csi-RS-ResourceSetList: nzp-CSI-RS-SSB (0)
|
|
|
|
|
// nzp-CSI-RS-SSB
|
|
|
|
|
// nzp-CSI-RS-ResourceSetList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// NZP-CSI-RS-ResourceSetId: 1
|
|
|
|
|
// bwp-Id: 0
|
|
|
|
|
// resourceType: periodic (2)
|
|
|
|
|
// csi-ReportConfigToAddModList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// CSI-ReportConfig
|
|
|
|
|
// reportConfigId: 0
|
|
|
|
|
// resourcesForChannelMeasurement: 0
|
|
|
|
|
// csi-IM-ResourcesForInterference: 1
|
|
|
|
|
// reportConfigType: periodic (0)
|
|
|
|
|
// periodic
|
|
|
|
|
// reportSlotConfig: slots80 (7)
|
|
|
|
|
// slots80: 9
|
|
|
|
|
// pucch-CSI-ResourceList: 1 item
|
|
|
|
|
// Item 0
|
|
|
|
|
// PUCCH-CSI-Resource
|
|
|
|
|
// uplinkBandwidthPartId: 0
|
|
|
|
|
// pucch-Resource: 17
|
|
|
|
|
// reportQuantity: cri-RI-PMI-CQI (1)
|
|
|
|
|
// cri-RI-PMI-CQI: NULL
|
|
|
|
|
// reportFreqConfiguration
|
|
|
|
|
// cqi-FormatIndicator: widebandCQI (0)
|
|
|
|
|
// timeRestrictionForChannelMeasurements: notConfigured (1)
|
|
|
|
|
// timeRestrictionForInterferenceMeasurements: notConfigured (1)
|
|
|
|
|
// groupBasedBeamReporting: disabled (1)
|
|
|
|
|
// disabled
|
|
|
|
|
// cqi-Table: table2 (1)
|
|
|
|
|
// subbandSize: value1 (0)
|
|
|
|
|
// tag-Id: 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ue_dummy_stack : public srsue::stack_interface_phy_nr
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
uint16_t rnti = 0;
|
|
|
|
|
bool valid = false;
|
|
|
|
|
|
|
|
|
|
struct dummy_harq_proc {
|
|
|
|
|
static const uint32_t MAX_TB_SZ = SRSRAN_LDPC_MAX_LEN_CB * SRSRAN_SCH_NR_MAX_NOF_CB_LDPC;
|
|
|
|
|
srsran_softbuffer_rx_t softbuffer = {};
|
|
|
|
|
|
|
|
|
|
dummy_harq_proc()
|
|
|
|
|
{
|
|
|
|
|
// Initialise softbuffer
|
|
|
|
|
if (srsran_softbuffer_rx_init_guru(&softbuffer, SRSRAN_SCH_NR_MAX_NOF_CB_LDPC, SRSRAN_LDPC_MAX_LEN_ENCODED_CB) <
|
|
|
|
|
SRSRAN_SUCCESS) {
|
|
|
|
|
ERROR("Error Tx buffer");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~dummy_harq_proc() { srsran_softbuffer_rx_free(&softbuffer); }
|
|
|
|
|
};
|
|
|
|
|
srsran::circular_array<dummy_harq_proc, SRSRAN_MAX_HARQ_PROC_DL_NR> rx_harq_proc;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
struct args_t {
|
|
|
|
|
uint16_t rnti = 0x1234;
|
|
|
|
|
};
|
|
|
|
|
ue_dummy_stack(const args_t& args) : rnti(args.rnti) { valid = true; }
|
|
|
|
|
void in_sync() override {}
|
|
|
|
|
void out_of_sync() override {}
|
|
|
|
|
void run_tti(const uint32_t tti) override {}
|
|
|
|
|
int sf_indication(const uint32_t tti) override { return 0; }
|
|
|
|
|
sched_rnti_t get_dl_sched_rnti_nr(const uint32_t tti) override { return sched_rnti_t(); }
|
|
|
|
|
sched_rnti_t get_ul_sched_rnti_nr(const uint32_t tti) override { return sched_rnti_t(); }
|
|
|
|
|
void new_grant_dl(const uint32_t cc_idx, const mac_nr_grant_dl_t& grant, tb_action_dl_t* action) override {}
|
|
|
|
|
sched_rnti_t get_dl_sched_rnti_nr(const uint32_t tti) override { return {rnti, srsran_rnti_type_c}; }
|
|
|
|
|
sched_rnti_t get_ul_sched_rnti_nr(const uint32_t tti) override { return {rnti, srsran_rnti_type_c}; }
|
|
|
|
|
void new_grant_dl(const uint32_t cc_idx, const mac_nr_grant_dl_t& grant, tb_action_dl_t* action) override
|
|
|
|
|
{
|
|
|
|
|
action->tb.enabled = true;
|
|
|
|
|
action->tb.softbuffer = &rx_harq_proc[grant.pid].softbuffer;
|
|
|
|
|
}
|
|
|
|
|
void tb_decoded(const uint32_t cc_idx, const mac_nr_grant_dl_t& grant, tb_action_dl_result_t result) override {}
|
|
|
|
|
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, tb_action_ul_t* action) override {}
|
|
|
|
|
void prach_sent(uint32_t tti, uint32_t s_id, uint32_t t_id, uint32_t f_id, uint32_t ul_carrier_id) override {}
|
|
|
|
|
bool sr_opportunity(uint32_t tti, uint32_t sr_id, bool meas_gap, bool ul_sch_tx) override { return false; }
|
|
|
|
|
bool is_valid() const { return valid; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class gnb_dummy_stack : public srsenb::stack_interface_phy_nr
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
srslog::basic_logger& logger = srslog::fetch_basic_logger("GNB STK");
|
|
|
|
|
const uint16_t rnti = 0x1234;
|
|
|
|
|
const uint32_t mcs = 1;
|
|
|
|
|
const srsran::circular_array<bool, SRSRAN_NOF_SF_X_FRAME> pdsch_mask;
|
|
|
|
|
srsran::circular_array<srsran_dci_location_t, SRSRAN_NOF_SF_X_FRAME> dci_dl_location;
|
|
|
|
|
srsran::circular_array<srsran_dci_location_t, SRSRAN_NOF_SF_X_FRAME> dci_ul_location;
|
|
|
|
|
srsran::circular_array<uint32_t, SRSRAN_NOF_SF_X_FRAME> dl_data_to_ul_ack;
|
|
|
|
|
bool valid = false;
|
|
|
|
|
srsran_search_space_t ss = {};
|
|
|
|
|
srsran_dci_format_nr_t dci_format_ul = SRSRAN_DCI_FORMAT_NR_COUNT;
|
|
|
|
|
srsran_dci_format_nr_t dci_format_dl = SRSRAN_DCI_FORMAT_NR_COUNT;
|
|
|
|
|
uint32_t dl_freq_res = 0;
|
|
|
|
|
uint32_t dl_time_res = 0;
|
|
|
|
|
srsran_random_t random_gen = nullptr;
|
|
|
|
|
|
|
|
|
|
struct dummy_harq_proc {
|
|
|
|
|
static const uint32_t MAX_TB_SZ = SRSRAN_LDPC_MAX_LEN_CB * SRSRAN_SCH_NR_MAX_NOF_CB_LDPC;
|
|
|
|
|
std::vector<uint8_t> data;
|
|
|
|
|
srsran_softbuffer_tx_t softbuffer = {};
|
|
|
|
|
|
|
|
|
|
dummy_harq_proc()
|
|
|
|
|
{
|
|
|
|
|
// Allocate data
|
|
|
|
|
data.resize(MAX_TB_SZ);
|
|
|
|
|
|
|
|
|
|
// Initialise softbuffer
|
|
|
|
|
if (srsran_softbuffer_tx_init_guru(&softbuffer, SRSRAN_SCH_NR_MAX_NOF_CB_LDPC, SRSRAN_LDPC_MAX_LEN_ENCODED_CB) <
|
|
|
|
|
SRSRAN_SUCCESS) {
|
|
|
|
|
ERROR("Error Tx buffer");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~dummy_harq_proc() { srsran_softbuffer_tx_free(&softbuffer); }
|
|
|
|
|
};
|
|
|
|
|
srsran::circular_array<dummy_harq_proc, SRSRAN_MAX_HARQ_PROC_DL_NR> tx_harq_proc;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
struct args_t {
|
|
|
|
|
srsran::phy_cfg_nr_t phy_cfg; ///< Physical layer configuration
|
|
|
|
|
uint16_t rnti = 0x1234; ///< C-RNTI
|
|
|
|
|
uint32_t mcs = 10; ///< Modulation code scheme
|
|
|
|
|
srsran::circular_array<bool, SRSRAN_NOF_SF_X_FRAME> pdsch_mask = {}; ///< PDSCH scheduling mask
|
|
|
|
|
uint32_t ss_id = 1; ///< Search Space identifier
|
|
|
|
|
uint32_t pdcch_aggregation_level = 0; ///< PDCCH aggregation level
|
|
|
|
|
uint32_t pdcch_dl_candidate_index = 0; ///< PDCCH DL DCI candidate index
|
|
|
|
|
uint32_t pdcch_ul_candidate_index = 0; ///< PDCCH UL DCI candidate index
|
|
|
|
|
uint32_t dl_start_rb = 0; ///< Start resource block
|
|
|
|
|
uint32_t dl_length_rb = 0l; ///< Number of resource blocks
|
|
|
|
|
uint32_t dl_time_res = 0; ///< PDSCH time resource
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
gnb_dummy_stack(args_t args) :
|
|
|
|
|
pdsch_mask(args.pdsch_mask),
|
|
|
|
|
mcs(args.mcs),
|
|
|
|
|
rnti(args.rnti),
|
|
|
|
|
dl_time_res(args.dl_time_res)
|
|
|
|
|
{
|
|
|
|
|
random_gen = srsran_random_init(0x1234);
|
|
|
|
|
|
|
|
|
|
// Select search space
|
|
|
|
|
if (args.ss_id >= SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE) {
|
|
|
|
|
logger.error("Search Space Id (%d) is out-of-range (%d)", args.ss_id, SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (not args.phy_cfg.pdcch.search_space_present[args.ss_id]) {
|
|
|
|
|
logger.error("Search Space Id (%d) is not present", args.ss_id);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ss = args.phy_cfg.pdcch.search_space[args.ss_id];
|
|
|
|
|
|
|
|
|
|
// Select CORESET
|
|
|
|
|
if (ss.coreset_id >= SRSRAN_UE_DL_NR_MAX_NOF_CORESET) {
|
|
|
|
|
logger.error("CORESET Id (%d) is out-of-range (%d)", ss.coreset_id, SRSRAN_UE_DL_NR_MAX_NOF_CORESET);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (not args.phy_cfg.pdcch.coreset_present[ss.coreset_id]) {
|
|
|
|
|
logger.error("CORESET Id (%d) is not present", args.ss_id);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const srsran_coreset_t& coreset = args.phy_cfg.pdcch.coreset[ss.coreset_id];
|
|
|
|
|
|
|
|
|
|
// Select DCI locations
|
|
|
|
|
for (uint32_t slot = 0; slot < SRSRAN_NOF_SF_X_FRAME; slot++) {
|
|
|
|
|
std::array<uint32_t, SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR> ncce = {};
|
|
|
|
|
int n = srsran_pdcch_nr_locations_coreset(&coreset, &ss, rnti, args.pdcch_aggregation_level, slot++, ncce.data());
|
|
|
|
|
if (n < SRSRAN_SUCCESS) {
|
|
|
|
|
logger.error(
|
|
|
|
|
"Error generating locations for slot %d and aggregation level %d", slot, args.pdcch_aggregation_level);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
uint32_t nof_candidates = (uint32_t)n;
|
|
|
|
|
|
|
|
|
|
// DCI DL
|
|
|
|
|
if (args.pdcch_dl_candidate_index >= nof_candidates or
|
|
|
|
|
args.pdcch_dl_candidate_index >= SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR) {
|
|
|
|
|
logger.error("Candidate index %d exceeds the number of candidates %d for aggregation level %d",
|
|
|
|
|
args.pdcch_dl_candidate_index,
|
|
|
|
|
n,
|
|
|
|
|
args.pdcch_aggregation_level);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dci_dl_location[slot].L = args.pdcch_aggregation_level;
|
|
|
|
|
dci_dl_location[slot].ncce = ncce[args.pdcch_dl_candidate_index];
|
|
|
|
|
|
|
|
|
|
// DCI UL
|
|
|
|
|
if (args.pdcch_ul_candidate_index >= nof_candidates or
|
|
|
|
|
args.pdcch_ul_candidate_index >= SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR) {
|
|
|
|
|
logger.error("Candidate index %d exceeds the number of candidates %d for aggregation level %d",
|
|
|
|
|
args.pdcch_ul_candidate_index,
|
|
|
|
|
n,
|
|
|
|
|
args.pdcch_aggregation_level);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dci_ul_location[slot].L = args.pdcch_aggregation_level;
|
|
|
|
|
dci_ul_location[slot].ncce = ncce[args.pdcch_ul_candidate_index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Select DCI formats
|
|
|
|
|
for (uint32_t i = 0; i < ss.nof_formats; i++) {
|
|
|
|
|
// Select DL format
|
|
|
|
|
if (ss.formats[i] == srsran_dci_format_nr_1_0 or ss.formats[i] == srsran_dci_format_nr_1_1) {
|
|
|
|
|
dci_format_dl = ss.formats[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Select DL format
|
|
|
|
|
if (ss.formats[i] == srsran_dci_format_nr_0_0 or ss.formats[i] == srsran_dci_format_nr_0_1) {
|
|
|
|
|
dci_format_ul = ss.formats[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Validate that a DCI format is selected
|
|
|
|
|
if (dci_format_dl == SRSRAN_DCI_FORMAT_NR_COUNT or dci_format_ul == SRSRAN_DCI_FORMAT_NR_COUNT) {
|
|
|
|
|
logger.error("Missing valid DL or UL DCI format in search space");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Select DL frequency domain resources
|
|
|
|
|
dl_freq_res = srsran_ra_nr_type1_riv(args.phy_cfg.carrier.nof_prb, args.dl_start_rb, args.dl_length_rb);
|
|
|
|
|
|
|
|
|
|
// Setup DL Data to ACK timing
|
|
|
|
|
for (uint32_t i = 0; i < SRSRAN_NOF_SF_X_FRAME; i++) {
|
|
|
|
|
dl_data_to_ul_ack[i] = args.phy_cfg.harq_ack.dl_data_to_ul_ack[i % SRSRAN_MAX_NOF_DL_DATA_TO_UL];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If reached this point the configuration is valid
|
|
|
|
|
valid = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~gnb_dummy_stack() { srsran_random_free(random_gen); }
|
|
|
|
|
|
|
|
|
|
bool is_valid() const { return valid; }
|
|
|
|
|
|
|
|
|
|
int sf_indication(const uint32_t tti) override { return 0; }
|
|
|
|
|
int rx_data_indication(rx_data_ind_t& grant) override { return 0; }
|
|
|
|
|
|
|
|
|
|
int get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res) override
|
|
|
|
|
{
|
|
|
|
|
dl_sched_res[0].nof_grants = 0;
|
|
|
|
|
// Check input
|
|
|
|
|
if (dl_sched_res.size() == 0) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check PDSCH mask, if no PDSCH shall be scheduled, do not set any grant and skip
|
|
|
|
|
if (not pdsch_mask[tti]) {
|
|
|
|
|
dl_sched_res[0].nof_grants = 0;
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Select grant and set data
|
|
|
|
|
dl_sched_grant_t& grant = dl_sched_res[0].pdsch[0];
|
|
|
|
|
grant.data[0] = tx_harq_proc[tti].data.data();
|
|
|
|
|
grant.softbuffer_tx[0] = &tx_harq_proc[tti].softbuffer;
|
|
|
|
|
|
|
|
|
|
// Second TB is not used
|
|
|
|
|
grant.data[1] = nullptr;
|
|
|
|
|
grant.softbuffer_tx[1] = nullptr;
|
|
|
|
|
|
|
|
|
|
// Reset Tx softbuffer always
|
|
|
|
|
srsran_softbuffer_tx_reset(grant.softbuffer_tx[0]);
|
|
|
|
|
|
|
|
|
|
// Generate random data
|
|
|
|
|
srsran_random_byte_vector(random_gen, grant.data[0], SRSRAN_LDPC_MAX_LEN_CB * SRSRAN_SCH_NR_MAX_NOF_CB_LDPC / 8);
|
|
|
|
|
|
|
|
|
|
// It currently support only one grant
|
|
|
|
|
dl_sched_res[0].nof_grants = 1;
|
|
|
|
|
|
|
|
|
|
// Fill DCI
|
|
|
|
|
srsran_dci_dl_nr_t& dci = grant.dci;
|
|
|
|
|
dci.ctx.location = dci_dl_location[tti];
|
|
|
|
|
dci.ctx.ss_type = ss.type;
|
|
|
|
|
dci.ctx.coreset_id = ss.coreset_id;
|
|
|
|
|
dci.ctx.rnti_type = srsran_rnti_type_c;
|
|
|
|
|
dci.ctx.format = dci_format_dl;
|
|
|
|
|
dci.ctx.rnti = rnti;
|
|
|
|
|
dci.freq_domain_assigment = dl_freq_res;
|
|
|
|
|
dci.time_domain_assigment = dl_time_res;
|
|
|
|
|
dci.mcs = mcs;
|
|
|
|
|
dci.rv = 0;
|
|
|
|
|
dci.ndi = (tti / SRSRAN_NOF_SF_X_FRAME) % 2;
|
|
|
|
|
dci.pid = tti % SRSRAN_NOF_SF_X_FRAME;
|
|
|
|
|
dci.dai = tti % SRSRAN_NOF_SF_X_FRAME;
|
|
|
|
|
dci.tpc = 1;
|
|
|
|
|
dci.pucch_resource = 0;
|
|
|
|
|
dci.harq_feedback = dl_data_to_ul_ack[tti];
|
|
|
|
|
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_ul_sched(uint32_t tti, ul_sched_list_t& ul_sched_res) override { return 0; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
|
{
|
|
|
|
|
srslog::init();
|
|
|
|
|
|
|
|
|
|
// Parse test bench arguments
|
|
|
|
|
test_bench::args_t args(argc, argv);
|
|
|
|
|
args.gnb_args.log_id_preamble = "GNB/";
|
|
|
|
|
args.gnb_args.log_level = "warning";
|
|
|
|
|
args.gnb_args.nof_workers = 1;
|
|
|
|
|
args.ue_args.log.id_preamble = " UE/";
|
|
|
|
|
args.ue_args.log.phy_level = "warning";
|
|
|
|
|
args.ue_args.log.phy_hex_limit = 0;
|
|
|
|
|
args.ue_args.nof_phy_threads = 1;
|
|
|
|
|
|
|
|
|
|
// Parse arguments
|
|
|
|
|
TESTASSERT(args.valid);
|
|
|
|
|
|
|
|
|
|
ue_dummy_stack ue_stack;
|
|
|
|
|
gnb_dummy_stack gnb_stack;
|
|
|
|
|
// Create UE stack arguments
|
|
|
|
|
ue_dummy_stack::args_t ue_stack_args = {};
|
|
|
|
|
ue_stack_args.rnti = 0x1234;
|
|
|
|
|
|
|
|
|
|
// Create UE stack
|
|
|
|
|
ue_dummy_stack ue_stack(ue_stack_args);
|
|
|
|
|
TESTASSERT(ue_stack.is_valid());
|
|
|
|
|
|
|
|
|
|
// Create GNB stack arguments
|
|
|
|
|
gnb_dummy_stack::args_t gnb_stack_args = {};
|
|
|
|
|
gnb_stack_args.rnti = 0x1234;
|
|
|
|
|
gnb_stack_args.mcs = 10;
|
|
|
|
|
for (bool& mask : gnb_stack_args.pdsch_mask) {
|
|
|
|
|
mask = true;
|
|
|
|
|
}
|
|
|
|
|
gnb_stack_args.phy_cfg = args.phy_cfg;
|
|
|
|
|
gnb_stack_args.dl_start_rb = 0;
|
|
|
|
|
gnb_stack_args.dl_length_rb = args.phy_cfg.carrier.nof_prb;
|
|
|
|
|
|
|
|
|
|
// Create GNB stack
|
|
|
|
|
gnb_dummy_stack gnb_stack(gnb_stack_args);
|
|
|
|
|
TESTASSERT(gnb_stack.is_valid());
|
|
|
|
|
|
|
|
|
|
// Create test bench
|
|
|
|
|
test_bench tb(args, gnb_stack, ue_stack);
|
|
|
|
@ -554,10 +522,10 @@ int main(int argc, char** argv)
|
|
|
|
|
// Assert bench is initialised correctly
|
|
|
|
|
TESTASSERT(tb.is_initialised());
|
|
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < 1000; i++) {
|
|
|
|
|
for (uint32_t i = 0; i < 20; i++) {
|
|
|
|
|
TESTASSERT(tb.run_tti());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If reached here, the test is successful
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|