Agora
1.2.0
Agora project
|
Go to the documentation of this file.
6 #ifndef DATA_GENERATOR_H_
7 #define DATA_GENERATOR_H_
11 #include "common_typedef_sdk.h"
54 mac->
DataPtr()[
i] = 1 + (ue_id * 3) + (
i % 3);
75 information.at(
i) = 1 + (ue_id * 3) + (
i % 3);
88 std::vector<int8_t>& encoded_codeword) {
90 std::vector<int8_t> parity;
94 encoded_codeword.resize(
98 &encoded_codeword.at(0), &parity.at(0), input_ptr);
109 const std::vector<int8_t>& encoded_codeword) {
113 AdaptBitsForMod(
reinterpret_cast<const uint8_t*
>(&encoded_codeword[0]),
119 modulated_codeword[
i] =
122 return modulated_codeword;
126 const std::vector<int8_t>& encoded_codeword,
complex_float* pilot_seq) {
130 AdaptBitsForMod(
reinterpret_cast<const uint8_t*
>(&encoded_codeword[0]),
137 modulated_codeword[
i] =
141 modulated_codeword[
i] = pilot_seq[
i];
144 return modulated_codeword;
152 AdaptBitsForMod(
reinterpret_cast<const uint8_t*
>(&encoded_codeword[0]),
157 modulated_codeword[
i] =
160 return modulated_codeword;
170 const std::vector<complex_float>& modulated_codeword)
const {
171 std::vector<complex_float> pre_ifft_symbol(
cfg_->
OfdmCaNum());
175 return pre_ifft_symbol;
183 const std::vector<std::complex<float>> zc_common_pilot =
189 zc_common_pilot[
i].imag()};
201 #endif // DATA_GENERATOR_H_
uint64_t seed_
Definition: utils.h:181
static MKL_LONG IFFT(std::vector< std::complex< float >> &in_out, int fft_size, bool normalize=true)
Definition: comms-lib.cc:410
static size_t LdpcEncodingInputBufSize(size_t base_graph, size_t zc)
Definition: utils_ldpc.h:167
byte
Definition: core.h:388
size_t UeAntNum() const
Definition: config.h:41
void Calloc(size_t dim1, size_t dim2, Agora_memory::Alignment_t alignment)
Definition: memory_manage.h:45
static constexpr bool kOutputUlScData
Definition: symbols.h:359
Definition: test_transpose.cc:22
static constexpr bool kPrintDlTxData
Definition: data_generator.cc:30
size_t SampsPerSymbol() const
Definition: config.h:234
static const std::string kDlLdpcDataPrefix
Definition: data_generator.cc:39
end IFFT Reshape the symbol vector into two different spatial streams size
Definition: generate_data.m:73
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
void GenRawData(Direction dir, std::vector< int8_t > &information, size_t ue_id)
Generate one raw information bit sequence.
Definition: data_generator.h:65
std::string UeChannel() const
Definition: config.h:114
size_t NumBeaconSyms() const
Definition: framestats.cc:87
size_t MacPacketsPerframe(Direction dir) const
Definition: config.h:276
static void LdpcEncodeHelper(size_t base_graph, size_t zc, size_t nRows, int8_t *encoded_buffer, int8_t *parity_buffer, const int8_t *input_buffer)
Definition: utils_ldpc.h:195
size_t OfdmTxZeroPrefix() const
Definition: config.h:211
const Profile profile_
Definition: data_generator.h:198
Direction
Definition: symbols.h:39
size_t OfdmTxZeroPostfix() const
Definition: config.h:212
static constexpr bool kPrintUplinkInformationBytes
Definition: data_generator.cc:32
size_t CpLen() const
Definition: config.h:46
size_t GetOFDMDataNum() const
Definition: config.h:554
void * PaddedAlignedAlloc(Alignment_t alignment, size_t size)
Definition: memory_manage.cc:15
float NoiseLevel() const
Definition: config.h:310
size_t NumRows() const
Definition: ldpc_config.h:52
size_t BsAntNum() const
Definition: config.h:35
static size_t BitsToBytes(size_t n_bits)
Definition: utils_ldpc.h:124
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
const FrameStats & Frame() const
Definition: config.h:340
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
void GenCodeblock(Direction dir, const int8_t *input_ptr, std::vector< int8_t > &encoded_codeword)
Generate the encoded bit sequence for one code block for the active LDPC configuration from the input...
Definition: data_generator.h:87
static size_t LdpcEncodingEncodedBufSize(size_t base_graph, size_t zc)
Definition: utils_ldpc.h:181
std::vector< complex_float > BinForIfft(const std::vector< complex_float > &modulated_codeword) const
An array with OfdmDataNum() elements with the OfdmDataNum() modulated elements binned at the center.
Definition: data_generator.h:169
static constexpr bool kPrintDownlinkInformationBytes
Definition: data_generator.cc:33
std::vector< complex_float > GetModulation(const int8_t *encoded_codeword, size_t num_bits)
Definition: data_generator.h:147
size_t UeNum() const
Definition: config.h:40
constexpr std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
Definition: chrono.h:1488
void GenMacData(MacPacketPacked *mac, size_t ue_id)
Generate random Mac payload bit sequence.
Definition: data_generator.h:49
size_t OfdmDataNum() const
Definition: config.h:47
static constexpr size_t kOutputFrameNum
Definition: symbols.h:363
Implementation file for the Data generator class to generate binary files as inputs to Agora,...
constexpr auto num_bits() -> int
Definition: format.h:343
FastRand fast_rand_
Definition: data_generator.h:196
void DoDataGeneration(const std::string &directory)
Definition: data_generator.cc:51
Aligned types for SIMD compatibility.
auto ptr(T p) -> const void *
Definition: format.h:2680
void Free()
Definition: memory_manage.h:84
static constexpr bool kPrintDlModData
Definition: data_generator.cc:31
static std::vector< std::complex< float > > FFTShift(const std::vector< std::complex< float >> &in)
Definition: comms-lib.cc:581
data_start
Definition: inspect_agora_results.m:17
void Set(const uint16_t &f, const uint16_t &s, const uint16_t &u, const uint16_t &data_size)
Definition: message.h:286
size_t ClientUlPilotSymbols() const
Definition: framestats.h:73
Scramble Class and helper functions.
for i
Definition: generate_data.m:107
size_t OfdmCaNum() const
Definition: config.h:45
size_t MacPayloadMaxLength(Direction dir) const
Definition: config.h:272
size_t NumDlDataSyms() const
Definition: framestats.h:83
Building blocks for generating end-to-end or unit test workloads for Agora.
Definition: data_generator.h:21
size_t NumInputBytes() const
Definition: ldpc_config.h:30
static constexpr bool kPrintDebugCSI
Definition: data_generator.cc:28
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
Communications Library: a) Generate pilot/preamble sequences b) OFDM modulation.
Table< complex_float > & ModTable(Direction dir)
Definition: config.h:284
size_t NumBytesPerCb(Direction dir) const
Definition: config.h:251
complex_float ModSingleUint8(uint8_t x, Table< complex_float > &mod_table)
Definition: modulation.cc:213
bool IsDataSubcarrier(size_t sc_id) const
Definition: config.h:562
@ kLteZadoffChu
Definition: comms-lib.h:35
Definition: ldpc_config.h:14
size_t MacPacketLength(Direction dir) const
Definition: config.h:268
size_t OfdmDataStart() const
Definition: config.h:48
uint32_t NextU32()
Definition: utils.h:189
const LDPCconfig & LdpcConfig(Direction dir) const
Definition: config.h:280
size_t ClientDlPilotSymbols() const
Definition: framestats.h:76
std::vector< std::byte, boost::alignment::aligned_allocator< std::byte, kSimdAlignment > > SimdAlignByteVector
Definition: simd_types.h:18
size_t NumDLSyms() const
Definition: framestats.cc:83
Profile
Definition: data_generator.h:24
static const std::string kUlDataPrefix
Output files.
Definition: data_generator.cc:36
static std::vector< std::complex< float > > SeqCyclicShift(const std::vector< std::complex< float >> &in, float alpha)
Definition: comms-lib.cc:725
static const std::string kDlTxPrefix
Definition: data_generator.cc:41
static const std::string kUlScBitsPrefix
Definition: data_generator.cc:42
size_t NumULSyms() const
Definition: framestats.cc:85
size_t MacBytesNumPerframe(Direction dir) const
Definition: config.h:263
#define AGORA_LOG_SYMBOL(...)
Definition: logger.h:82
uint16_t ExpansionFactor() const
Definition: ldpc_config.h:47
size_t NumUeChannels() const
Definition: config.h:99
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
Config * cfg_
Definition: data_generator.h:197
fwrite(fileID, pilot_f, 'float')
static constexpr size_t kOfdmSymbolPerSlot
Definition: symbols.h:362
uint16_t PayloadLength() const
Definition: message.h:282
void Malloc(size_t dim1, size_t dim2, Agora_memory::Alignment_t alignment)
Definition: memory_manage.h:37
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
size_t NumPaddingBytesPerCb(Direction dir) const
Definition: config.h:255
unsigned char * DataPtr()
Definition: message.h:294
bool ScrambleEnabled() const
Definition: config.h:296
static const std::string kRxLdpcPrefix
Definition: data_generator.cc:40
std::string to_string() const
Definition: eth_common.h:64
uint16_t BaseGraph() const
Definition: ldpc_config.h:46
std::string Modulation(Direction dir) const
Definition: config.h:243
size_t NumEncodedBytes() const
Definition: ldpc_config.h:36
Declaration file for the configuration class which importants json configuration values into class va...
Definition: message.h:274
static float RandFloatFromShort(float min, float max)
Definition: data_generator.cc:44
std::vector< complex_float > GetDLModulation(const std::vector< int8_t > &encoded_codeword, complex_float *pilot_seq)
Definition: data_generator.h:125
static const std::string kDlDataPrefix
Definition: data_generator.cc:38
std::vector< complex_float > GetCommonPilotTimeDomain() const
Return the time-domain pilot symbol with OfdmCaNum complex floats.
Definition: data_generator.h:179
static constexpr float kShrtFltConvFactor
Definition: datatype_conversion.h:18
size_t NumUlDataSyms() const
Definition: framestats.h:80
static constexpr bool kDebugPrintRxData
Definition: data_generator.cc:29
bool FreqOrthogonalPilot() const
Definition: config.h:208
static const std::string kUlLdpcDataPrefix
Definition: data_generator.cc:37
static std::vector< std::complex< float > > DoubleToCfloat(const std::vector< std::vector< double >> &in)
Definition: utils.cc:232
static size_t LdpcEncodingParityBufSize(size_t base_graph, size_t zc)
Definition: utils_ldpc.h:174
static std::vector< std::vector< double > > GetSequence(size_t seq_len, int type)
Definition: comms-lib.cc:734
size_t ModOrderBits(Direction dir) const
Definition: config.h:247
void NumBlocksInSymbol(size_t num_blocks)
Definition: ldpc_config.h:41
size_t GetULSymbol(size_t location) const
Definition: framestats.cc:114
size_t GetOFDMDataIndex(size_t sc_id) const
Definition: config.h:558
static void AdaptBitsForMod(const uint8_t *bit_seq_in, uint8_t *bytes_out, size_t len, size_t mod_type)
Fill-in the bytes of bytes_out with mod_type bits per byte, taken from the bit sequence bit_seq_in.
Definition: utils_ldpc.h:60
std::vector< complex_float > GetModulation(const std::vector< int8_t > &encoded_codeword)
Return the output of modulating the encoded codeword.
Definition: data_generator.h:108
size_t OfdmDataStop() const
Definition: config.h:50
size_t NumTotalSyms() const
Definition: framestats.cc:93
DataGenerator(Config *cfg, uint64_t seed=0, Profile profile=Profile::kRandom)
Definition: data_generator.h:32