Compare commits

...

59 Commits

Author SHA1 Message Date
Vojtech
717d8f4220 Fixed PDRCH time delay generation
Fixed PDRCH noise generation
2026-02-25 14:06:04 +00:00
Vojtech
8e651e1d97 Fix delay multithreading race 2026-02-19 09:21:56 +00:00
Vojtech
a686aa8ac8 Fix wrong noise calculation
FIxed multithreding issues (zigguratNoise)
Moved ED after filter
2026-02-17 13:00:40 +00:00
Vojtech
f7a5f2b351 Disabled postamble detection 2026-01-21 14:34:06 +00:00
Vojtech
b998cc0537 Fix bug 2026-01-21 13:14:38 +00:00
Vojtech
be0bb9b276 Added random channel time delay
New normalized DFT-s-OFDM precomputed SC maps
2026-01-21 13:12:38 +00:00
Vojtech
c778cbf1dd Changed to TDL-A 2026-01-08 09:49:33 +00:00
Vojtech
1dfa1832ad Thesis release 2026-01-06 22:10:53 +00:00
Vojtech
821da7073a Bug fixes 2025-12-31 15:07:16 +00:00
Vojtech
a9d41af2db Fixed bug in energy plotting 2025-12-29 21:35:04 +00:00
Vojtech
4947d28976 Code cleaning 2025-12-29 19:46:15 +00:00
Vojtech
080d31ae87 Another change to the SIP 2025-12-27 14:01:20 +00:00
Vojtech
3a4a027909 Revert also SIP 2025-12-27 10:41:10 +00:00
Vojtech
0dd60d4570 Revert back to original DFT-s-OFDM 2025-12-26 20:14:55 +00:00
Vojtech
5e57f1227d Ruled out postamble in PRDCH 2025-12-25 21:20:27 +00:00
Vojtech
1e1a9dca8b Fixed adaptive threshold 2025-12-25 20:52:17 +00:00
Vojtech
d29785295c Changes to the DFT-s-OFDM on reader side 2025-12-25 17:29:16 +00:00
Vojtech
cbb1a0e8a1 Faster signal power calculation 2025-12-21 20:40:52 +00:00
Vojtech
13777fa4ca Changes to DFT-s-OFDM and SC creation 2025-12-21 16:19:27 +00:00
Vojtech
76edb75586 Code and prints cleaning 2025-12-18 22:17:04 +00:00
Vojtech
1cc8aeaa42 Code cleaning 2025-12-18 11:00:11 +00:00
Vojtech
c2c24b3453 Implemented multithreading to PDRCH simulation
- Added AVX2/AVX-512 for synchronization and envelope detection
2025-12-13 20:35:07 +00:00
Vojtech
99c7f6c2c2 Added CRC to PDRCH
Minor fixes
2025-12-11 21:33:28 +00:00
Vojtech
82f97fad22 FIxed line encoding in PRDCH 2025-12-04 15:12:07 +00:00
Vojtech
0fe0a83a6f Separated general test and timing test 2025-12-04 10:29:35 +00:00
Vojtech
f0ea8a85c5 Changes in noise generation
- Noise generation was slow in multithreading due to memory conflicts
2025-12-04 10:03:30 +00:00
Vojtech
1286a5b379 Fixed time measurements 2025-12-03 13:22:49 +00:00
Vojtech
042cf56b9f Added CRC insertion and CRC check
- Fixed bug in RX decoder (incorrect alignment)
2025-12-03 09:13:55 +00:00
Vojtech
c1f0cf2aa8 Fixed multithreading 2025-12-02 14:03:14 +00:00
Vojtech
9c840feca5 Rewritten Butterworth filter from floating point to fixed point for speed 2025-12-02 10:23:11 +00:00
Vojtech
a8d9f6ee8a PRDCH Filter speed optimization 2025-12-01 15:57:14 +00:00
Vojtech
0d1cca441c Another speed optimalization os PRDCH
- Fixed synchro AVX
 - Added AVX to envelope detector
2025-12-01 15:22:40 +00:00
Vojtech
15a7546fc6 Fix SIMDe 2025-12-01 14:08:19 +00:00
Vojtech
0985778e3e Speed optimization of PRDCH
- Added AVX2/AVX-512 support for synchronization
2025-12-01 13:41:57 +00:00
Vojtech
a6980f7215 Added multithreading to the simulation 2025-12-01 12:48:30 +00:00
Vojtech
a0e93621f1 Fixed timing calculation 2025-12-01 10:06:21 +00:00
Vojtech
9b37de3ab5 Improved synchronization
- Better time visualization
2025-11-30 21:41:24 +00:00
Vojtech
80a6b9f92a Full block correlation
- Added initial silence section before preamble to improve synchronization
2025-11-30 17:58:18 +00:00
Vojtech
3d4ce94896 Threshold based correlation 2025-11-28 09:49:32 +00:00
Vojtech
4e2df6d2c1 First working PDRCH sim
- Added RX decoding chain
 - First BLER simulation
2025-11-25 09:37:51 +00:00
Vojtech
7935d0d5bf - Added PDRCH siim
- Basic D2R packet generation
2025-11-18 10:02:30 +00:00
Vojtech
842fb41fc3 Cleaning 2025-11-12 10:15:24 +00:00
Vojtech
ae47d1679b Minor optimalizations 2025-11-11 21:16:41 +00:00
Vojtech
8a72ceb9ac New IIR Butterworth filter (faster)
Added speed profiling
2025-11-07 08:50:05 +00:00
Vojtech
217394183d Rewritten packet decoding
- Packet decoding is more stream oriented (real-time)
 - Added M detection on RX side
 - Fixed typo CAS -> CAP
 - New DFT-s-OFDM normalization
2025-11-05 08:29:06 +00:00
Vojtech
77f70c8bdd Added speed optimalization
- Time statistics of each operation
- Moved malloc from for, another minor optimalizations
2025-10-31 10:15:55 +00:00
Vojtech
d63cabe395 - Added testing mode (plots at given SNR)
- Improved Postamble detection with adaptive threshold
- Improved SIP correlation (remove DC and divide by variance)
- Experimental new precomputed FD on TX
2025-10-30 14:31:16 +00:00
Vojtech
3662c2cc3c Moved memory allocation outside the loop
Postamble detection changed
2025-10-27 15:16:58 +00:00
Vojtech
23b557948b New BLER test
- Izolated BLER test
- Bug fixes
2025-10-27 13:28:51 +00:00
Vojtech
d587cd8149 Separated and organized the functions
Organized matlab files
2025-10-22 09:11:01 +00:00
Vojtech
64b488c1a2 Moved individual steps to functions 2025-10-20 12:06:13 +02:00
Vojtech
598412cc17 Fixed memory leaks
Added BER
Finished RX chain
2025-10-14 14:26:17 +02:00
Vojtech
3a965ac0f3 Added whole R2D packet creation 2025-10-09 23:50:36 +02:00
Vojtech
a86eacc0db Added PRDCH rx correlation 2025-10-07 10:37:14 +02:00
Vojtech
bb1ded8810 Added PRDCH receiver chain 2025-10-01 14:25:27 +02:00
Vojtech Masny
c10fe36d55 Fixed noise generation 2025-09-29 14:53:07 +02:00
Vojtech Masny
4476680814 Tests with changing RBs count 2025-09-24 16:23:00 +02:00
Vojtech Masny
6f96dd182b Test PRDCH DFT-s-OFDM
- creates .m file of time domain frame (OOK pulses)
2025-09-22 13:57:48 +02:00
Vojtech Masny
30749afed7 Added PRDCH channel test experiment
- test DFT-s-OFDM
- OFDM symbol creation
2025-09-17 10:53:03 +02:00
19 changed files with 10043 additions and 10 deletions

View File

@@ -478,8 +478,8 @@ endif()
# Hardware dependant options
###################################
add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
add_list1_option(NB_ANTENNAS_RX "1" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "1" "Number of antennas in transmission" "1" "2" "4")
set (CONFIG_ROOTDIR ${OPENAIR_DIR}/common/config)
add_library(config_internals OBJECT
@@ -2051,6 +2051,20 @@ target_link_libraries(nr_prachsim PRIVATE
m pthread ${T_LIB} ITTI dl shlib_loader physim_common)
target_link_libraries(nr_prachsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
add_executable(nr_prdchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/prdchsim.c)
target_link_libraries(nr_prdchsim PRIVATE
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc -Wl,--end-group
m pthread ${T_LIB} ITTI dl shlib_loader nr_ue_phy_meas physim_common
)
target_link_libraries(nr_prdchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
add_executable(nr_pdrchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pdrchsim.c)
target_link_libraries(nr_pdrchsim PRIVATE
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc -Wl,--end-group
m pthread ${T_LIB} ITTI dl shlib_loader nr_ue_phy_meas physim_common
)
target_link_libraries(nr_pdrchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
add_executable(nr_ulschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
${PHY_INTERFACE_DIR}/queue_t.c

View File

@@ -304,7 +304,7 @@ function main() {
SIMUS_PHY=1
CMAKE_CMD="$CMAKE_CMD -DENABLE_PHYSIM_TESTS=ON"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
TARGET_LIST="$TARGET_LIST dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim nr_psbchsim"
TARGET_LIST="$TARGET_LIST dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim nr_psbchsim nr_prdchsim nr_pdrchsim"
echo_info "Will compile dlsim, ulsim, ..."
shift;;
-V | --vcd)

View File

@@ -1 +1 @@
add_subdirectory(PHY)
add_subdirectory(PHY)

View File

@@ -117,6 +117,8 @@ typedef struct {
} nr_srs_info_t;
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
typedef struct NR_AIOT_DL_FRAME_PARMS NR_AIOT_DL_FRAME_PARMS;
typedef struct NR_AIOT_UL_FRAME_PARMS NR_AIOT_UL_FRAME_PARMS;
typedef uint32_t (*get_samples_per_slot_t)(int slot, const NR_DL_FRAME_PARMS *fp);
typedef uint32_t (*get_slot_from_timestamp_t)(openair0_timestamp timestamp_rx, const NR_DL_FRAME_PARMS *fp);
@@ -244,6 +246,65 @@ struct NR_DL_FRAME_PARMS {
bool print_ue_help_cmdline_log;
};
struct NR_AIOT_DL_FRAME_PARMS {
// original NR structure
NR_DL_FRAME_PARMS nr_frame_parms;
// additional AIoT parameters
bool Zadoff_Chu; // true -> use Zadoff-Chu sequence, false -> use standard Zadoff-Chu sequence
int M; // number of chips in OFDM symbol
// packet parameters
int payload_size; // Payload size in bits
int packet_size; // Payload+CRC size in bits
int packet_encoded_size; // Manchester encoded payload size in bits
int packet_symbols; // number of OFDM symbols in R2D packet
int packet_slots; // number of slots in R2D packet
int packet_subcarriers; // number of subcarriers in R2D packet
int packet_samples; // number of samples in R2D packet (aligned to slots)
// RX parameters
int N; // downsampling factor
int received_M; // detected M from R-TAS-CAP
int packet_downsampled_samples; // number of downsampled samples in R2D packet
int packet_received_symbols; // number of received OFDM symbols
int packet_payload_size; // decoded payload size in bits
int SIP_samples; // number of samples in R2D preamble
};
struct NR_AIOT_UL_FRAME_PARMS {
// original NR structure
NR_DL_FRAME_PARMS nr_frame_parms;
// additional AIoT parameters (TS 38.391 6.2.1.6-1)
uint8_t T_bit; // 3 bits, D2R bit duration options
bool R_block; // block repetition number - true=2, false=1
uint8_t R_SFS; // 3 bits, small frequency shift factor
uint8_t I_bit; // 2 bits, the interval in bits for D2R midamble section
bool L_preamble; // length of preamble - false=short 7 bits or true=long 31 bits
bool I_add; // additional D2R midable insertion indicator - false=absent, true=present
bool R_code; // the channel coding indicator - true=FEC, false=No FEC
uint8_t size; // the transport block size in bytes
// packet parameters
int N_bit; // number of samples per D2R bit
int N_chip; // number of samples per D2R chip
int N_preamble; // number of bits in D2R preamble
int N_SFS; // value of small frequency shift
int N_midamble_space; // number of bits in D2R midamble
int payload_size; // decoded payload size in bits
int packet_size; // total size of D2R packet in bits
int packet_samples; // number of samples in D2R packet
int preamble_samples; // number of samples in D2R preamble
int midamble_samples; // number of samples in D2R midamble
// rx parameters
double f_min; // minimum frequency shift
double f_max; // maximum frequency shift
int packet_payload_size; // decoded payload size in bits
};
// PRS config structures
typedef struct {
uint16_t PRSResourceSetPeriod[2]; // [slot period, slot offset] of a PRS resource set

View File

@@ -0,0 +1,39 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/defs_aiot_common.h
\brief AIOT PHY layer common definitions
\author Vojtech Masny
\date 2025
\version 0.1
\company Eurecom
\email:
\note
\warning
*/
#ifndef __PHY_DEFS_AIOT_COMMON__H__
#define __PHY_DEFS_AIOT_COMMON__H__
#endif

View File

@@ -0,0 +1,49 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/defs_aiot_d2r.h
\brief AIOT PHY layer D2R definitions
\author Vojtech Masny
\date 2025
\version 0.1
\company Eurecom
\email:
\note
\warning
*/
#ifndef __PHY_DEFS_AIOT_D2R__H__
#define __PHY_DEFS_AIOT_D2R__H__
// D-TAS preambles in length of 7 and 31 bits
#define D_TAS_7_BITS 0x4E
#define D_TAS_31_BITS 0x242BB1F3
#define POSTAMBLE_N 4
#define POSTAMBLE 0xF
const double T_BIT_TABLE[8] = { 2.0, 1.0, 1/2.0, 1/4.0, 1/8.0, 1/16.0, 1/32.0, 1/96.0 };
const int I_BIT_TABLE[4] = { 48, 96, 168, 240 };
#define MAX_AIOT_D2R_PAYLOAD_SIZE 125 // bytes
#define MAX_AIOT_D2R_PACKET_SIZE (MAX_AIOT_D2R_PAYLOAD_SIZE + 2)
#endif

View File

@@ -0,0 +1,54 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/defs_aiot_R2D.h
\brief AIOT PHY layer R2D definitions
\author Vojtech Masny
\date 2025
\version 0.1
\company Eurecom
\email:
\note
\warning
*/
#ifndef __PHY_DEFS_AIOT_R2D__H__
#define __PHY_DEFS_AIOT_R2D__H__
#define R_TAS_SIP 0xC8
#define R_TAS_SIP_N 8
#define R_TAS_SIP_M 4
#define R_TAS_CAP 0xA
#define R_TAS_CAP_N 4
#define R2D_POSTAMBLE 0xF
#define R2D_POSTAMBLE_N 4
#define MAX_AIOT_R2D_PAYLOAD_SIZE 125 // bytes
#define MAX_AIOT_R2D_PACKET_SIZE (MAX_AIOT_R2D_PAYLOAD_SIZE + 2) // SIP + CAS + PAYLOAD + POSTAMBLE
#include "precomputed_SIP.h"
#include "precomputed_CAP.h"
#include "precomputed_payload.h"
#include "precomputed_Postamble.h"
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,369 @@
/* Precomputed SIP SCs */
const c16_t SIP_SCs_ZC_1RBs[24] = {
{.r = 16384, .i = 9459},
{.r = 8923, .i = -7460},
{.r = 0, .i = 0},
{.r = 1999, .i = 7460},
{.r = 16384, .i = 9459},
{.r = 14920, .i = -10922},
{.r = 0, .i = 0},
{.r = 18382, .i = -1999},
{.r = 0, .i = -18918},
{.r = -7460, .i = 1999},
{.r = 0, .i = 0},
{.r = -3998, .i = 10922},
{.r = 8192, .i = 4730},
{.r = 8192, .i = 732},
{.r = 5461, .i = 0},
{.r = 4730, .i = 2731},
{.r = 8192, .i = 4730},
{.r = 12921, .i = 1999},
{.r = 13653, .i = -4730},
{.r = 8192, .i = -10191},
{.r = 0, .i = -9459},
{.r = -4730, .i = -2731},
{.r = -2731, .i = 4730},
{.r = 3462, .i = 7460},
};
const c16_t SIP_SCs_ZC_2RBs[48] = {
{.r = 15341, .i = 7178},
{.r = 4249, .i = -7765},
{.r = 0, .i = 0},
{.r = -2810, .i = 3083},
{.r = 8545, .i = 10832},
{.r = 10908, .i = -5368},
{.r = 0, .i = 0},
{.r = 7065, .i = 3384},
{.r = 10331, .i = -1086},
{.r = 5737, .i = -8680},
{.r = 0, .i = 0},
{.r = 11302, .i = -4552},
{.r = -2332, .i = -13598},
{.r = -6789, .i = -296},
{.r = 0, .i = 0},
{.r = -4818, .i = -1875},
{.r = -4225, .i = 9490},
{.r = 9224, .i = 4673},
{.r = 0, .i = 0},
{.r = 10717, .i = 6080},
{.r = 5108, .i = -12816},
{.r = -6945, .i = 1052},
{.r = 0, .i = 0},
{.r = -5072, .i = 10263},
{.r = 7670, .i = 3589},
{.r = 6007, .i = -1758},
{.r = 1132, .i = -1636},
{.r = 137, .i = 2947},
{.r = 4272, .i = 5416},
{.r = 8138, .i = 2770},
{.r = 7670, .i = -1126},
{.r = 5224, .i = -1840},
{.r = 5165, .i = -543},
{.r = 7208, .i = -1472},
{.r = 7180, .i = -5231},
{.r = 3375, .i = -7927},
{.r = -1166, .i = -6799},
{.r = -3247, .i = -3542},
{.r = -3391, .i = -872},
{.r = -3347, .i = 1472},
{.r = -2113, .i = 4745},
{.r = 2275, .i = 6949},
{.r = 7670, .i = 4336},
{.r = 8399, .i = -2318},
{.r = 2554, .i = -6408},
{.r = -3998, .i = -2947},
{.r = -3879, .i = 4529},
{.r = 2595, .i = 7668},
};
const c16_t SIP_SCs_ZC_4RBs[96] = {
{.r = 9575, .i = 5931},
{.r = 2960, .i = -4766},
{.r = 0, .i = 0},
{.r = -2561, .i = 3200},
{.r = 7452, .i = 7465},
{.r = 6423, .i = -4454},
{.r = 0, .i = 0},
{.r = 1953, .i = 2919},
{.r = 8320, .i = 3360},
{.r = 6101, .i = -6280},
{.r = 0, .i = 0},
{.r = 6849, .i = 326},
{.r = 6555, .i = -5315},
{.r = 198, .i = -7457},
{.r = 0, .i = 0},
{.r = 5432, .i = -6327},
{.r = -4865, .i = -8051},
{.r = -5014, .i = 400},
{.r = 0, .i = 0},
{.r = -4155, .i = -3569},
{.r = -6334, .i = 6399},
{.r = 4841, .i = 5098},
{.r = 0, .i = 0},
{.r = 2943, .i = 6110},
{.r = 8981, .i = -1025},
{.r = 1446, .i = -6307},
{.r = 0, .i = 0},
{.r = 2705, .i = -5983},
{.r = -8709, .i = -2286},
{.r = -206, .i = 6599},
{.r = 0, .i = 0},
{.r = 751, .i = 7113},
{.r = 9405, .i = -188},
{.r = 413, .i = -5792},
{.r = 0, .i = 0},
{.r = -1383, .i = -4547},
{.r = -6555, .i = 5315},
{.r = 6175, .i = 4795},
{.r = 0, .i = 0},
{.r = 7709, .i = 2396},
{.r = -1250, .i = -8886},
{.r = -3976, .i = 4808},
{.r = 0, .i = 0},
{.r = 473, .i = 9019},
{.r = 10191, .i = -2721},
{.r = -2975, .i = -3029},
{.r = 0, .i = 0},
{.r = -4333, .i = 5727},
{.r = 4787, .i = 2965},
{.r = 3863, .i = -903},
{.r = 381, .i = -557},
{.r = 319, .i = 2880},
{.r = 3726, .i = 3733},
{.r = 5438, .i = 984},
{.r = 3717, .i = -841},
{.r = 2436, .i = 483},
{.r = 4160, .i = 1680},
{.r = 6190, .i = -90},
{.r = 5508, .i = -2741},
{.r = 3588, .i = -3261},
{.r = 3277, .i = -2658},
{.r = 3827, .i = -3630},
{.r = 2527, .i = -5633},
{.r = -447, .i = -5880},
{.r = -2432, .i = -4025},
{.r = -2707, .i = -2307},
{.r = -3044, .i = -1424},
{.r = -3862, .i = 293},
{.r = -3167, .i = 3200},
{.r = -129, .i = 4970},
{.r = 3124, .i = 3993},
{.r = 4526, .i = 1583},
{.r = 4491, .i = -512},
{.r = 3876, .i = -2430},
{.r = 1929, .i = -4313},
{.r = -1639, .i = -4344},
{.r = -4354, .i = -1143},
{.r = -3403, .i = 3197},
{.r = 507, .i = 4975},
{.r = 3932, .i = 3181},
{.r = 4702, .i = -94},
{.r = 3102, .i = -2690},
{.r = 79, .i = -3504},
{.r = -2965, .i = -1582},
{.r = -3277, .i = 2658},
{.r = 690, .i = 5485},
{.r = 5434, .i = 3018},
{.r = 5053, .i = -2657},
{.r = -625, .i = -4443},
{.r = -4392, .i = 416},
{.r = -1090, .i = 5648},
{.r = 4746, .i = 4273},
{.r = 5096, .i = -1361},
{.r = 27, .i = -3002},
{.r = -2689, .i = 1379},
{.r = 697, .i = 5030},
};
const c16_t SIP_SCs_Ones_1RBs[24] = {
{.r = 32767, .i = 0},
{.r = 5461, .i = -20381},
{.r = 0, .i = 0},
{.r = 5461, .i = -5461},
{.r = 0, .i = 0},
{.r = 5461, .i = -1463},
{.r = 0, .i = 0},
{.r = 5461, .i = 1463},
{.r = 0, .i = 0},
{.r = 5461, .i = 5461},
{.r = 0, .i = 0},
{.r = 5461, .i = 20381},
{.r = 16384, .i = 0},
{.r = 12921, .i = -7460},
{.r = 5461, .i = -9459},
{.r = 0, .i = -5461},
{.r = 0, .i = 0},
{.r = 3462, .i = 1999},
{.r = 5461, .i = 0},
{.r = 3462, .i = -1999},
{.r = 0, .i = 0},
{.r = 0, .i = 5461},
{.r = 5461, .i = 9459},
{.r = 12921, .i = 7460},
};
const c16_t SIP_SCs_Ones_2RBs[48] = {
{.r = 32767, .i = 0},
{.r = 2731, .i = -20741},
{.r = 0, .i = 0},
{.r = 2731, .i = -6592},
{.r = 0, .i = 0},
{.r = 2731, .i = -3559},
{.r = 0, .i = 0},
{.r = 2731, .i = -2095},
{.r = 0, .i = 0},
{.r = 2731, .i = -1131},
{.r = 0, .i = 0},
{.r = 2731, .i = -359},
{.r = 0, .i = 0},
{.r = 2731, .i = 359},
{.r = 0, .i = 0},
{.r = 2731, .i = 1131},
{.r = 0, .i = 0},
{.r = 2731, .i = 2095},
{.r = 0, .i = 0},
{.r = 2731, .i = 3559},
{.r = 0, .i = 0},
{.r = 2731, .i = 6592},
{.r = 0, .i = 0},
{.r = 2731, .i = 20741},
{.r = 16384, .i = 0},
{.r = 11736, .i = -9005},
{.r = 2731, .i = -10191},
{.r = -1931, .i = -4661},
{.r = 0, .i = 0},
{.r = 3145, .i = -414},
{.r = 2731, .i = -2731},
{.r = 318, .i = -2413},
{.r = 0, .i = 0},
{.r = 1931, .i = 800},
{.r = 2731, .i = -732},
{.r = 1186, .i = -1545},
{.r = 0, .i = 0},
{.r = 1186, .i = 1545},
{.r = 2731, .i = 732},
{.r = 1931, .i = -800},
{.r = 0, .i = 0},
{.r = 318, .i = 2413},
{.r = 2731, .i = 2731},
{.r = 3145, .i = 414},
{.r = 0, .i = 0},
{.r = -1931, .i = 4661},
{.r = 2731, .i = 10191},
{.r = 11736, .i = 9005},
};
const c16_t SIP_SCs_Ones_4RBs[96] = {
{.r = 32767, .i = 0},
{.r = 1365, .i = -20830},
{.r = 0, .i = 0},
{.r = 1365, .i = -6864},
{.r = 0, .i = 0},
{.r = 1365, .i = -4022},
{.r = 0, .i = 0},
{.r = 1365, .i = -2769},
{.r = 0, .i = 0},
{.r = 1365, .i = -2043},
{.r = 0, .i = 0},
{.r = 1365, .i = -1557},
{.r = 0, .i = 0},
{.r = 1365, .i = -1197},
{.r = 0, .i = 0},
{.r = 1365, .i = -912},
{.r = 0, .i = 0},
{.r = 1365, .i = -673},
{.r = 0, .i = 0},
{.r = 1365, .i = -463},
{.r = 0, .i = 0},
{.r = 1365, .i = -272},
{.r = 0, .i = 0},
{.r = 1365, .i = -89},
{.r = 0, .i = 0},
{.r = 1365, .i = 89},
{.r = 0, .i = 0},
{.r = 1365, .i = 272},
{.r = 0, .i = 0},
{.r = 1365, .i = 463},
{.r = 0, .i = 0},
{.r = 1365, .i = 673},
{.r = 0, .i = 0},
{.r = 1365, .i = 912},
{.r = 0, .i = 0},
{.r = 1365, .i = 1197},
{.r = 0, .i = 0},
{.r = 1365, .i = 1557},
{.r = 0, .i = 0},
{.r = 1365, .i = 2043},
{.r = 0, .i = 0},
{.r = 1365, .i = 2769},
{.r = 0, .i = 0},
{.r = 1365, .i = 4022},
{.r = 0, .i = 0},
{.r = 1365, .i = 6864},
{.r = 0, .i = 0},
{.r = 1365, .i = 20830},
{.r = 16384, .i = 0},
{.r = 11098, .i = -9733},
{.r = 1365, .i = -10370},
{.r = -2749, .i = -4115},
{.r = 0, .i = 0},
{.r = 2694, .i = -1328},
{.r = 1365, .i = -3296},
{.r = -702, .i = -2067},
{.r = 0, .i = 0},
{.r = 1704, .i = -339},
{.r = 1365, .i = -1779},
{.r = -96, .i = -1461},
{.r = 0, .i = 0},
{.r = 1281, .i = 84},
{.r = 1365, .i = -1048},
{.r = 227, .i = -1139},
{.r = 0, .i = 0},
{.r = 1019, .i = 346},
{.r = 1365, .i = -566},
{.r = 451, .i = -914},
{.r = 0, .i = 0},
{.r = 818, .i = 547},
{.r = 1365, .i = -180},
{.r = 638, .i = -727},
{.r = 0, .i = 0},
{.r = 638, .i = 727},
{.r = 1365, .i = 180},
{.r = 818, .i = -547},
{.r = 0, .i = 0},
{.r = 451, .i = 914},
{.r = 1365, .i = 566},
{.r = 1019, .i = -346},
{.r = 0, .i = 0},
{.r = 227, .i = 1139},
{.r = 1365, .i = 1048},
{.r = 1281, .i = -84},
{.r = 0, .i = 0},
{.r = -96, .i = 1461},
{.r = 1365, .i = 1779},
{.r = 1704, .i = 339},
{.r = 0, .i = 0},
{.r = -702, .i = 2067},
{.r = 1365, .i = 3296},
{.r = 2694, .i = 1328},
{.r = 0, .i = 0},
{.r = -2749, .i = 4115},
{.r = 1365, .i = 10370},
{.r = 11098, .i = 9733},
};
const c16_t *SIP_SCs_select(int RBs, bool ZC_Ones) {
switch (RBs) {
case 1:
return ZC_Ones ? SIP_SCs_ZC_1RBs : SIP_SCs_Ones_1RBs;
case 2:
return ZC_Ones ? SIP_SCs_ZC_2RBs : SIP_SCs_Ones_2RBs;
case 4:
return ZC_Ones ? SIP_SCs_ZC_4RBs : SIP_SCs_Ones_4RBs;
default:
AssertFatal(1==0,"Unknown N_PRB");
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -173,8 +173,10 @@ void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *des
}
#endif
struct complexd cexp_doppler[length];
cd_t *cexp_doppler = NULL;
if (desc->max_Doppler != 0.0) {
cexp_doppler = malloc(length * sizeof(cd_t));
get_cexp_doppler(cexp_doppler, desc, length);
}
@@ -225,6 +227,100 @@ void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *des
} // ii
} // i
if (cexp_doppler != NULL) {
free(cexp_doppler);
}
}
void __attribute__ ((no_sanitize_address)) multipath_channel_MT(channel_desc_t *desc,
double *tx_sig_re[NB_ANTENNAS_TX],
double *tx_sig_im[NB_ANTENNAS_TX],
double *rx_sig_re[NB_ANTENNAS_RX],
double *rx_sig_im[NB_ANTENNAS_RX],
uint32_t length,
uint8_t keep_channel,
int log_channel,
gaussZiggurat_MT_t *gz)
{
double path_loss = pow(10,desc->path_loss_dB/20);
uint64_t dd = desc->channel_offset;
#ifdef DEBUG_CH
printf("[CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %lu, len %d \n",
keep_channel, path_loss, desc->path_loss_dB, desc->nb_rx, desc->nb_tx, dd, desc->channel_length);
#endif
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel_MT(desc,0, gz);
}
#ifdef DEBUG_CH
for (l = 0; l<(int)desc->channel_length; l++) {
printf("ch[%i] = (%f, %f)\n", l, desc->ch[0][l].r, desc->ch[0][l].i);
}
#endif
cd_t *cexp_doppler = NULL;
if (desc->max_Doppler != 0.0) {
cexp_doppler = malloc(length * sizeof(cd_t));
get_cexp_doppler(cexp_doppler, desc, length);
}
for (int i=0; i<((int)length-dd); i++) {
for (int ii=0; ii<desc->nb_rx; ii++) {
struct complexd rx_tmp={0};
for (int j=0; j<desc->nb_tx; j++) {
struct complexd *chan=desc->ch[ii+(j*desc->nb_rx)];
for (int l = 0; l<(int)desc->channel_length; l++) {
if ((i>=0) && (i-l)>=0) {
struct complexd tx;
tx.r = tx_sig_re[j][i-l];
tx.i = tx_sig_im[j][i-l];
rx_tmp.r += (tx.r * chan[l].r) - (tx.i * chan[l].i);
rx_tmp.i += (tx.i * chan[l].r) + (tx.r * chan[l].i);
}
#if 0
if (i==0 && log_channel == 1) {
printf("channel[%d][%d][%d] = %f dB \t(%e, %e)\n",
ii, j, l, 10 * log10(pow(chan[l].r, 2.0) + pow(chan[l].i, 2.0)), chan[l].r, chan[l].i);
}
#endif
} //l
} // j
#if 0
if (desc->max_Doppler != 0.0)
rx_tmp = cdMul(rx_tmp, cexp_doppler[i]);
#endif
#ifdef DOPPLER_DEBUG
printf("[k %2i] cexp_doppler = (%7.4f, %7.4f), abs(cexp_doppler) = %.4f\n",
i,
cexp_doppler[i].r,
cexp_doppler[i].i,
sqrt(cexp_doppler[i].r * cexp_doppler[i].r + cexp_doppler[i].i * cexp_doppler[i].i));
#endif
rx_sig_re[ii][i+dd] = rx_tmp.r*path_loss;
rx_sig_im[ii][i+dd] = rx_tmp.i*path_loss;
#ifdef DEBUG_CH
if ((i%32)==0) {
printf("rx aa %d: %f, %f => %e, %e\n",
ii, rx_tmp.r, rx_tmp.i, rx_sig_re[ii][i-dd], rx_sig_im[ii][i-dd]);
}
#endif
//rx_sig_re[ii][i] = sqrt(.5)*(tx_sig_re[0][i] + tx_sig_re[1][i]);
//rx_sig_im[ii][i] = sqrt(.5)*(tx_sig_im[0][i] + tx_sig_im[1][i]);
} // ii
} // i
if (cexp_doppler != NULL) {
free(cexp_doppler);
}
}
#endif

View File

@@ -61,3 +61,38 @@ void add_noise(c16_t **rxdata,
}
}
}
// Helper to clip double to int16 range
static int16_t saturate_c16(double in) {
if (in > 32767.0) return 32767;
if (in < -32768.0) return -32768;
return (int16_t)in;
}
void add_noise_MT(c16_t **rxdata,
const double **r_re,
const double **r_im,
const double sigma,
const int length,
const int slot_offset,
const double ts,
const int delay,
const uint16_t pdu_bit_map,
const uint16_t ptrs_bit_map,
const uint8_t nb_antennas_rx,
gaussZiggurat_MT_t *gz)
{
double A = sqrt(sigma / 2);
for (int i = 0; i < length; i++) {
for (int ap = 0; ap < nb_antennas_rx; ap++) {
c16_t *rxd = &rxdata[ap][slot_offset + i + delay];
rxd->r = saturate_c16(r_re[ap][i] + A * gaussZiggurat_MT(0.0, 1.0, gz)); // convert to fixed point
rxd->i = saturate_c16(r_im[ap][i] + A * gaussZiggurat_MT(0.0, 1.0, gz));
/* Add phase noise if enabled */
if (pdu_bit_map & ptrs_bit_map) {
phase_noise(ts, &rxdata[ap][slot_offset + i + delay].r, &rxdata[ap][slot_offset + i + delay].i);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -205,6 +205,88 @@ double __attribute__ ((no_sanitize("address", "undefined"))) gaussZiggurat(doubl
return hz != INT32_MIN && abs(hz) < kn[iz] ? hz * wn[iz] : nfix();
}
// **********************************************
// Modified gaussZiggurat to allow multithreading
// **********************************************
#define SHR3_MT (gz->jz = gz->jsr, gz->jsr ^= (gz->jsr << 13), gz->jsr ^= (gz->jsr >> 17), gz->jsr ^= (gz->jsr << 5), gz->jz + gz->jsr)
#define UNI_MT (0.5 + (signed)SHR3_MT * 0.2328306e-9)
double nfix_MT(gaussZiggurat_MT_t *gz)
{
const double r = 3.442620;
for (;;) {
/* use per-instance x,y stored in gz */
gz->x = gz->hz * gz->wn[gz->iz];
if (gz->iz == 0) {
do {
gz->x = -0.2904764 * log(UNI_MT);
gz->y = -log(UNI_MT);
} while (gz->y + gz->y < gz->x * gz->x);
return (gz->hz > 0) ? r + gz->x : -r - gz->x;
}
if (gz->fn[gz->iz] + UNI_MT * (gz->fn[gz->iz - 1] - gz->fn[gz->iz]) < exp(-0.5 * gz->x * gz->x)) {
return gz->x;
}
gz->hz = SHR3_MT;
gz->iz = gz->hz & 127;
if (abs(gz->hz) < gz->kn[gz->iz]) {
return ((gz->hz) * gz->wn[gz->iz]);
}
}
}
/*!Procedure to create tables for normal distribution kn,wn and fn. */
void tableNor_MT(unsigned long seed, gaussZiggurat_MT_t *gz)
{
gz->jsr = seed;
double dn = 3.442619855899;
const double m1 = 2147483648.0;
double q;
double tn = 3.442619855899;
const double vn = 9.91256303526217E-03;
q = vn / exp(-0.5 * dn * dn);
gz->kn[0] = ((dn / q) * m1);
gz->kn[1] = 0;
gz->wn[0] = (q / m1);
gz->wn[127] = (dn / m1);
gz->fn[0] = 1.0;
gz->fn[127] = (exp(-0.5 * dn * dn));
for (int i = 126; 1 <= i; i--) {
dn = sqrt(-2.0 * log(vn / dn + exp(-0.5 * dn * dn)));
gz->kn[i + 1] = ((dn / tn) * m1);
tn = dn;
gz->fn[i] = (exp(-0.5 * dn * dn));
gz->wn[i] = (dn / m1);
}
gz->tableNordDone=true;
return;
}
double __attribute__ ((no_sanitize("address", "undefined"))) gaussZiggurat_MT(double mean, double variance, gaussZiggurat_MT_t *gz)
{
if (!gz->tableNordDone) {
gz->jsr = 123456789;
gz->iset = 0; /* initialize BoxMuller state */
/* let's make reasonable constant tables */
unsigned long seed;
fill_random(&seed, sizeof(seed));
tableNor_MT(seed, gz);
}
gz->hz = SHR3_MT;
gz->iz = gz->hz & 127;
return gz->hz != INT32_MIN && abs(gz->hz) < gz->kn[gz->iz] ? gz->hz * gz->wn[gz->iz] : nfix_MT(gz);
}
#ifdef MAIN
main(int argc,char **argv)
{

View File

@@ -50,6 +50,7 @@ typedef enum {
#define CHANMODEL_FREE_RSQRT_6 1<<1
#define CHANMODEL_FREE_RSQRT_NTAPS 1<<2
#define CHANMODEL_FREE_AMPS 1<<3
#define CHANMODEL_FREE_RSQRT_CHAN 1<<4
#define SHR3 (jz = jsr, jsr ^= (jsr << 13), jsr ^= (jsr >> 17), jsr ^= (jsr << 5), jz + jsr)
typedef enum {
@@ -333,6 +334,23 @@ typedef struct {
double ru_amp[NUMBER_OF_RU_MAX];
} sim_t;
// Ambient IoT addition (multithreaded simulation)
typedef struct {
double wn[128], fn[128];
uint32_t iz, jz, jsr, kn[128];
int32_t hz;
/* BoxMuller state moved from static locals in nfix_MT */
int iset; /* 0/1 toggles availability of gset */
double gset; /* second normal variate from BoxMuller */
double x; /* temporary used in nfix_MT */
double y;
bool tableNordDone;
} gaussZiggurat_MT_t;
double gaussZiggurat_MT(double mean, double variance, gaussZiggurat_MT_t *gz);
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
@@ -347,6 +365,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double path_loss_dB,
float noise_power_dB);
channel_desc_t *new_channel_desc_scm_MT(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
double sampling_rate,
uint64_t center_freq,
double channel_bandwidth,
double DS_TDL,
double maxDoppler,
const corr_level_t corr_level,
double forgetting_factor,
uint64_t channel_offset,
double path_loss_dB,
float noise_power_dB,
gaussZiggurat_MT_t *gz);
channel_desc_t *find_channel_desc_fromname( char *modelname );
@@ -390,6 +423,7 @@ void get_cexp_doppler(struct complexd *cexp_doppler, channel_desc_t *chan_desc,
\param desc Pointer to the channel descriptor
*/
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
int random_channel_MT(channel_desc_t *desc, uint8_t abstraction_flag, gaussZiggurat_MT_t *gz);
/**\fn void multipath_channel(channel_desc_t *desc,
double tx_sig_re[NB_ANTENNAS_TX],
@@ -419,6 +453,16 @@ void multipath_channel(channel_desc_t *desc,
uint32_t length,
uint8_t keep_channel,
int log_channel);
void multipath_channel_MT(channel_desc_t *desc,
double *tx_sig_re[NB_ANTENNAS_TX],
double *tx_sig_im[NB_ANTENNAS_TX],
double *rx_sig_re[NB_ANTENNAS_RX],
double *rx_sig_im[NB_ANTENNAS_RX],
uint32_t length,
uint8_t keep_channel,
int log_channel,
gaussZiggurat_MT_t *gz);
/*
\fn double compute_pbch_sinr(channel_desc_t *desc,
channel_desc_t *desc_i1,
@@ -589,6 +633,19 @@ void add_noise(c16_t **rxdata,
const uint16_t ptrs_bit_map,
const uint8_t nb_antennas_rx);
void add_noise_MT(c16_t **rxdata,
const double **r_re,
const double **r_im,
const double sigma,
const int length,
const int slot_offset,
const double ts,
const int delay,
const uint16_t pdu_bit_map,
const uint16_t ptrs_bit_map,
const uint8_t nb_antennas_rx,
gaussZiggurat_MT_t *gz);
void do_DL_sig(sim_t *sim,
uint16_t subframe,
uint32_t offset,

View File

@@ -0,0 +1,35 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.associations": {
"chrono": "c",
"algorithm": "c",
"format": "c",
"precomputed_sip.h": "c",
"precomputed_cas.h": "c",
"precomputed_payload.h": "c",
"precomputed_postamble.h": "c",
"vector": "c",
"load_module_shlib.h": "c",
"signal.h": "c",
"tools_defs.h": "c",
"defs_aiot_ue.h": "c",
"nr_unitary_defs.h": "c",
"defs_aiot_gnb.h": "c",
"random": "c",
"cmath": "c",
"complex": "c",
"compare": "c",
"cstdint": "c",
"precomputed_cap.h": "c",
"valarray": "c",
"defs_aiot_r2d.h": "c",
"time.h": "c",
"rf.h": "c"
}
}
}