Compare commits

...

632 Commits

Author SHA1 Message Date
chenhsunyang0922
5dbf147a6d modify configuration file 2019-11-12 04:12:07 -08:00
chenhsunyang0922
db8882c5d3 Add the configuration file 2019-11-06 05:57:31 -08:00
chenhsunyang0922
17592c5b51 add function read_config_and_init_NB_IoT( ) and fix some warning 2019-10-28 05:34:20 -07:00
chenhsunyang0922
f6f7994cb3 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-10-23 05:12:46 -07:00
chenhsunyang0922
22c7e340a1 fix phy_simulators error 2019-10-23 05:11:03 -07:00
lipingyu
849c9dbaa0 old version configuration file fix 2019-10-23 18:00:29 +08:00
chenhsunyang0922
186b1a4b35 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-10-21 07:07:16 -07:00
chenhsunyang0922
ea3ad6177f fix compile error and warning 2019-10-21 07:06:28 -07:00
Daniel0326
fc6fd9eb9c Add enb.band28.tm1.50PRB.usrpb210.conf 2019-10-21 12:54:02 +01:00
chenhsunyang0922
1aa6306c55 fix compile error in lte-eNB.c 2019-10-21 02:25:53 -07:00
chenhsunyang0922
ec10bea0bc fix compile error 2019-10-21 01:38:01 -07:00
chenhsunyang0922
cca638e2d1 fix error in MAC layer 2019-10-15 07:12:46 -07:00
chenhsunyang0922
e753e7736c fix error in phy_procedures_lte_common_NB_IoT.c and MAC LAYER 2019-10-14 03:05:11 -07:00
chenhsunyang0922
befd0112c4 fix error in phy_procedures_lte_eNB_NB_IoT.c 2019-10-09 05:56:50 -07:00
chenhsunyang0922
fe75a54404 fix error in phy_procedures_lte_eNB_NB_IoT.c (ongoing) 2019-10-09 01:35:52 -07:00
Daniel0326
9d7568fccb fix phy_procedure_lte_eNb_NB_IoT.c error 2019-10-08 15:32:01 +01:00
lipingyu
36ae34577d remove phy_procedures_lte_eNb_nbiot.c and modify phy_procedures_lte_eNb_NB_IoT.c 2019-10-07 23:53:19 +08:00
lipingyu
819ea956c0 lte-enb-nbiot.c debug 2019-10-07 20:33:13 +08:00
Clare Yu
dccb3b51c5 Update lte-enb-nbiot.c 2019-10-07 11:11:01 +02:00
Clare Yu
941c14b376 Update defs_eNB.h 2019-10-07 11:09:38 +02:00
lipingyu
732c92f100 add enb_nb_iot_top in lte-enb-nbiot.c 2019-10-02 20:47:55 +08:00
Raymond Knopp
2f4e52e441 got rid of old RU code in lte-enb-nbiot.c
added some hooks for nbiot in lte-ru.c. Still need to adapt RU_t and PHY_VARS_eNB_NB_IoT structures
2019-10-02 12:08:20 +02:00
chenhsunyang0922
44873997ae fix include file error in phy_procedures_lte_eNb_NB_IoT.c 2019-10-01 05:02:50 -07:00
Nick Ho
acefe86062 add library include NB-IoT 2019-10-01 15:29:01 +08:00
Nick Ho
12c6a74073 Adjust framework of lte-enb-nbiot.c 2019-10-01 14:27:55 +08:00
Daniel0326
382073901a fix lte-enb-nbiot.c error 2019-09-30 17:33:57 +01:00
Daniel0326
9e5d79a371 Add structure and fix error in lte-enb-nbiot.c 2019-09-30 16:42:35 +01:00
Nick Ho
7274200533 Change global to NB-IoT PHY Global 2019-09-30 12:52:11 +08:00
Daniel0326
cc7e4b219e Keep init_eNB_NB_IoT&init_eNB_proc_NB_IoT in lte-enb-nbiot.c 2019-09-27 15:25:58 +01:00
Daniel0326
4f03291010 add lte-enb-nbiot.c 2019-09-26 17:45:14 +01:00
Daniel0326
6bd242cc13 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-09-26 17:00:29 +01:00
Daniel0326
fa2f2f4eab Need to fix lte-enb.c 2019-09-26 16:59:54 +01:00
Clare Yu
f7e646d311 delete lte-enb-nbiot.c in CMakelist.txt 2019-09-26 16:18:42 +02:00
lipingyu
c9bc6da047 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-09-26 21:22:26 +08:00
lipingyu
15d4735ac6 add NB-IoT L1 config in lte-softmodem.c 2019-09-26 21:20:28 +08:00
chenhsunyang0922
ce1ea55571 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-09-26 05:23:21 -07:00
chenhsunyang0922
ef6067460c fix lte-enb.c & delete lte-enb-nb-iot.c 2019-09-26 05:22:26 -07:00
Clare Yu
9989f9ea4e Update lte-softmodem.c 2019-09-26 12:24:42 +02:00
chenhsunyang0922
89264079e3 fix lte-enb-nbiot.c 2019-09-26 02:48:41 -07:00
Nick Ho
00b6fe819b fix path error at USER 2019-09-26 10:40:52 +08:00
changshengliu
0ca18021d6 add the definition of NBIOT_RRCPARAMS_CHECK_DESC_15_end & NBIOT_RRCPARAMS_CHECK_DESC_0_14 2019-09-26 05:34:57 +08:00
Daniel0326
4586f077b6 fix lte-enb.c error (ongoing) 2019-09-25 16:25:20 +01:00
chenhsunyang0922
c8d3f330b3 fix enb_paramdef_NB_IoT.h & the type of NB_UE_INST in MAC/extern_NB_IoT.h 2019-09-25 05:42:29 -07:00
Daniel0326
2ebabccbbd fix asn1_msg_NB_IoT error (replace RrcConfigurationReq structure with NbIoTRrcConfigurationReq ) 2019-09-25 10:09:28 +01:00
Nick Ho
07b133cd77 Still working on ASN.1 2019-09-25 11:41:46 +08:00
chenhsunyang0922
56b8b3ce0a fix asn1_TYPE_descriptor & include file error 2019-09-24 08:21:41 -07:00
chenhsunyang0922
e21a3989bd create new header file sched_extern_NB_IoT.h 2019-09-24 07:20:39 -07:00
Daniel0326
3363003f4a fix dereferencing problem of structure eNB_MAC_INST_NB_IoT_s 2019-09-24 15:25:48 +01:00
chenhsunyang0922
f49d9651d7 add LTE prefix in rrc_eNB_NB_IoT.c 2019-09-24 05:42:21 -07:00
Nick Ho
813b7bc54e conclude the conflict 2019-09-24 17:32:03 +08:00
Nick Ho
e6c9d9c6b4 Fix error occurs at PHY and MAC (done), RRC & ASN.1 still ongoing 2019-09-24 17:30:06 +08:00
chenhsunyang0922
b7caab053c fix error in MAC/defs_NB_IoT.h 2019-09-24 01:38:05 -07:00
Nick Ho
eca9fdc5b0 fix interleaver missing 2019-09-24 15:22:33 +08:00
Nick Ho
f86cb8e1f2 Fix error on openair1 and RRC 2019-09-24 15:07:26 +08:00
changshengliu
ab857a5585 fix openair1 bug 2019-09-23 23:24:41 +08:00
chenhsunyang0922
e8f43ba526 fix openair2 error 2019-09-23 06:37:57 -07:00
Daniel0326
02c7134aea fix asn1 LTE_ error 2019-09-23 10:35:35 +01:00
Nick Ho
21aa0aaa8d remove the old nfape interface 2019-09-23 14:41:24 +08:00
Test User
8e932050d0 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-09-23 14:35:38 +08:00
Test User
2e9d6599dc Fix L1 bugs 2019-09-23 14:35:06 +08:00
Daniel0326
a43187e5bb modify include file PHY/defs_NB_IoT.h to PHY/defs_L1_NB_IoT.h 2019-09-20 15:21:43 +01:00
chenhsunyang0922
97fb73e62e fix error 2019-09-20 06:26:16 -07:00
chenhsunyang0922
8658f5d2e4 Merge branch 'develop-nb-iot-merge' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-merge 2019-09-20 06:21:57 -07:00
chenhsunyang0922
806234e8fe delete PHY/defs_NB_IoT.h and modify defs_L1_NB_IoT.h 2019-09-20 06:19:36 -07:00
Clare Yu
9b3ae7e6e8 Update dlsch_scrambling.c 2019-09-17 15:17:04 +02:00
chenhsunyang0922
7d88acc837 fix L1 problems 2019-09-16 06:29:54 -07:00
oai
7294dbce0e debug openair1 error 2019-09-16 14:19:03 -07:00
chenhsunyang0922
7ceebea9bf move NBIoT files to NBIoT_TRANSPORT from LTE_TRANSPORT 2019-09-16 06:05:05 -07:00
chenhsunyang0922
8994e7ffcc fix eNB_rxtx_proc_NB_IoT 2019-09-16 01:31:33 -07:00
Daniel
3310f4f87d debug openair1/openair2 error 2019-09-13 03:19:20 -07:00
Daniel
e4b6e855df debug openair1 error (delete PHY/defs.h modify openair2/ENB_APP/enb_config.h) 2019-09-11 08:01:31 -07:00
Daniel
72542401a3 debug CMakeLists 2019-09-10 07:08:37 -07:00
Raphael Defosseux
0a40c14a2c CI: add the ccpcheck stage
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2019-09-04 10:44:06 +02:00
Eric
e557493d52 Modify CMakelist 2019-09-03 16:18:04 +02:00
Eric
026d20c2d7 Finish separating NB-IoT from LTE 2019-09-02 15:44:24 +02:00
Eric
18695eb2f8 fix enb_config.c enb_config_NB_IoT.c 2019-07-30 09:55:58 +02:00
Eric
4be075b17e fix conflicts on openair2/ENB_APP/enb_config.c 2019-07-25 17:00:00 +02:00
Eric
2c972bed68 Merge remote-tracking branch 'origin/develop' into develop-nb-iot-merge
-- cmake_targets/CMakeLists.txt and openair2/ENB_APP/enb_config.c are
stil in conflicts
2019-07-25 16:40:13 +02:00
Daniel0326
143e765cd8 msg5 decoding in RRC 2019-06-12 20:12:43 +08:00
Nick Ho
9c7a5b2212 Optimize nprach searching time 2019-04-16 11:34:09 +08:00
Nick Ho
6c3be68dae fixed searching ue-spec problem at ue-info 2019-04-15 17:28:47 +08:00
Matthieu Kanj
99e02e93d7 msg5 decoding 2019-04-11 17:22:37 +02:00
Matthieu Kanj
89007e0f6e setting NPRACH params in PHY 2019-04-09 10:44:54 +02:00
Matthieu Kanj
e2336b030a bug fix 2019-04-05 18:30:44 +02:00
Nick Ho
a6cc4b3937 msg3 flag implemented 2019-04-05 16:57:08 +08:00
Matthieu Kanj
f57e5b4e91 other npush format 2019-04-04 08:16:25 +02:00
Nick Ho
13fe8079c9 fixed problem on Dedicate configuration 2019-03-29 15:52:46 +08:00
Nick Ho
5f383a990a Update Rmax according to dedicate configuration 2019-03-29 15:41:59 +08:00
Nick Ho
7110bb74fe Integrate USS MAC scheduler into OAI 2019-03-29 14:43:59 +08:00
Nick Ho
2d2c80dbab Revise UL_indication to handle the Ack information 2019-03-28 14:44:18 +08:00
Matthieu Kanj
f9f541cda2 UL_indication for ACK 2019-03-27 17:36:02 +01:00
Matthieu Kanj
84b310c27b ack params 2019-03-26 17:17:14 +01:00
Matthieu Kanj
749ffebde9 ACK params 2019-03-25 10:29:31 +01:00
Nick Ho
aaf5aa3ff7 clean code at MAC and RRC layer 2019-03-20 18:11:50 +08:00
Nick Ho
22ddb6be4e debug on MSG4 construction 2019-03-14 16:05:29 +08:00
Nick Ho
824c95a766 Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2019-03-14 14:52:29 +08:00
Nick Ho
5cb066577d DCI packed function revised! 2019-03-14 14:45:12 +08:00
Nick Ho
4760fa5a18 msg4 works, dci packing function need to revise 2019-03-14 14:05:17 +08:00
Matthieu Kanj
ed6ea82a1e bug fix 2019-03-13 10:38:48 +01:00
Nick Ho
e0b6089789 correct contention resolution id 2019-03-06 17:25:03 +08:00
Nick Ho
fdbec2a5ef remove fixed dci 2019-03-05 15:21:26 +08:00
Nick Ho
9fcf57b954 revise msg4 pdu 2019-03-05 14:57:33 +08:00
Nick Ho
143aaaa136 7 byte msg4 can be recieved by UE now 2019-03-05 14:43:24 +08:00
Nick Ho
2a9f54a5cb fixed msg4 pdu 2019-02-28 17:45:57 +08:00
Matthieu Kanj
332c42afe4 update NPBCH 2019-02-26 13:01:11 +01:00
Matthieu Kanj
ff4350af63 bug fix 2019-02-26 11:51:47 +01:00
Matthieu Kanj
e7f6906bb9 scrambling update for release 13.5.0 2019-02-26 09:28:30 +01:00
Matthieu Kanj
efa4401e5e msg4 generation 2019-02-22 15:15:34 +01:00
Nick Ho
f31174ee0b Fill Msg4 DCI and Data information in order to transmit at PHY 2019-02-21 15:50:46 +08:00
Nick Ho
d9d733061c MSG4 PDU packed at MAC level done! 2019-02-19 17:34:05 +08:00
Nick Ho
aaaa5a9743 fixed bug 2019-02-18 12:41:02 +08:00
Nick Ho
7e6ffd494b Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2019-02-18 10:06:47 +08:00
Nick Ho
cac8ad2058 Procedure after recieving MSG3 2019-02-18 10:06:42 +08:00
Matthieu Kanj
b2d05eaf37 bug fix 2019-02-14 09:57:24 +01:00
Matthieu Kanj
ee0dd14dc7 sub-carrier spacing 2019-02-13 22:49:18 +01:00
Matthieu Kanj
51c6675083 bug fix 2019-02-12 10:06:52 +01:00
Matthieu Kanj
42a69ca456 bug fix 2019-02-12 09:56:48 +01:00
Matthieu Kanj
318a8fea37 RX UL indication 2019-02-11 15:20:15 +01:00
Matthieu Kanj
10dd3e8d84 fix UL_indication 2019-02-11 14:49:32 +01:00
Matthieu Kanj
628393ffd8 NPUSCH update 2019-02-08 17:56:56 +01:00
Matthieu Kanj
671309ef44 improve structure of NPUSCH 2019-02-08 11:30:51 +01:00
Matthieu Kanj
c18281faa5 rvidx for repetitions 2019-02-08 10:50:47 +01:00
Matthieu Kanj
68925645d1 RX and CRC indication 2019-02-08 10:27:01 +01:00
Matthieu Kanj
44037b0ca3 improving NPUSCH structure 2019-02-08 07:02:39 +01:00
Matthieu Kanj
6f2b2eeb49 optimization of NPUSCH 2019-02-07 16:02:51 +01:00
Matthieu Kanj
ee93a7bacd bug fix 2019-02-07 09:44:38 +01:00
Matthieu Kanj
ba015c2f13 bug fix 2019-02-06 16:17:12 +01:00
Matthieu Kanj
060cdd70a7 removing some warnings + NPUSCH update 2019-02-06 14:16:28 +01:00
Matthieu Kanj
03769bdbda compilation error fix 2019-02-06 11:27:58 +01:00
Matthieu Kanj
9686d42fa6 function update 2019-02-06 10:50:02 +01:00
Nick Ho
5ffb23865d Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2019-02-06 17:09:54 +08:00
Nick Ho
606403cf9b adjust trigger timing and RU allocation problem fixed 2019-02-06 13:28:59 +08:00
Matthieu Kanj
10e7d9f2e1 bug fix 2019-02-05 17:54:52 +01:00
Matthieu Kanj
f2c778fcf3 bug fix in values 2019-02-05 17:26:19 +01:00
Matthieu Kanj
4a22bddc69 bug fix 2019-02-05 14:48:59 +01:00
Matthieu Kanj
67f22edf3b Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2019-02-05 10:10:55 +01:00
Matthieu Kanj
2271436662 nprach detection update 2019-02-05 10:10:47 +01:00
Nick Ho
b969ef8f95 scheduler schedule single tonle resource for MSG3 defautly 2019-02-05 17:06:07 +08:00
Matthieu Kanj
994956c97b bug fix 2019-02-04 11:37:50 +01:00
Matthieu Kanj
010b4fa755 MSG3 ACK NACK 2019-02-04 09:27:20 +01:00
Nick Ho
e625d73bc1 add the primitives between MAC and RRC, and decode the MSG3 PDU at RRC successfully 2019-02-02 22:25:34 +08:00
Matthieu Kanj
d2261be4c5 bug fix 2019-02-01 11:14:26 +01:00
Matthieu Kanj
a9373da0fb missing allocation for UL indication 2019-02-01 10:00:18 +01:00
Matthieu Kanj
965fe1f750 UL_indication bug fix 2019-01-31 14:14:08 +01:00
Matthieu Kanj
7d36175893 handling NPUSCH repetitions + NPUSCH optimization 2019-01-30 19:36:51 +01:00
Matthieu Kanj
8814974eea replacing params in NPUSCH 2019-01-29 16:47:31 +01:00
Matthieu Kanj
6d554b2499 sucarrier spacing issue 2019-01-29 10:04:13 +01:00
Matthieu Kanj
d82ea72105 NPUSCH 2019-01-29 01:04:05 +01:00
Matthieu Kanj
798c839b60 NPUSCH update 2019-01-26 18:33:59 +01:00
Matthieu Kanj
debb2cca78 Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2019-01-25 14:25:28 +01:00
Matthieu Kanj
6b77528d7e NPUSCH functions 2019-01-25 14:17:50 +01:00
Nick Ho
e8ca203b7d fixed some UL grant params 2019-01-22 14:47:15 +08:00
Matthieu Kanj
58c39dcc89 subcarrier spacing 2019-01-21 09:55:38 +01:00
Matthieu Kanj
05306c4d4a adding nfapi params for NPUSCH 2019-01-18 18:08:01 +01:00
Nick Ho
879e2af3a4 clean useless log 2019-01-15 16:28:22 +08:00
Nick Ho
fb83f468bb remove extra useless code in MAC 2019-01-15 16:05:08 +08:00
Nick Ho
8e91fab0cb fix RAR issue, RAR can be recieved by UE now 2019-01-15 13:29:24 +08:00
Nick Ho
3e641f4f04 timing issue for SIBs occupy by DCI 2019-01-14 17:38:25 +08:00
Nick Ho
c04e0bdd5c timing correction 2019-01-14 17:10:38 +08:00
Nick Ho
4681ca538f fix RAR PDU value and Timing issue in MAC 2019-01-12 17:53:17 +08:00
Nick Ho
d561abffc8 dci pdu value fixed 2019-01-10 11:31:10 +08:00
Nick Ho
17cc03b872 disable fix scheduler 2019-01-09 16:56:38 +08:00
Nick Ho
cf85aebdb0 dci length fixed 2019-01-09 11:11:18 +08:00
Nick Ho
cf7079a6e7 fixed timing issue at fixed part 2019-01-07 15:33:33 +08:00
Nick Ho
6040f662b9 fixed scheduling optimized 2019-01-04 17:16:51 +08:00
Nick Ho
5111eafd7c confirm RAR PDU content 2018-12-29 21:02:28 +08:00
Nick Ho
75f0c3a817 fixed scheduling timing offered by scheduler 2018-12-28 18:40:55 +08:00
Nick Ho
cc243196bd Fix DCI PDU value bug 2018-12-25 22:16:50 +08:00
Nick Ho
8ee092a522 disable preamble simulation at default 2018-12-18 15:50:00 +08:00
Nick Ho
31127b37a3 Fix mapping parameters && preamble simulator 2018-12-10 17:37:22 +08:00
Nick Ho
b08cf2eeab fix problem at PHY DCI procedure (haven't test with UE yet) 2018-12-07 16:34:32 +08:00
Nick Ho
9d1737f2b6 fix the RAR PDU problem 2018-12-04 13:50:49 +08:00
Matthieu Kanj
6ba02668f5 function calls for NPDCCH and NPDSCH 2018-11-16 18:02:17 +01:00
Nick Ho
5506e79fa1 Sync the PHY structure that IF-Modules intends to write, also the filter of LTE preamble tested 2018-11-12 13:55:53 +08:00
Nick Ho
410da556d4 Fix resource allocation issue at MAC 2018-11-08 20:47:40 +08:00
Nick Ho
17fa23d548 fixed typo in IF_Module for compilation failed 2018-11-06 17:50:10 +08:00
Nick Ho
ae73a19fe8 RAR debug ongoing 2018-11-06 12:16:42 +08:00
Matthieu Kanj
be6e0e03f0 segmentation fault fix for UL indication 2018-10-28 08:59:50 +01:00
Matthieu Kanj
ddbcbac970 removing logs 2018-10-25 11:19:20 +02:00
Matthieu Kanj
fa26d90ca0 bug fix for SIB23 2018-10-25 10:51:49 +02:00
Matthieu Kanj
8287818d93 bug fix 2018-10-25 10:33:39 +02:00
Nick Ho
3866ad4125 Optimize function for SIB size indication from RRC to MAC 2018-10-25 10:41:46 +08:00
Nick Ho
9e84ca4c46 Revise function for determine SIBs TBS 2018-10-25 09:50:02 +08:00
Nick Ho
183644ca16 Correct SIB23 TBS at MAC Layer 2018-10-25 09:23:19 +08:00
Nick Ho
cdb7b298ba Add table for flexible scheduling for sib1 2018-10-19 16:00:16 +08:00
Nick Ho
d580bcea1a Finish timing issue for sib23 2018-10-16 20:49:29 +08:00
Nick Ho
8d862a564b Correct SIBs timing 2018-10-16 14:11:18 +08:00
Nick Ho
fafccfe4da Adjust Sib timing 2018-10-15 11:53:33 +08:00
Nick Ho
dd78171414 Sync SI config 2018-10-11 01:44:04 +08:00
Nick Ho
550dbe624d fix ResAssign in bch scheduler 2018-10-11 01:18:41 +08:00
Matthieu Kanj
728b381e68 bug & warning fix 2018-10-10 18:32:26 +02:00
Nick Ho
da77ebb83b Fix Hypersfn issue when inputing the scheduler 2018-10-10 17:17:59 +08:00
Nick Ho
c3d2aa1b0e Fix sib23 PDU problem 2018-10-10 16:17:51 +08:00
AlanLi
c10d87ddcc fix sib23 transmission in MAC layer, need to check with PHY's timing 2018-10-09 18:24:53 +08:00
Matthieu Kanj
27d7bdf463 bug fix 2018-10-08 16:59:46 +02:00
Matthieu Kanj
29f6db9703 NPDCCH generation 2018-10-04 12:06:33 +02:00
Matthieu Kanj
901d02ef8d bug fix 2018-09-26 15:02:30 +02:00
Matthieu Kanj
7a2f874990 transmission conflict fix 2018-09-26 10:19:17 +02:00
Matthieu Kanj
125878cf0d SIB23 + NPDSCH repetitions 2018-09-26 09:15:55 +02:00
Matthieu Kanj
1d1172aec6 SIB1 done 2018-09-20 10:08:50 +02:00
Matthieu Kanj
98550ce677 SIB1 scheduling + bug fix 2018-09-19 19:31:13 +02:00
Matthieu Kanj
4ae67730ac mapping PHY and MAC parameters 2018-09-18 11:39:54 +02:00
Matthieu Kanj
6988893a7d optimizing parameters 2018-09-12 11:52:04 +02:00
Matthieu Kanj
0dbd5a614f NPDCCH bug fix 2018-09-10 16:23:47 +02:00
Matthieu Kanj
58b9481cb8 NPDCCH functions 2018-09-07 17:41:05 +02:00
Matthieu Kanj
e901ecdf46 fix DCI functions 2018-09-07 16:28:34 +02:00
Matthieu Kanj
8617782a4f bug fixe 2018-09-07 10:05:22 +02:00
Matthieu Kanj
6454c61f9d PHY TX Gen 2018-09-04 10:00:17 +02:00
Matthieu Kanj
c7d050c1ce generalization of PHY TX 2018-09-03 19:04:27 +02:00
Matthieu Kanj
5d09a92d03 improving structure 2018-08-22 11:45:44 +02:00
AlanLi
164ff7f998 Do MIB/SIB1 2018-08-16 16:07:58 +08:00
AlanLi
83ba28ead6 Change to Init RA NB 2018-08-13 15:29:30 +08:00
AlanLi
2570ce3d7f Testing for MIB/SIBs 2018-08-11 13:00:28 +08:00
AlanLi
7a1d8e30ec Fixed bugs for SIB23 2018-08-11 12:50:02 +08:00
AlanLi
0daeb68ddf Fixed bugs for MIB/SIBs 2018-08-10 12:05:14 +08:00
AlanLi
cc698b523b MIB/SIBs 2018-08-10 00:02:20 +08:00
Matthieu Kanj
cf44f39189 new parameters 2018-08-09 10:54:50 +02:00
Matthieu Kanj
fb3356a64c UL indication 2018-08-07 16:57:57 +02:00
Matthieu Kanj
ebab332572 adding UL indication for NPUSCH channel 2018-08-07 11:39:30 +02:00
Matthieu Kanj
6d5e60f3cd UL indication for NPRACH 2018-07-26 11:42:39 +02:00
Matthieu Kanj
30f1443a6d preparing UL_indication 2018-07-25 17:30:21 +02:00
Matthieu Kanj
ef3e40df8a Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2018-07-23 11:39:36 +02:00
Matthieu Kanj
e6a957e1aa bug fix 2018-07-23 11:37:40 +02:00
Matthieu Kanj
9d4cb04f43 improving code structure 2018-07-20 19:17:45 +02:00
Matthieu Kanj
ba13e294c4 ACK decoding 2018-07-19 10:16:18 +02:00
Matthieu Kanj
10c623147c improving code structure 2018-07-17 17:51:44 +02:00
Calvin HSU
0e6d35810b Add OAI license and author(s) name, contact information 2018-07-16 00:22:27 +02:00
Matthieu Kanj
3980842f50 Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2018-07-11 10:24:55 +02:00
Matthieu Kanj
d38501c9d4 test version 2018-07-11 10:24:40 +02:00
Nick Ho
d67c3d99bf correct the ASN.1 PDU generating for msg4 RRC PDU 2018-07-10 01:00:14 -07:00
Matthieu Kanj
008f825c52 msg4 pdu content modification 2018-06-26 14:11:47 +02:00
Matthieu Kanj
e67e233497 correction to PDU msg4 2018-06-26 11:04:33 +02:00
Matthieu Kanj
73842bed85 bug fix msg4 2018-06-25 17:36:41 +02:00
Matthieu Kanj
2ef28de053 removing unuseful code 2018-06-25 16:58:46 +02:00
Matthieu Kanj
5824229103 bug fixe in msg4 2018-06-25 16:46:01 +02:00
Matthieu Kanj
701b0ac9e8 Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2018-06-25 10:32:03 +02:00
Matthieu Kanj
9bc78d2a07 msg4 bug fix 2018-06-23 01:54:01 +02:00
Matthieu Kanj
b4365f5b35 corrections 2018-06-22 11:25:53 +02:00
Matthieu Kanj
06f78e9c6c msg3 functions 2018-06-22 10:53:53 +02:00
Nick Ho
56db54d425 Revise do_rrcconnectionsetup 2018-06-19 22:29:15 +08:00
Matthieu Kanj
99df888175 procedures for msg4 2018-06-19 15:02:20 +02:00
Matthieu Kanj
72f0176915 msg2 & msg3 functions 2018-06-06 15:05:13 +02:00
Matthieu Kanj
b07dc0f86a bug fixe for msg2 2018-05-30 18:25:44 +02:00
Matthieu Kanj
888067c38f bug fix 2018-05-29 10:24:31 +02:00
Matthieu Kanj
d04d287944 bug fix 2018-05-29 10:09:23 +02:00
Matthieu Kanj
0fbe0e79aa bug fix for scheduling 2018-05-28 16:58:05 +02:00
Matthieu Kanj
fc831af90a msg2 implementation 2018-05-15 18:13:15 +02:00
Matthieu Kanj
892a4bd145 continuity of the preparation for msg2 implementation 2018-05-09 15:34:24 +02:00
Matthieu Kanj
e59eba4d81 preparing msg2 implementation 2018-05-09 10:42:23 +02:00
Matthieu Kanj
d38f75b392 Detection of msg1 sent from NB-IoT module 2018-05-04 15:14:47 +02:00
Nick Ho
aa9e906bcc scheduler test with USRP 2018-03-27 11:08:48 -07:00
Nick Ho
96e4e6f40a Prepare environment for IF Module Testing, scheduler not calling yet 2018-03-27 03:23:39 -07:00
Matthieu Kanj
4496496a6a new config 2018-03-23 11:17:10 +01:00
Matthieu Kanj
a6003505df bug fix for lte-softmodem and SIB1 2018-03-22 17:05:00 +01:00
Matthieu Kanj
2d46e71265 bug fix 2018-03-21 09:44:47 +01:00
Matthieu Kanj
fe888bec8c lte-softmodem fix 2018-03-21 09:37:32 +01:00
Matthieu Kanj
452feeff51 Merge branch 'fix_compilation' into develop-nb-iot
fixing bug with lte_softmodem
2018-03-19 18:00:08 +01:00
Matthieu Kanj
76979a7a00 bug fix lte_softmodem 2018-03-19 17:40:26 +01:00
Matthieu Kanj
8a0616a6f4 bug fix 2018-03-18 12:19:32 +01:00
Matthieu Kanj
cbbdb5c6ee bug fixe for SIB23 2018-03-16 15:24:38 +01:00
Matthieu Kanj
cd1f20b87b bug fix 2018-03-15 17:32:08 +01:00
Matthieu Kanj
23c08a4734 SIB23 2018-03-15 16:42:47 +01:00
Matthieu Kanj
2512f82d65 tmp config for testing 2018-03-14 18:27:16 +01:00
Matthieu Kanj
1300a34184 MIB update 2018-03-09 11:28:02 +01:00
Nick Ho
27f044def3 Debug on some UL_Indication usages 2018-03-06 23:11:05 -08:00
Nick Ho
dba5c0c5d9 remove test log 2018-03-06 19:01:37 -08:00
Nick Ho
0abda38210 Provide RRC instance in PHY level 2018-03-06 18:49:31 -08:00
Matthieu Kanj
d8e6ea3702 bug fix 2018-03-06 09:43:09 +01:00
Matthieu Kanj
080d0fdf70 bug fixes in dlsch functions 2018-03-01 08:33:58 +01:00
Matthieu Kanj
a67d6cb6a3 npbch R14 2018-02-19 11:32:04 +01:00
Matthieu Kanj
b38dadb2cf adding fucntions for NPBCH R14 2018-02-19 09:47:17 +01:00
Matthieu Kanj
c05ac86e4f bug fix in pilots 2018-02-16 12:25:44 +01:00
Matthieu Kanj
2300b9fc06 bug correction for pilots 2018-02-16 08:58:15 +01:00
Matthieu Kanj
a94b05629d bug fix in broadcast channel 2018-02-15 00:51:18 +01:00
Nick Ho
4af1970f06 fix SIB2,3 after configuration 2018-02-12 07:46:46 -08:00
Matthieu Kanj
9c4d06857f adding missing parameters 2018-02-12 15:33:18 +01:00
Matthieu Kanj
56a3732fa2 fixing asn1_msg_NB_IoT.c file 2018-02-12 10:42:31 +01:00
Matthieu Kanj
b4ad22480d fixing conflict 2018-02-12 10:23:29 +01:00
Matthieu Kanj
1f20bcd187 fixing conflict 2018-02-12 10:19:46 +01:00
Nick Ho
77b3eaa8f4 fix SIB1-NB 2018-02-12 01:10:31 -08:00
Nick Ho
1c1a110c22 Fix SIB1-NB 2018-02-12 00:58:16 -08:00
Matthieu Kanj
d9b8b0ad37 fixing conflict 2018-02-12 09:54:42 +01:00
Matthieu Kanj
db5604a685 updating values of SIB1 2018-02-12 09:52:08 +01:00
Nick Ho
fb84abece3 Modify do sib 1 nb-iot 2018-02-10 07:19:45 -08:00
Matthieu Kanj
74a9532186 updating MIB content 2018-02-06 17:22:01 +01:00
Matthieu Kanj
114d1810fc debug on broadcast channel 2018-02-06 15:43:30 +01:00
Nick Ho
f7e78c3be7 Provide the get_NB_IoT_SIB1, but the value of SIB1 should be checked 2018-02-02 14:38:08 +08:00
Matthieu Kanj
79c80bc7e8 adding broadcast channel + bug fixes for physical layer 2018-01-31 16:56:17 +01:00
Matthieu Kanj
30ee122203 ............ 2018-01-30 10:41:13 +01:00
Nick Ho
a2757c87dc Debug on initialization procedure 2018-01-29 21:00:16 +08:00
Nick Ho
82fbfae510 Fix NB-IoT Asn.1 configuration and initialization 2018-01-27 02:45:45 -08:00
Matthieu Kanj
03c6604f03 bug fix for configuration part 2018-01-24 10:12:09 +01:00
Matthieu Kanj
b5a55c1396 version for testing NRS signal 2018-01-22 18:23:19 +01:00
Matthieu Kanj
656ecb440e bug fixe for synchro testing version 2018-01-21 17:43:58 +01:00
Matthieu Kanj
42e4c95284 operational code version for synchro testing 2018-01-21 17:13:33 +01:00
Matthieu Kanj
3c1373a1ed preparation for synchro signals testing 2018-01-18 16:42:54 +01:00
Matthieu Kanj
fd0f6cbbe9 error fixed, code compiles, not yet ready for testing (56 warnings) 2018-01-15 15:02:57 +01:00
Matthieu Kanj
3b0c26d91c Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2018-01-15 11:24:30 +01:00
Matthieu Kanj
5a13a7d4a2 unstable version, first phase for NPSS testing 2018-01-15 11:24:23 +01:00
Nick Ho
4c3b80b143 Debug on error in lte_softmodem before real time testing 2018-01-15 09:19:10 +08:00
Vincent Savaux
ae81246e55 add few modif in extract RB dlsch 2018-01-05 14:18:00 +01:00
Vincent Savaux
754fc0e9e7 Add cell ID estimation using NSSS 2018-01-05 11:56:26 +01:00
Vincent Savaux
5734aaee83 compiling OK, 60 warnings 2018-01-04 15:37:21 +01:00
Vincent Savaux
a2d9f0d870 Modify NPPS for LTE pilots inband 2017-12-19 18:20:49 +01:00
Vincent Savaux
564268d0c3 Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2017-12-19 08:55:35 +01:00
Vincent Savaux
73bfe44f0c Adapt time-freq DL synchro to NB-IoT 2017-12-19 08:54:01 +01:00
Matthieu Kanj
3ed2490ed8 adding settings for NB-IoT testing 2017-12-18 18:33:17 +01:00
Matthieu Kanj
dd52807ac7 Corrections to config file, putting new values 2017-12-17 02:28:37 +01:00
Matthieu Kanj
8573e0ec3f Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2017-12-16 15:08:27 +01:00
Matthieu Kanj
13052361f4 config parser code finished 2017-12-16 15:07:45 +01:00
Vincent Savaux
f2d2e36d2d Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2017-12-15 17:28:34 +01:00
Vincent Savaux
ba9e69b5ce Adapt time synchro to NB-IoT 2017-12-15 17:28:28 +01:00
Matthieu Kanj
cba2a21a84 completeing the conf part for NB-IoT 2017-12-14 09:40:25 +01:00
Matthieu Kanj
31d2f32e35 adding version 1 of the config file 2017-12-14 04:34:28 +01:00
Matthieu Kanj
3e6b9e04a8 Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot 2017-12-13 14:34:18 +01:00
Matthieu Kanj
1532289090 completing configuration file 2017-12-13 14:34:07 +01:00
Vincent Savaux
1383a49c05 Adapt llr_QPSK to NB-IoT 2017-12-13 13:56:29 +01:00
Vincent Savaux
23aeaa889b adapt channel compensation dlsch RX to NB-IoT 2017-12-13 10:06:50 +01:00
Matthieu Kanj
5101d7cb28 fixing compilation error 2017-12-13 09:57:33 +01:00
Matthieu Kanj
3fefbc0812 adding config parameters for NB-IoT 2017-12-13 08:53:27 +01:00
Nick Ho
3555a021f1 Debug with Scheduler 2017-12-12 02:56:42 -08:00
Nick Ho
9e5c636f3f fix the ASN1 warning for Rel14 2017-12-11 05:53:34 -08:00
Vincent Savaux
63be2398bd adapt extract pilot in dlsch demod to NB-IoT 2017-12-07 17:11:32 +01:00
Vincent Savaux
804b4ee718 adapt dlsch demod to NB-IoT 2017-12-06 15:02:14 +01:00
Vincent Savaux
b7514c6fd1 adapt NPUSCH demod to 3.75 kHz 2017-12-01 17:23:08 +01:00
Vincent Savaux
7cb7efe9fb Few changes in config file 2017-11-23 16:17:33 +01:00
Vincent Savaux
ff6ba40389 fill config file 2017-11-23 16:05:37 +01:00
Vincent Savaux
b78c96cb41 adapt decoding to BPSK 1 subcarrier 2017-11-22 10:44:44 +01:00
Vincent Savaux
d8fcc7c35b Adapt function demod to modulation configs 2017-11-21 10:54:12 +01:00
Vincent Savaux
e860b67475 Adapt channel estimation to 1,3,6,12 subcarriers 2017-11-15 10:49:27 +01:00
Raymond Knopp
aef1e0d55e added common header file for nb-iot and lte 2017-11-09 04:59:50 -08:00
Raymond Knopp
e678081fe4 Merge branch 'develop-nb-iot-mac' into develop-nb-iot
Conflicts:
	openair1/PHY/LTE_TRANSPORT/dlsch_coding_NB_IoT.c
	openair1/PHY/LTE_TRANSPORT/dlsch_modulation_NB_IoT.c
	openair1/PHY/LTE_TRANSPORT/dlsch_scrambling_NB_IoT.c
	openair1/PHY/LTE_TRANSPORT/npbch_NB_IoT.c
	openair1/PHY/LTE_TRANSPORT/proto.h
2017-11-09 04:58:34 -08:00
Raymond Knopp
a473dc04ee integration step 1. Common LTE/NB-IoT definitions for initial RF integration. 2017-11-09 02:56:19 -08:00
Vincent Savaux
0e810867f3 add useful files 2017-11-09 11:06:44 +01:00
Vincent Savaux
9526b4b15c add useful files 2017-11-09 11:03:58 +01:00
Vincent Savaux
26c4b20d7d modify function related to UL channel estimation 2017-10-31 18:16:45 +01:00
Vincent Savaux
1dc48ca72f adapt UL pilot generation to any subcarrier configuration 2017-10-27 15:03:18 +02:00
Vincent Savaux
bc93c53445 improve extract_rbs in ulsch with start carrier 2017-10-26 12:35:53 +02:00
Vincent Savaux
40878776a0 adapt extract_rbs in ulsch demod to any subcarrier config 2017-10-26 10:27:39 +02:00
Vincent Savaux
1341f7042f Fix some warning in nprach_NB_IoT.c 2017-10-24 10:46:24 +02:00
Matthieu Kanj
ef06c4f48c Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-10-23 18:39:10 +02:00
Matthieu Kanj
457ab9f77d Adding NPUSH related functions (vincent savaux code) 2017-10-23 18:38:55 +02:00
Nick Ho
5c32b1b208 debug for initialization debugging 2017-10-23 08:13:52 -04:00
Nick Ho
c343f5efac Set up the environment for thread testing 2017-10-19 23:19:06 -07:00
Matthieu Kanj
259df1e762 Adding of NPRACH file: nprach_NB_IoT.c (Vincent Savaux code),
expected warnings since some variables will be used in future
2017-10-17 15:47:17 +02:00
Nick Ho
93c5cb8981 debug to the rrc_mac_data_req_eNB_NB_IoT() 2017-10-16 23:35:08 -07:00
Nick Ho
6a95995fec Make some of the functions in L2_interface_NB_IoT.c to the place they should be placed 2017-10-12 23:34:55 -07:00
Nick Ho
b44acd9f74 Debuging for configuration 2017-10-11 20:42:35 -07:00
Nick Ho
75be22c49f First step of configuration between MAC and RRC 2017-10-11 19:30:25 -07:00
Nick Ho
b25fc90acd debug for the next step rrc configuration and RF timing unit modification 2017-10-09 02:51:18 -07:00
Nick Ho
50797cc97b Update IF Module 2017-10-04 18:46:59 -07:00
Nick Ho
270e006790 Add brief description for each added files 2017-10-04 07:15:50 -07:00
Nick Ho
1dc1db4114 Schedule functions complete (UL/DL/SI/RA) 2017-10-04 06:37:54 -07:00
Nick Ho
0b90e89937 Scheduler function completes, still has some warning to solve 2017-10-04 03:57:57 -07:00
Nick Ho
25f8a1bb6e commit remaining files 2017-10-03 23:49:13 -07:00
Nick Ho
0fc1cf2eed Integrate the MAC initial/configuration/SI scheduling 2017-10-03 04:52:49 -07:00
Nick Ho
cef6d0af35 Input all the MAC parameters, prepare for the next step function integration 2017-10-02 22:34:08 -07:00
Nick Ho
b8a38a2de1 Pre-commit for the clear NB-IoT MAC code for integration, still on going (110 warning) 2017-10-02 10:56:45 -07:00
Matthieu Kanj
9d8ea63c69 correction of the error in the previous commit: adding vars_NB_IoT.h file (115 warnings remaining) 2017-09-29 06:41:20 +02:00
Matthieu Kanj
d297381d56 removing RRC/LITE/vars_NB_IoT.c 2017-09-28 17:49:16 +02:00
Matthieu Kanj
da791cbe98 code cleaning 2017-09-12 16:55:51 +02:00
Matthieu Kanj
13ab4e7301 Removing warnings related to NB_IoT_eNB_NULSCH_t (118 remaining) 2017-09-09 20:55:15 +02:00
Matthieu Kanj
afca780991 Removing warnings related to MAC_xface_NB_IoT (119 remaining) 2017-09-08 17:16:19 +02:00
Matthieu Kanj
ec8a31ea25 creation of new extract_CQI function for NB_IoT (extract_CQI_NB_IoT)
+ creation of new file: openair1/PHY/LTE_TRANSPORT/uci_tools_NB_IoT.c
2017-09-08 10:45:52 +02:00
Matthieu Kanj
bd03c21143 creation of new rx_ulsch function for NB-IoT (rx_ulsch_NB_IoT)
+ creation of three new files:
openair1/PHY/LTE_ESTIMATION/freq_equalization_NB_IoT.c
openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation_NB_IoT.c
openair1/PHY/LTE_TRANSPORT/ulsch_demodulation_NB_IoT.c
2017-09-08 09:52:54 +02:00
Matthieu Kanj
320f896f60 code separation + creation of three new files:
openair1/PHY/CODING/lte_segmentation_NB_IoT.c
openair1/PHY/CODING/viterbi_lte_NB_IoT.c
openair1/PHY/LTE_TRANSPORT/lte_mcs_NB_IoT.c
2017-09-07 15:45:00 +02:00
Matthieu Kanj
a9089927ef creation of new MAC_xface for NB-IoT (MAC_xface_NB_IoT)
+ creation of new file :openair2/PHY_INTERFACE/defs_NB_IoT.h
+ additional warnings because of the new MAC_xface_NB_IoT (126 remaining)
2017-09-06 18:45:20 +02:00
Matthieu Kanj
7a704567e4 removing warnings (115 remaining) +
creation of two new files: openair1/PHY/LTE_ESTIMATION/defs_NB_IoT.h
openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_NB_IoT.c
2017-09-04 17:33:15 +02:00
Matthieu Kanj
2a792c1c0d removing warnings (121 remaining) 2017-09-04 10:21:43 +02:00
Matthieu Kanj
8df96ab596 removing warnings (124 remaining) 2017-09-01 15:06:44 +02:00
Matthieu Kanj
2a4a37c0f4 Code Separation for openair1/PHY/ + creation of new file:, (130 warnings)
openair1/PHY/LTE_TRANSPORT/vars_NB_IoT.h
2017-08-31 11:40:36 +02:00
Matthieu Kanj
9b5d4c88a2 Code Separation for openair1/PHY/, (134 warnings) 2017-08-30 17:54:22 +02:00
Matthieu Kanj
71780feb6c removing .h files from openair2/RRC/LITE/vars_NB_IoT.c 2017-08-30 09:57:20 +02:00
Matthieu Kanj
d8c70f5086 removing .h files from openair2/RRC/LITE/rrc_common_NB_IoT.c 2017-08-29 18:06:13 +02:00
Matthieu Kanj
d18c853f13 removing .h files form openair2/RRC/LITE/extern_NB_IoT.h 2017-08-29 16:26:30 +02:00
Matthieu Kanj
582c577764 seperation/renaming in file:openair2/RRC/LITE/defs_NB_IoT.h 2017-08-29 15:19:06 +02:00
Matthieu Kanj
42958e5880 renaming + removing .h files from openair2/RRC/LITE/L2_interface_NB_IoT.c 2017-08-28 18:37:17 +02:00
Matthieu Kanj
3a156e0109 code separation + renaming + creation of two new files:
openair2/RRC/LITE/rrc_eNB_UE_context_NB_IoT.c
openair2/RRC/LITE/rrc_eNB_UE_context_NB_IoT.h
2017-08-28 16:02:40 +02:00
Matthieu Kanj
037eb931ca renaming functions & variables 2017-08-28 10:06:21 +02:00
Matthieu Kanj
7b65549858 renaming functions in file :openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c 2017-08-26 02:40:20 +02:00
Matthieu Kanj
c5f26acde9 renaming structures and variables in file:openair2/RRC/LITE/defs_NB_IoT.h 2017-08-25 18:13:29 +02:00
Matthieu Kanj
b93275b6b7 removing/adding .h files + renaming functions 2017-08-25 17:30:23 +02:00
Matthieu Kanj
b8a41765c1 removing some included .h files from eNB_scheduler_ulsch_NB_IoT.c (129 warnings) +
creation of new file:openair2/RRC/LITE/rrc_types_NB_IoT.h
2017-08-25 16:20:13 +02:00
Matthieu Kanj
6be4cae60a removing some included .h files from eNB_scheduler_ulsch_NB_IoT.c +
creation of new file openair2/LAYER2/MAC/vars_NB_IoT.h
2017-08-25 11:16:07 +02:00
Matthieu Kanj
50f7cd0039 removing some included .h files from eNB_scheduler_primitives_NB_IoT.c 2017-08-24 17:43:29 +02:00
Matthieu Kanj
5cd930654c Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-08-24 17:05:32 +02:00
Matthieu Kanj
8eb94115a7 removing some included files in openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
+renaming functions and variables
+adding missing NB_IoT functions
2017-08-24 16:53:26 +02:00
Matthieu Kanj
e6640c23c7 removing not necessary files include in openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c 2017-08-24 16:48:36 +02:00
Matthieu Kanj
84c9c889da renaming structures and variables in file: openair2/RRC/LITE/defs_NB_IoT.h 2017-08-23 15:50:09 +02:00
Matthieu Kanj
17c94ff84b renaming in file: openair2/RRC/LITE/extern_NB_IoT.h 2017-08-23 14:43:02 +02:00
Matthieu Kanj
443af7af45 renaming functions in file: openair2/RRC/LITE/proto_NB_IoT.h 2017-08-23 11:00:24 +02:00
Matthieu Kanj
c0b027b457 renaming functions in file: openair2/LAYER2/MAC/proto_NB_IoT.h 2017-08-22 23:32:23 +02:00
Matthieu Kanj
502070917b renaming structures and variables in file:openair2/LAYER2/MAC/defs_NB_IoT.h 2017-08-22 22:30:40 +02:00
Matthieu Kanj
7daf62f85f renaming structures and variables in file : openair2/LAYER2/MAC/defs_NB_IoT.h 2017-08-22 17:21:05 +02:00
Matthieu Kanj
fc1ce173e4 seperation completed between files: openair1/SCHED/extern.h and openair1/SCHED/extern_NB_IoT.h 2017-08-22 14:57:51 +02:00
Matthieu Kanj
a7bfec6cc0 the renaming of NB-IoT file is completed 2017-08-22 14:01:45 +02:00
Matthieu Kanj
56a1457216 renaming file:openair2/LAYER2/MAC/proto_nb_iot.h -> openair2/LAYER2/MAC/proto_NB_IoT.h 2017-08-22 11:57:34 +02:00
Matthieu Kanj
b4816cb4bd renaming file:openair2/RRC/LITE/extern_nb_iot.h -> openair2/RRC/LITE/extern_NB_IoT.h
openair2/RRC/LITE/proto_nb_iot.h -> openair2/RRC/LITE/proto_NB_IoT.h
2017-08-22 11:43:04 +02:00
Matthieu Kanj
de02d825f8 renaming file: openair2/RRC/LITE/MESSAGES/asn1_msg_nb_iot.h -> openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h
openair2/RRC/LITE/defs_nb_iot.h -> openair2/RRC/LITE/defs_NB_IoT.h
2017-08-22 11:13:22 +02:00
Matthieu Kanj
d53413610b renaming file:openair2/PHY_INTERFACE/IF_Module_nb_iot.h -> openair2/PHY_INTERFACE/IF_Module_NB_IoT.h 2017-08-22 10:47:42 +02:00
Matthieu Kanj
03936c2a2e renaming file:openair2/PHY_INTERFACE/IF_Module_L2_primitives_nb_iot.h -> openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.h 2017-08-22 10:09:12 +02:00
Matthieu Kanj
607490d4ba renaming file:openair2/PHY_INTERFACE/IF_Module_L2_primitives_nb_iot.c -> openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.c
openair2/PHY_INTERFACE/IF_Module_nb_iot.c -> openair2/PHY_INTERFACE/IF_Module_NB_IoT.c
openair2/RRC/LITE/L2_interface_nb_iot.c -> openair2/RRC/LITE/L2_interface_NB_IoT.c
openair2/RRC/LITE/MESSAGES/asn1_msg_nb_iot.c -> openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c
openair2/RRC/LITE/rrc_common_nb_iot.c -> openair2/RRC/LITE/rrc_common_NB_IoT.c
openair2/RRC/LITE/rrc_eNB_nb_iot.c -> openair2/RRC/LITE/rrc_eNB_NB_IoT.c
openair2/RRC/LITE/vars_nb_iot.c -> openair2/RRC/LITE/vars_NB_IoT.c
2017-08-22 09:59:15 +02:00
Matthieu Kanj
2d208bc5c0 renaming file:openair2/LAYER2/MAC/defs_nb_iot.h -> openair2/LAYER2/MAC/defs_NB_IoT.h 2017-08-21 17:24:58 +02:00
Matthieu Kanj
8622908567 renaming file: openair2/LAYER2/MAC/eNB_scheduler_nb_iot.c -> openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_RA_nb_iot.c -> openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_dlsch_nb_iot.c -> openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_primitives_nb_iot.c -> openair2/LAYER2/MAC/eNB_scheduler_primitives_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_ulsch_nb_iot.c -> openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
openair2/LAYER2/MAC/main_nb_iot.c -> openair2/LAYER2/MAC/main_NB_IoT.c
2017-08-21 14:49:18 +02:00
Matthieu Kanj
649780913f renaming file:openair1/SCHED/defs_nb_iot.h -> openair1/SCHED/defs_NB_IoT.h ,
openair1/SCHED/phy_procedures_lte_eNb_nb_iot.c -> openair1/SCHED/phy_procedures_lte_eNb_NB_IoT.c
2017-08-21 14:22:05 +02:00
Matthieu Kanj
44215ada60 renaming file:openair1/SCHED/IF_Module_L1_primitives_nb_iot.c -> openair1/SCHED/IF_Module_L1_primitives_NB_IoT.c 2017-08-21 11:24:37 +02:00
Matthieu Kanj
0d61ffea99 openair1/SCHED/IF_Module_L1_primitives_nb_iot.h -> openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h 2017-08-21 11:17:22 +02:00
Matthieu Kanj
8ac246c464 renaming file: openair1/PHY/impl_defs_lte_nb_iot.h -> openair1/PHY/impl_defs_lte_NB_IoT.h 2017-08-21 11:01:48 +02:00
Matthieu Kanj
66f1039499 renaming file:openair1/PHY/defs_nb_iot.h -> openair1/PHY/defs_NB_IoT.h 2017-08-21 10:24:42 +02:00
Matthieu Kanj
c6abe215ce renaming file:openair1/PHY/LTE_TRANSPORT/proto_nb_iot.h -> openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h 2017-08-18 17:35:52 +02:00
Matthieu Kanj
1ec31489b6 renaming file: openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h -> openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h 2017-08-18 17:21:01 +02:00
Matthieu Kanj
db93e15907 renaming file: openair1/PHY/LTE_TRANSPORT/dci_tools_nb_iot.c -> openair1/PHY/LTE_TRANSPORT/dci_tools_NB_IoT.c 2017-08-18 17:06:50 +02:00
Matthieu Kanj
484ff57ec1 renaming file: openair1/PHY/LTE_TRANSPORT/dci_nb_iot.h -> openair1/PHY/LTE_TRANSPORT/dci_NB_IoT.h 2017-08-18 16:55:46 +02:00
Matthieu Kanj
5a2415d501 renaming file : openair1/PHY/LTE_TRANSPORT/dci_nb_iot.c -> openair1/PHY/LTE_TRANSPORT/dci_NB_IoT.c 2017-08-18 15:48:59 +02:00
Matthieu Kanj
30a9ffe0da renaming openair1/PHY/INIT/defs_nb_iot.h -> openair1/PHY/INIT/defs_NB_IoT.h 2017-08-18 15:31:55 +02:00
Matthieu Kanj
9cb628a4c5 renaming openair1/PHY/INIT/lte_init_nb_iot.c -> openair1/PHY/INIT/lte_init_NB_IoT.c 2017-08-18 15:13:00 +02:00
Matthieu Kanj
9ccd6219ff renaming openair1/PHY/CODING/defs_nb_iot.h -> openair1/PHY/CODING/defs_NB_IoT.h 2017-08-18 10:57:56 +02:00
Matthieu Kanj
b857d15cb6 Modifications for separation of openair2 files (134 warnings) 2017-08-18 10:04:22 +02:00
Matthieu Kanj
9646876ad6 creation of new file openair1/SCHED/extern_NB_IoT.h +
seperation for files in /SCHED
2017-08-17 15:40:12 +02:00
Matthieu Kanj
759377b87f seperation completed for /LTE_TRANSPORT 2017-08-16 17:33:10 +02:00
Matthieu Kanj
20c916fa52 creation of two new files openair1/PHY/types_NB_IoT.h openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full_NB_IoT.h 2017-08-16 15:11:42 +02:00
Matthieu Kanj
1c78e96362 Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-08-15 20:42:52 +02:00
Matthieu Kanj
162066e41c Modifications for file separation in /LTE_TRANPORT 2017-08-15 20:42:14 +02:00
Nick Ho
7b625c88a6 Sync IF Module with RU-RAU branch 2017-08-13 21:47:58 -07:00
Matthieu Kanj
09efb985e5 seperation for file: openair1/PHY/LTE_TRANSPORT/dlsch_coding_NB_IoT.c
+ creation of new file openair1/PHY/LTE_TRANSPORT/extern_NB_IoT.h
2017-07-31 15:25:36 +02:00
Matthieu Kanj
34edb29386 separation between files in openair1/PHY/LTE_TRANSPORT/
+ creation of 2 new files openair1/PHY/LTE_TRANSPORT/uci_NB_IoT.h openair2/COMMON/platform_types_NB_IoT.h
2017-07-28 17:46:47 +02:00
Matthieu Kanj
0fdd3c8e60 seperation completed for the file /LTE_TRANSPORT/dci_tools_nb_iot.c (the includes to review)
+ creation of new file : openair2/LAYER2/MAC/extern_NB_IoT.h
2017-07-27 15:01:26 +02:00
Matthieu Kanj
92f0af7186 speration completed for the file /PHY/LTE_TRANSPORT/dci_nb_iot.c +
remouving warnings (137 remaining)
2017-07-27 10:11:00 +02:00
Matthieu Kanj
6e494638dc Separation completed for PHY/INIT/ (for files:defs_nb_iot.h lte_init_nb_iot.c) 2017-07-26 15:56:14 +02:00
Matthieu Kanj
b139eeb864 Seperation completed for PHY/LTE_REFSIG/,
-openair1/PHY/LTE_REFSIG/defs_NB_IoT.h
lte_dl_cell_spec_NB_IoT.c lte_gold_NB_IoT.c
2017-07-26 09:39:46 +02:00
Matthieu Kanj
d40c0abec9 separation completed for PHY/CODING (also for CODING/lte_rate_matching_NB_IoT.c) 2017-07-25 11:22:11 +02:00
Matthieu Kanj
5c2cbdd05d seperation completed for PHY/CODING/:ccoding_byte_NB_IoT.c
crc_byte_NB_IoT.c
defs_nb_iot.h
2017-07-25 10:56:51 +02:00
Matthieu Kanj
0d38348421 adding new file openair1/PHY/LTE_TRANSPORT/ulsch_decoding_NB_IoT.c
+ modifiying structure name
2017-07-24 14:28:09 +02:00
Matthieu Kanj
517d412208 replacing NB by NB_IoT + remouving warnings (139 remaining) 2017-07-24 09:53:15 +02:00
Matthieu Kanj
bab0bf57b5 adding new file pusch_pc_NB_IoT.c 2017-07-23 20:34:01 +02:00
Matthieu Kanj
3ca4ddef50 creating new file pusch_pc_NB_IoT.c + remouving warning
(143 remaining)
2017-07-23 17:04:04 +02:00
Matthieu Kanj
946b063576 removing warnings (148 remaining) 2017-07-23 16:25:02 +02:00
Matthieu Kanj
858ee3a18e removing warnings (150 remaining) 2017-07-23 13:33:02 +02:00
Matthieu Kanj
5f807fb3d8 removing of warnings (153 remaining) 2017-07-23 12:54:52 +02:00
Matthieu Kanj
4d1452e19b adding new file : openair1/SCHED/phy_procedures_lte_common_NB_IoT.c
+ replacing find_ue_NB by find_ue_NB_IoT
2017-07-23 11:47:41 +02:00
Matthieu Kanj
7078d93920 resolving 2 warnings (156 remaining) 2017-07-21 17:33:42 +02:00
Matthieu Kanj
59f7209418 creating new files for code separation, openair1/PHY/extern_NB_IoT.h openair1/PHY/vars_NB_IoT.h,
+ replacing PHY_vars_eNB_g by PHY_vars_eNB_NB_IoT_g
2017-07-21 15:47:41 +02:00
Matthieu Kanj
ab4fb08349 creating a complete seperation between PHY/defs.h file and PHY/defs_nb_iot.h file, replacing
all include of defs.h by defs_nb_iot.h in 33 files.
2017-07-20 18:13:53 +02:00
Matthieu Kanj
b023840911 replacing NB by NB_IoT in files: LTE_TRANSPORT/dlsch_coding.c
LTE_TRANSPORT/proto.h
targets/SIMU/USER/init_lte.c
2017-07-20 11:08:14 +02:00
Matthieu Kanj
98a2c4ca23 replacing NB by NB_IoT in SCHED/IF_Module_L1_primitives_nb_iot.c,SCHED/defs_nb_iot.h,SCHED/phy_procedures_lte_eNb_nb_iot.c,targets/RT/USER/lte-enb.c 2017-07-20 10:55:20 +02:00
Matthieu Kanj
09204ef5d0 replacing NB_common_signal_procedures by common_signal_procedures_NB_IoT 2017-07-20 10:33:12 +02:00
Matthieu Kanj
e516cd6303 replacing LTE_DL_FRAME_PARMS by NB_IoT_DL_FRAME_PARMS 2017-07-20 09:15:03 +02:00
Matthieu Kanj
76ea006b02 renaming structures: DCI_ALLOC_NB_t and DCI_format_NB_t by DCI_ALLOC_NB_t and DCI_format_NB_IoT_t 2017-07-19 17:26:27 +02:00
Matthieu Kanj
39566efc79 modifiying structure name for NB_DL_FRAME_PARMS, replaced by NB_IoT_DL_FRAME_PARMS 2017-07-19 15:40:06 +02:00
Matthieu Kanj
8060a90a03 renaming function: replacing NB_generate_eNB_dlsch_params_from_dci by generate_eNB_dlsch_params_from_dci_NB_IoT, in files
LTE_TRANSPORT/dci_tools_nb_iot.c /LTE_TRANSPORT/proto_nb_iot.h SCHED/phy_procedures_lte_eNb_nb_iot.c
2017-07-19 11:44:30 +02:00
Matthieu Kanj
62d834d30d renaming function: replacing NB_generate_eNB_ulsch_params_from_dci by generate_eNB_ulsch_params_from_dci_NB_IoT , in files /LTE_TRANSPORT/dci_tools_nb_iot.c /LTE_TRANSPORT/proto_nb_iot.h SCHED/phy_procedures_lte_eNb_nb_iot.c 2017-07-19 11:25:07 +02:00
Matthieu Kanj
f20fcad954 renaming function: replacing NB_add_dci by add_dci_NB_IoT , in files LTE_TRANSPORT/dci_tools_nb_iot.c LTE_TRANSPORT/proto_nb_iot.h 2017-07-19 11:04:03 +02:00
Matthieu Kanj
0a79cc80be renaming generate_dci_top_NB function in LTE_TRANSPORT/dci_nb_iot.c LTE_TRANSPORT/proto_nb_iot.h phy_procedures_lte_eNb_nb_iot.c 2017-07-19 10:41:30 +02:00
Matthieu Kanj
aabfe373c6 remouving warnings from npbch_NB_IoT.c, (144 warnings remaining) 2017-07-19 09:57:26 +02:00
Matthieu Kanj
2e64e8475f adding crc_byte_NB_IoT.c to the CMakelists.txt 2017-07-19 09:42:51 +02:00
Matthieu Kanj
76b6804fa4 renaming variable name in ccoding_byte_NB_IoT.c, renaming function of lte_rate_matching_NB_IoT.c, adding new file:crc_byte_NB_IoT.c, adding missing functions to defs_nb_iot.h 2017-07-18 18:13:35 +02:00
Nick Ho
6a2100a744 Add the skelecton of the MAC scheduler 2017-07-17 02:51:32 -07:00
Michele Paffetti
034b602cdd Cleaning some parts of RRC code no more useful. Code compile. 145 warnings 2017-07-13 08:38:35 +02:00
Michele Paffetti
3bbb960dd2 Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-07-12 18:16:39 +02:00
Michele Paffetti
3681d24fe1 adding NPDCCH structure for UE specific and Common Search space. To be implemented NPDCCH repetitions.Code Copile. 145 Warnings 2017-07-12 18:16:07 +02:00
Michele Paffetti
0fffe1a3af introduction of some UE-specific parameters for NPDCCH (Seems missing in FAPI for the moment). Code copile, 149 warnings 2017-07-11 17:34:57 +02:00
KroEmPa
fb832dcc58 Start MAC Scheduler 2017-07-11 14:39:07 +08:00
Michele Paffetti
0d3345f384 Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-07-10 17:26:07 +02:00
Michele Paffetti
bdc38e8eed Adding preliminary .config file for nb-iot (to be completed), adding EARFCN calculation for configuration with corresponding table for UE cat NB1/NB2 2017-07-10 17:25:55 +02:00
Matthieu Kanj
7bec85755a Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-07-07 14:16:45 +02:00
Matthieu Kanj
ec2b045d84 rename ok 2017-07-07 14:15:54 +02:00
Matthieu Kanj
2acbe6f1a9 rename 2017-07-07 14:15:02 +02:00
Michele Paffetti
8cd9b164bb solved merge issues (openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h is commented) 2017-07-07 11:51:53 +02:00
Michele Paffetti
7ccaf81495 Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-07-07 11:21:29 +02:00
Michele Paffetti
87e25f5669 adding some consideration and implement some checking based on FAPI specifications for ndlsch path. Function for encoding, modulation ecc.. still to be added. Code Compile. 144 warnings 2017-07-07 11:21:21 +02:00
Michele Paffetti
637ab8cb64 conflicts correction and reordering of files 2017-07-06 10:46:13 +02:00
Matthieu Kanj
a6a371a637 adding defs file for nb-iot 2017-07-06 10:38:15 +02:00
Michele Paffetti
a9f91a9c4b modified conditions for triggering the npdsch_procedure, still modulation, encoding...functions to be integrated. Warnings 144.Code compile 2017-07-06 10:16:22 +02:00
Matthieu Kanj
849e93124b renaming file dci_nb_iot.c 2017-07-05 17:05:55 +02:00
Matthieu Kanj
15b74a99ae renaming file 2017-07-05 17:04:37 +02:00
Matthieu Kanj
25c8b29fd8 NPDCCH functions encoding , scrambling, modulation , mapping 2017-07-05 09:28:27 +02:00
Michele Paffetti
e6c47f943c Setup of required variables for managing the SI messages transmission, according to our Assumptions. Still to include the function for encoding, scrambling ecc.. of npdsch and npdcch for the DL path. Code compile. 141 Warnings 2017-07-04 18:13:22 +02:00
Michele Paffetti
2a68d847ef Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac 2017-07-03 17:57:58 +02:00
Michele Paffetti
b010d77f0f Adding comment for ASSUMPTIONs in SI transmission for FAPI style apprach. Code compile 2017-07-03 17:57:50 +02:00
Matthieu Kanj
3f9e3e1c30 adding NPDSCH functions 2017-06-30 11:25:03 +02:00
Matthieu Kanj
7e60086f9e adding shared channel (npdsch) functions for NB-IOT 2017-06-30 10:59:28 +02:00
Matthieu Kanj
7e54224382 correction for missing declaration for a variable 2017-06-30 10:08:58 +02:00
Michele Paffetti
c2ef993c59 path for NDLSCH procedure almost completed (missed coding, modulation and scrambling functions). Code compile. 140 warnings 2017-06-29 21:12:36 +02:00
Michele Paffetti
ba9e743efa Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac
merge with nick branch for synch.
2017-06-29 18:18:54 +02:00
Michele Paffetti
2b1c1482fa almost complete the ndlsch and npdcch path. missed the coding, modulation and scrambling function.Code compile. 140 warnings 2017-06-29 18:18:31 +02:00
Nick Ho
56a45cb4e3 add TBS table for NB-IoT 2017-06-29 15:44:10 +02:00
Michele Paffetti
993570c212 Correction of some bugs on coding files, starting implementation of single thread dlsch procedure (schedule_responce, generate_dlsch_params ecc..), Code Compile. Still 150 warnings 2017-06-29 08:59:36 +02:00
Matthieu Kanj
a9b67c50de correction of functions parameters 2017-06-28 17:57:32 +02:00
Michele Paffetti
d6b6cb9143 commit before merge with nick 2017-06-28 15:08:28 +02:00
Nick Ho
6768c7da22 modify the rxtx approach code compiled 2017-06-28 15:00:52 +02:00
Nick Ho
abad0f860d NDLSCH/NULSCH structures in PHY_VARS_eNB (include HARQ strutcures) code compiled 2017-06-28 09:40:30 +02:00
Matthieu Kanj
7790a10b20 correction to npbch pdu flip 2017-06-28 09:33:09 +02:00
Michele Paffetti
32aa59e054 modify PHY TX procedure. still npdsch_procedure to be completed. Code compile but lots of warnings. 2017-06-27 13:45:14 +02:00
Michele Paffetti
c6df27bacd commit before pull nick version 2017-06-26 15:08:58 +02:00
Nick Ho
6010c7fd02 Managing the TX 2017-06-26 15:03:30 +02:00
Nick Ho
f72365989e Correct UL_INFO as a pointer 2017-06-26 11:44:24 +02:00
Nick Ho
c6b11be0a3 code compiled, phy modify 2017-06-24 14:06:12 +02:00
Michele Paffetti
6bc942488e Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac
merging for synchronization with nick work
2017-06-22 17:37:51 +02:00
Michele Paffetti
4d17c7a6b7 start modification for HARQ process and adding major strucutres to PHY_vars_eNB. Code not compile. dci_nb_iot.c to be added to CMakeList 2017-06-22 17:36:57 +02:00
Nick Ho
4fa8fa5686 update input of generate_npbch_NB_IoT code not compiled 2017-06-22 15:28:42 +02:00
Michele Paffetti
d1d341ef37 solved some conflict from the merge 2017-06-22 15:10:11 +02:00
Michele Paffetti
8109b45ac5 comit before sinchronize with nick work 2017-06-22 14:56:32 +02:00
Nick Ho
302e4c576b NB_generate_dci_top skeleton, code not compiled 2017-06-22 14:54:26 +02:00
Michele Paffetti
6f4d5db7e2 put relevant comment for starting the implementation of physical prcedures. Code not compile 2017-06-22 08:59:41 +02:00
Michele Paffetti
a650716556 solve conflicts of merge 2017-06-21 15:12:18 +02:00
Michele Paffetti
61d976e05e commit before merge from nick modification 2017-06-21 15:10:01 +02:00
Nick Ho
9c22ed6c59 dci still need to modify 2017-06-21 15:08:13 +02:00
Cedric Roux
2f89881704 Merge remote-tracking branch 'origin/develop' into develop-nb-iot 2017-06-20 17:52:11 +02:00
Michele Paffetti
d71ce5a4ed add some comment in the code for the integration week work 2017-06-20 11:18:30 +02:00
Michele Paffetti
7c647d15d1 integration of LCID for NB-IoT (MAC/defs_nb_iot.h), complete the thread for the phy_procedures_TX (Schedule_response) and other minor changes 2017-06-19 14:35:12 +02:00
Michele Paffetti
d805f3a5e8 updates on the initialization procedures for NB_IoT 2017-06-19 10:30:16 +02:00
Nick Ho
b5aa2b2b87 main_nb_iot.c updated 2017-06-19 09:53:23 +02:00
Nick Ho
3b00e1dccb Update main_nb_iot in MAC 2017-06-18 01:25:06 +02:00
Michele Paffetti
44b6e1a3a4 adding main_nb_iot for MAC folder. Code compile 2017-06-17 08:47:52 +02:00
Michele Paffetti
e8451cfdc2 merge with nick version. Code compile 2017-06-16 17:39:36 +02:00
Michele Paffetti
4729dd672b start implementation of initialization path for nb-iot and if-module 2017-06-16 17:31:16 +02:00
Nick Ho
2ccbef43e0 Add the compilation option NB_IOT 2017-06-16 16:13:22 +02:00
Nick Ho
711a4fb913 Add the initialization of the IF_Module at lte-softmodem main 2017-06-16 14:47:14 +02:00
Nick Ho
e3b21d8bce Add some comment at NB_rxtx 2017-06-15 14:40:15 +02:00
Nick Ho
75d6077c21 New rxtx defined for NB-IoT, using the FAPI parameters adapting to the physical layer parameters. 2017-06-15 13:42:18 +02:00
Michele Paffetti
7c5585fb49 review of PHY_Config_t structure parameters for FAPI-like approach. Implement the FAPI required parameters and adding some extras in separate structure. Code compile 2017-06-15 13:22:55 +02:00
Michele Paffetti
1baa3251cd solve conflict of previous merge 2017-06-14 14:44:31 +02:00
Michele Paffetti
ee4974ba30 Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac
Sincronization with Nick work
2017-06-14 14:16:29 +02:00
Michele Paffetti
e15c1f111e Implementation of configuration data structures following FAPI-like approach. Some parameters seem to be non implemented in FAPI (for the moment addedd manually). Cleaning of some part of RRC code. Code compile. 2017-06-14 14:16:17 +02:00
Nick Ho
c86b684064 Use FAPI structures to present the IF Module 2017-06-14 13:57:59 +02:00
Nick Ho
f822c17d77 Add if_inst as a global paramters 2017-06-13 15:59:28 +02:00
Michele Paffetti
87aff44c72 Added new files for IF-module purposes (still to complete), review some configuration procedure for FAPI-like approach. Code compile 2017-06-12 17:37:10 +02:00
Michele Paffetti
bd672b4229 cleaning part of the code for commn configuration in do_sib2_NB function. code compile 2017-06-09 17:11:27 +02:00
Michele Paffetti
c4925a1d64 Merge branch 'develop-nb-iot-mac' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-mac
Sincronization with NICK work on the same branch
2017-06-08 14:33:41 +02:00
Michele Paffetti
46b04c3bf7 First implementation of FAPI-like P5 configuration for the PHY layer. PHY_Config_t structure, modified NB_rrc_mac_config_req_eNB for triggering the IF_Module PHY_config_req function. Some common config. and all the dedicated configuration are missed 2017-06-08 14:33:17 +02:00
Nick Ho
5729da580b Add NB_common_signal_procedures in NB_phy_procedures_eNB_TX 2017-06-08 13:36:59 +02:00
Nick Ho
9257223e44 Link the physical layer stuff in cmakelist and debugged 2017-06-08 13:22:19 +02:00
Michele Paffetti
15e4e6a45c Merging mac branch to RRC branch for IF-Module implementation(still not completed). Solve some bugs. Now move to mac branch for continue implementation 2017-06-08 10:41:20 +02:00
Nick Ho
59dd935293 Merge remote-tracking branch 'origin/develop-nb-iot' into develop-nb-iot-mac
Conflicts:
	openair1/PHY/impl_defs_lte_nb_iot.h
2017-06-08 09:41:33 +02:00
Michele Paffetti
03c04bdc0d start FAPI approach in NB_rrc_mac_config_eNB. Code not compile. Push for merge purpose 2017-06-08 09:40:22 +02:00
Michele Paffetti
807e160b98 adding PHY_Config structure for FAPI-like PHY configuration, still to finish the function call. The code compile 2017-06-07 18:15:16 +02:00
Cedric Roux
da0e334cbe Merge remote-tracking branch 'origin/develop' into develop-nb-iot 2017-06-07 14:29:11 +02:00
Michele Paffetti
5ac6d639ea delete two parameters not used in NB_rrc_mac_config_req_eNB 2017-06-07 08:05:13 +02:00
Nick Ho
bd903cfef3 Modify IF Module to fit the FAPI Specification 2017-06-06 11:03:34 +02:00
Nick Ho
81a04df3a9 fixed the error in impl_defs_lte_nb_iot.h 2017-06-01 17:44:34 +02:00
Nick Ho
28991862d0 Update IF_Module_nb_iot.h to compatible to FAPI, and add the regist function for IF Module 2017-06-01 17:10:39 +02:00
Matthieu Kanj
ff3ceab752 correction to lte_rate_matching_NB_IoT.c 2017-06-01 14:08:18 +02:00
Matthieu Kanj
ea9f723fc9 correction to npbch_NB_IoT.c function 2017-06-01 13:57:11 +02:00
Matthieu Kanj
54896bac5b correction for broadcast struct 2017-06-01 13:50:33 +02:00
Matthieu Kanj
e7974775ba modification of impl_defs_lte_nb_iot.h / adding NPBCH structur 2017-06-01 10:19:53 +02:00
Matthieu Kanj
249e67153b add synchro fucntions for NPSS and NSSS signal for NB-IoT 2017-06-01 10:09:24 +02:00
Matthieu Kanj
4deb7c5494 add broadcast channel function for NB-IoT/Tail-biting convolutional coding/rate matching/gold sequence/pilots generation function 2017-06-01 09:54:45 +02:00
Nick Ho
27dd07eacd Complete the new way packing DCI and Configure PHY at the same time 2017-05-31 16:42:55 +02:00
Nick Ho
af9833fff9 Warning fixed, add defs_nb_iot.h in PHY 2017-05-30 17:27:05 +02:00
Michele Paffetti
559e81bbd3 solved some warnings but still lots remain (due also to asn1 problems) 2017-05-29 21:20:33 +02:00
Nick Ho
f3b6c4912e Bug fixe lte_init.c 2017-05-29 14:51:22 +02:00
Nick Ho
897b24dc2c Add new file dci_tools_nb_iot 2017-05-29 12:28:24 +02:00
Nick Ho
2e5b4c6a00 Update PHY procedures TX 2017-05-27 15:21:41 +02:00
Matthieu Kanj
da4afbd4f4 add synchro signals functions for NB-IoT
still needs integration
2017-05-24 16:27:49 +02:00
Nick Ho
b2fccdfaec NB_Phy_procedures_TX & solve some warnings 2017-05-24 11:56:52 +02:00
Nick Ho
d1d5029ff9 DCI_PDU_NB structure update, and add some stuff in NB_phy_prcoedures_TX 2017-05-23 18:00:39 +02:00
Nick Ho
bdf57bdc97 Modifiy the DCI_PDU structure in MAC, add the DCI_ALLOC_NB for NB-IoT 2017-05-23 16:17:44 +02:00
Nick Ho
4e522af668 Merge branch 'develop-nb-iot-mac' into develop-nb-iot 2017-05-23 13:00:18 +02:00
Nick Ho
9e228a7438 Modify the proto_nb_iot in MAC folder 2017-05-23 12:57:30 +02:00
Nick Ho
39c0a57c4c Warning fixed, Add new rx_tx scheme 2017-05-23 12:57:30 +02:00
Nick Ho
b46c33999a dci error fixed 2017-05-23 12:57:30 +02:00
Nick Ho
95db8f6c16 Warning fixed 2017-05-23 12:57:29 +02:00
Nick Ho
e01a3c06c7 Complete the UL_INDICATION, and the Sched_Rsp structure 2017-05-23 12:57:29 +02:00
Nick Ho
4e93618b38 Update record.txt 2017-05-23 12:57:29 +02:00
Nick Ho
7dfa4afa3b Start implementing UL_Indication 2017-05-23 12:57:29 +02:00
Nick Ho
0e098e1241 Add IF_module structure and modify the PHY recieving data 2017-05-23 12:57:29 +02:00
Eric
0bb24834fe Add DCI data structure and NB_eNB_shcedule_RA 2017-05-23 12:57:29 +02:00
Nick Ho
3cde6ecb8b Update defs.h 2017-05-23 12:57:29 +02:00
Nick Ho
dce3862bde Add NB_initiate_ra_proc() 2017-05-23 12:57:29 +02:00
Nick Ho
c319c7b3a6 Synchronize the file name with RRC branch 2017-05-23 12:57:29 +02:00
Nick Ho
76334007ec Add part of the MAC primitives & FAPI Style Interfaces figure 2017-05-23 12:50:16 +02:00
Nick Ho
26407d26af ADD PHY_CONFIG and PHY Parameters for NB-IoT 2017-05-23 12:47:24 +02:00
Nick Ho
ea9282f459 Replace defs.h 2017-05-23 12:47:24 +02:00
Nick Ho
2ed1bfb196 Upload defs for NB-IoT MAC 2017-05-23 12:47:24 +02:00
Nick Ho
a531c5173e Update defs.h 2017-05-23 12:47:24 +02:00
Nick Ho
1bbdc2dcda Add the function NB_phy_config_mib_eNB & NB_phy_config_sib2_eNB (TODO) 2017-05-23 12:47:24 +02:00
Nick Ho
9d8268e70c Add the define of NB_phy_config_mib_eNB & NB_phy_config_sib2_eNB 2017-05-23 12:47:24 +02:00
Nick Ho
f07397e6b0 Modify defs.h in MAC for NB-IoT 2017-05-23 12:47:24 +02:00
Nick Ho
a9a6a545ef Replace rrc_eNB.c 2017-05-23 12:47:24 +02:00
Nick Ho
9cc7c2d12b Update FAPI style interface for NB-IoT documents. 2017-05-23 12:47:24 +02:00
Nick Ho
93b0e1fb9b Upload the FAPI style interface for NB-IoT L2/L1 2017-05-23 12:47:24 +02:00
Nick Ho
1fecf3bf4b Delete Fapi_draft.pdf 2017-05-23 12:47:24 +02:00
Nick Ho
1d5a372cc9 Upload new file 2017-05-23 12:47:24 +02:00
Nick Ho
e55e3e6f0b Upload new file 2017-05-23 12:47:24 +02:00
Nick Ho
0b2a3668f3 Delete NB_MAC_SAP.docx 2017-05-23 12:47:24 +02:00
Nick Ho
4ce4c187bc Delete MAC_DD_integration.docx 2017-05-23 12:47:24 +02:00
Nick Ho
9d14ef5095 Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
fa278acdff Delete NB_MAC_Design_Document.docx 2017-05-23 12:47:23 +02:00
Nick Ho
fed3da6622 Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
7aef723ca6 Draft by Nick 2017-05-23 12:47:23 +02:00
Nick Ho
45816bd33e Update Readme 2017-05-23 12:47:23 +02:00
Nick Ho
fead207f44 Update Readme 2017-05-23 12:47:23 +02:00
Nick Ho
8eacbfe661 Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
91485cdf04 Delete NB_L2_interface.pdf 2017-05-23 12:47:23 +02:00
Nick Ho
8a0f0172e1 Upload the interface document 2017-05-23 12:47:23 +02:00
Nick Ho
5d919b40da Delete Interface_MAC_NB.pdf 2017-05-23 12:47:23 +02:00
Nick Ho
a97ce5c349 Upload the interface related to MAC for NB-IoT 2017-05-23 12:47:23 +02:00
Nick Ho
38c7be6683 Update Readme 2017-05-23 12:47:23 +02:00
Nick Ho
d9be30fc81 Folder Description 2017-05-23 12:47:23 +02:00
Nick Ho
76a6cfe607 Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
fdaf93ec72 Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
d3f12491f1 Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
6a705eb46f Upload new file 2017-05-23 12:47:23 +02:00
Nick Ho
a7f9f3a397 Upload new file 2017-05-23 12:47:22 +02:00
Nick Ho
fbf56d4fd6 Upload new file 2017-05-23 12:47:22 +02:00
Nick Ho
af20a29a86 Upload new file 2017-05-23 12:47:22 +02:00
Nick Ho
4961013bb4 Upload new file 2017-05-23 12:47:22 +02:00
Nick Ho
de2401a9bd Upload new file 2017-05-23 12:47:22 +02:00
Nick Ho
51d56fe8dd Add new directory 2017-05-23 12:47:22 +02:00
Nick Ho
d0f47893d8 Delete .gitkeep 2017-05-23 12:47:22 +02:00
Nick Ho
02861d060d Message Sequence Chart for LTE and NB-IoT 2017-05-23 12:47:22 +02:00
Nick Ho
24730dea22 NB-IoT MAC Design Document & Service Access Point & Message Sequence 2017-05-23 12:47:22 +02:00
Michele Paffetti
f19315aa23 Merge branch 'develop-nb-iot-RRC' into develop-nb-iot 2017-05-23 12:40:39 +02:00
Michele Paffetti
106f3135bf implementation of is_SIB1_NB and is_SIB23_NB function for SI scheduling purposes (NB_mac_rrc_data_req_eNB), the code compile but still warning to be solved 2017-05-23 12:30:46 +02:00
Michele Paffetti
4f5cc15c72 starting modify NB_mac_rrc_data_req primitive for SIBs scheduling purposes (L2_interface_nb_iot.c) 2017-05-23 12:30:46 +02:00
Michele Paffetti
bb39e42ce9 Update Develop-Records.txt 2017-05-23 12:30:46 +02:00
Michele Paffetti
f3d3e22680 Update RRC Signalling Flow in OAI for NB-IoT purposes 2017-05-23 12:30:46 +02:00
Michele Paffetti
08e2a0486a Update the Protocol Stack for NB-IoT (only DL) 2017-05-23 12:30:46 +02:00
Michele Paffetti
b49bfe6e96 Managment of SRBs, SecurityFailure, introduction of new function in PDCP for short SN and other small chages. Introduction of Develop-Records.txt file for keep tracking 2017-05-23 12:30:46 +02:00
Michele Paffetti
a228777c45 Adding new files 'L2_interface_nb_iot.c'(temporary collection of the major interfaces among layers),'proto_nb_iot.h',.. and modification of others. The code compile but not running test since still lower layers to be completed. Still to be reviewed the SRBs logic and activation 2017-05-23 12:30:46 +02:00
Michele Paffetti
e6c25ec9ea Delete Readme-Images 2017-05-23 12:30:46 +02:00
Michele Paffetti
933ef1974f creation of Readme file for RRC_image directory 2017-05-23 12:30:46 +02:00
Michele Paffetti
b25c1b892b RRC Protocol stack overview 2017-05-23 12:30:46 +02:00
Michele Paffetti
3ab54cf820 Replace RRC_Signalling_Flow_Chart.png with the New version of the Signalling flow chart for initial RRC connection establishment (mainly oriented to SRB/DRB managment) 2017-05-23 12:30:46 +02:00
Michele Paffetti
ae25ec0289 add ConnectionRelease message and introduction of SRB1bis, some bug fixed, code not tested (may not compile) 2017-05-23 12:30:46 +02:00
Michele Paffetti
d86cb3adb1 First draft on SRBs flow over RRC eNB 2017-05-23 12:30:46 +02:00
Michele Paffetti
d55d71ab13 Directory for RRC Flow Diagrams and Charts 2017-05-23 12:30:46 +02:00
Michele Paffetti
9650940f3e structure type name changed in defs_nb_iot.h for compile purposes, fix some bugs. Code compile but still to much wornings 2017-05-23 12:30:46 +02:00
Michele Paffetti
908bad77ce RRC state machine first implementation, code not tested, SRBs not managed 2017-05-23 12:30:46 +02:00
Michele Paffetti
4f359646f1 nb iot files and modifications and not tested 2017-05-23 12:30:46 +02:00
Michele Paffetti
a60ea61bbd Draft on RRC Spec. 2017-05-23 12:27:36 +02:00
Michele Paffetti
4ec59fbf27 Add new directory for RRC documentation 2017-05-23 12:27:36 +02:00
247 changed files with 84686 additions and 9356 deletions

24
Develop-Records.txt Normal file
View File

@@ -0,0 +1,24 @@
Develop_nb_iot_RRC Records
2017_05_16
*for the moment all the interfaces are in L2_interface_nb_iot.c
*pdcp_primitives.c --> pdcp_serialize_user_plane_data_pdu_with_short_sn_buffer (new function) --> used in NB_pdcp_data_req interface
included also in the proper header file pdcp_primitives.h
*management of SecurityModeFailure message (rrc_eNB_nb_iot.c) --> we call the NB_rrc_pdcp_config_asn1_req with a particular case for securityMode =-1;
modify NB_rrc_pdcp_config_asn1_req function in L2_interface_nb_iot.c
modify pdcp_config_set_security this particular case "else if(security_modeP == -1)"
*modified rrc_eNB_process_RRCConnectionReconfigurationComplete_NB function ---> DRBs are never deleted and ue_cuontext_pP->ue_context.DRB_active[drb_id] == 1 called only once
*modified rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB--> no need of qci switch case since only RLC-AM mode in NB-IoT (no GBR)
*LCHAN_DESC Lchan_desc[2] --> old structure and is mainly a "good practice" but non used anymore so deleted from the rrc_eNB_nb_iot.c file
*update picures in DOC/RRC_images for NB-IoT protocol stack and signalling

View File

@@ -0,0 +1,392 @@
#!/bin/groovy
/*
* 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
*/
// Location of the executor node
def nodeExecutor = params.nodeExecutor
pipeline {
agent {
label nodeExecutor
}
options {
disableConcurrentBuilds()
timestamps()
gitLabConnection('OAI GitLab')
gitlabBuilds(builds: ["Build eNb-USRP", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck"])
ansiColor('xterm')
}
stages {
stage ("Verify Parameters") {
steps {
script {
JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
def allParametersPresent = true
}
}
}
stage ("Verify Guidelines") {
steps {
echo "Git URL is ${GIT_URL}"
echo "GitLab Act is ${env.gitlabActionType}"
script {
if ("MERGE".equals(env.gitlabActionType)) {
// since a bit, in push events, gitlabUserEmail is not populated
gitCommitAuthorEmailAddr = env.gitlabUserEmail
echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}"
// GitLab-Jenkins plugin integration is lacking to perform the merge by itself
// Doing it manually --> it may have merge conflicts
sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
sh "zip -r -qq localZip.zip ."
// Running astyle options on the list of modified files by the merge request
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
sh "./ci-scripts/checkCodingFormattingRules.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}"
def res=readFile('./oai_rules_result.txt').trim();
if ("0".equals(res)) {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): All Changed files in Merge Request follow OAI Formatting Rules"
addGitLabMRComment comment: message
} else {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some Changed files in Merge Request DO NOT follow OAI Formatting Rules"
addGitLabMRComment comment: message
}
} else {
echo "Git Branch is ${GIT_BRANCH}"
echo "Git Commit is ${GIT_COMMIT}"
// since a bit, in push events, gitlabUserEmail is not populated
gitCommitAuthorEmailAddr = sh returnStdout: true, script: 'git log -n1 --pretty=format:%ae ${GIT_COMMIT}'
gitCommitAuthorEmailAddr = gitCommitAuthorEmailAddr.trim()
echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}"
sh "git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG"
sh "zip -r -qq localZip.zip ."
// Running astyle options on all C/H files in the repository
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
sh "./ci-scripts/checkCodingFormattingRules.sh"
}
}
}
post {
failure {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
addGitLabMRComment comment: message
currentBuild.result = 'FAILURE'
}
}
}
}
stage ("Start VM -- enb-usrp") {
steps {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
stage ("Start VM -- enb-ethernet") {
steps {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
stage ("Start VM -- ue-ethernet") {
steps {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
stage ("Start VM -- phy-sim") {
steps {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
stage ("Start VM -- cppcheck") {
steps {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
stage ("Variant Builds") {
parallel {
stage ("Analysis with cppcheck") {
steps {
gitlabCommitStatus(name: "Analysis with cppcheck") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
}
stage ("Build eNb-USRP") {
steps {
gitlabCommitStatus(name: "Build eNb-USRP") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
}
stage ("Build eNb-ethernet") {
steps {
gitlabCommitStatus(name: "Build eNb-ethernet") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
}
stage ("Build UE-ethernet") {
steps {
gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
}
stage ("Build physical simulators") {
steps {
gitlabCommitStatus(name: "Build phy-sim") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
}
}
post {
failure {
script {
currentBuild.result = 'FAILURE'
}
}
always {
script {
dir ('archives') {
sh "zip -r -qq vm_build_logs.zip enb_usrp phy_sim enb_eth ue_eth cppcheck"
}
if(fileExists('archives/vm_build_logs.zip')) {
archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
}
if ("MERGE".equals(env.gitlabActionType)) {
sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
} else {
sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
}
if(fileExists('build_results.html')) {
sh "sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' build_results.html"
archiveArtifacts artifacts: 'build_results.html'
}
}
}
}
}
stage ("Variant Tests") {
parallel {
stage ("VM-based tests") {
stages {
stage ("Test physical simulators") {
steps {
script {
timeout (time: 20, unit: 'MINUTES') {
try {
gitlabCommitStatus(name: "Test phy-sim") {
sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
} catch (Exception e) {
currentBuild.result = 'FAILURE'
}
}
}
}
}
stage ("Destroy all Virtual Machines") {
steps {
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
}
stage ("Test MONOLITHIC - FDD - Band 7 - B210") {
steps {
script {
//triggerSlaveJob ('eNB-CI-FDD-Band7-B210', 'Test-Mono-FDD-Band7')
echo "Bypassed for the moment"
}
}
post {
always {
script {
//finalizeSlaveJob('eNB-CI-FDD-Band7-B210')
echo "Bypassed for the moment"
}
}
failure {
script {
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
script {
dir ('archives') {
sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi"
}
if(fileExists('archives/vm_tests_logs.zip')) {
archiveArtifacts artifacts: 'archives/vm_tests_logs.zip'
if ("MERGE".equals(env.gitlabActionType)) {
sh "./ci-scripts/oai-ci-vm-tool report-test --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
} else {
sh "./ci-scripts/oai-ci-vm-tool report-test --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
}
if(fileExists('test_simulator_results.html')) {
sh "sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_simulator_results.html"
archiveArtifacts artifacts: 'test_simulator_results.html'
}
}
}
}
}
}
}
post {
always {
script {
// Stage destroy may not be run if error in previous stage
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
emailext attachmentsPattern: '*results*.html',
body: '''Hi,
Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
Regards,
OAI CI Team''',
replyTo: 'no-reply@openairinterface.org',
subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!',
to: gitCommitAuthorEmailAddr
if (fileExists('.git/CI_COMMIT_MSG')) {
sh "rm -f .git/CI_COMMIT_MSG"
}
}
}
success {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")"
if ("MERGE".equals(env.gitlabActionType)) {
echo "This is a MERGE event"
addGitLabMRComment comment: message
}
}
}
failure {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")"
if ("MERGE".equals(env.gitlabActionType)) {
echo "This is a MERGE event"
addGitLabMRComment comment: message
}
}
}
}
}
// ---- Slave Job functions
def triggerSlaveJob (jobName, gitlabStatusName) {
if ("MERGE".equals(env.gitlabActionType)) {
gitlabCommitStatus(name: gitlabStatusName) {
build job: jobName,
parameters: [
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
booleanParam(name: 'eNB_mergeRequest', value: true),
string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch))
]
}
} else {
gitlabCommitStatus(name: gitlabStatusName) {
build job: jobName,
parameters: [
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
booleanParam(name: 'eNB_mergeRequest', value: false)
]
}
}
}
def triggerSlaveJobNoGitLab (jobName) {
if ("MERGE".equals(env.gitlabActionType)) {
build job: jobName,
parameters: [
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
booleanParam(name: 'eNB_mergeRequest', value: true),
string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch))
]
} else {
build job: jobName,
parameters: [
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
booleanParam(name: 'eNB_mergeRequest', value: false)
]
}
}
def finalizeSlaveJob(jobName) {
// In case of any non-success, we are retrieving the HTML report of the last completed
// slave job. The only drop-back is that we may retrieve the HTML report of a previous build
fileName = "test_results-${jobName}.html"
if (!fileExists(fileName)) {
copyArtifacts(projectName: jobName,
filter: 'test_results*.html',
selector: lastCompleted())
if (fileExists(fileName)) {
sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}"
archiveArtifacts artifacts: fileName
}
}
}

View File

@@ -273,6 +273,8 @@ endif (${ENABLE_ITTI})
# New C code source file, cmake must be re-run (instead of re-running make only)
#############
set(asn1_generated_dir ${OPENAIR_BIN_DIR})
# set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1")
# set(asn1_generated_dir ${OPENAIR_BIN_DIR})
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
@@ -317,19 +319,29 @@ if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/LTE_asn_constant.h)
add_custom_target (
rrc_flag ALL
${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
DEPENDS ${RRC_GRAMMAR}
)
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
add_library(RRC_LIB ${rrc_source}
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c)
${OPENAIR2_DIR}/RRC/NBIOT/MESSAGES/asn1_msg_NB_IoT.c)
add_dependencies(RRC_LIB rrc_flag)
include_directories ("${RRC_FULL_DIR}")
add_custom_command (
OUTPUT ${RRC_FULL_DIR}/LTE_asn1_constant.h
COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}
COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
DEPENDS ${RRC_GRAMMAR}
)
# S1AP
# Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time
@@ -374,6 +386,16 @@ if (NOT ${ret} STREQUAL 0)
endif (NOT ${ret} STREQUAL 0)
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
set(S1AP_OAI_generated
${S1AP_C_DIR}/s1ap_decoder.c
${S1AP_C_DIR}/s1ap_encoder.c
${S1AP_C_DIR}/s1ap_xer_print.c
${S1AP_C_DIR}/s1ap_compare.c
${S1AP_C_DIR}/s1ap_ies_defs.h
)
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
set(s1ap_h ${s1ap_h} )
add_custom_target (
s1ap_flag ALL
${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
@@ -637,6 +659,12 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
################################################################
# NB-IOT
################################################################
add_boolean_option(NB_IOT True "Enabling NB-IoT code")
########################
# Include order
##########################
@@ -1077,6 +1105,15 @@ set(SCHED_SRC_UE
add_library(SCHED_UE_LIB ${SCHED_SRC_UE})
add_dependencies(SCHED_UE_LIB rrc_flag)
set(SCHED_SRC_NBIOT
${OPENAIR1_DIR}/SCHED_NBIOT/phy_procedures_lte_eNb_NB_IoT.c
${OPENAIR1_DIR}/SCHED_NBIOT/phy_procedures_lte_common_NB_IoT.c
${OPENAIR1_DIR}/SCHED_NBIOT/IF_Module_L1_primitives_NB_IoT.c
${OPENAIR1_DIR}/SCHED_NBIOT/pusch_pc_NB_IoT.c
)
add_library(SCHED_NBIOT_LIB ${SCHED_SRC_NBIOT})
add_dependencies(SCHED_NBIOT_LIB rrc_flag)
# nFAPI
#################################
set(NFAPI_COMMON_SRC
@@ -1130,8 +1167,40 @@ add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
add_dependencies(NFAPI_USER_LIB rrc_flag)
include_directories(${NFAPI_USER_DIR})
# Layer 1
#############################
# NBIOT
set(PHY_SRC_NBIOT
# depend on code generation from asn1c
${RRC_FULL_DIR}/LTE_asn_constant.h
# actual source
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/npss_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/nsss_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/pilots_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dlsch_coding_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dlsch_modulation_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dlsch_demodulation_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dlsch_scrambling_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dci_tools_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/uci_tools_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/lte_mcs_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/lte_Isc_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/npbch_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/SIB_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dci_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/nprach_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/group_hopping_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/ulsch_demodulation_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/ulsch_decoding_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_ESTIMATION/freq_equalization_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_ESTIMATION/lte_sync_time_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_ESTIMATION/lte_sync_timefreq_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_ESTIMATION/lte_adjust_sync_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_ESTIMATION/lte_ul_channel_estimation_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_REFSIG/lte_dl_cell_spec_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_REFSIG/lte_gold_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_REFSIG/lte_ul_ref_NB_IoT.c
)
set(PHY_TURBOSRC
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte.c
@@ -1165,16 +1234,22 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c
${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
${OPENAIR1_DIR}/PHY/CODING/lte_segmentation_NB_IoT.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_NB_IoT.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
${OPENAIR1_DIR}/PHY/CODING/crc_byte_NB_IoT.c
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching_NB_IoT.c
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte_NB_IoT.c
${OPENAIR1_DIR}/PHY/INIT/lte_init_NB_IoT.c
${PHY_TURBOIF}
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
@@ -1296,6 +1371,8 @@ add_library(PHY_UE ${PHY_SRC_UE})
add_dependencies(PHY_UE rrc_flag)
add_library(PHY_RU ${PHY_SRC_RU})
add_dependencies(PHY_RU rrc_flag)
add_library(PHY_NBIOT ${PHY_SRC_NBIOT})
add_dependencies(PHY_NBIOT rrc_flag)
#Library for mex functions
#########################3
@@ -1328,11 +1405,25 @@ add_library(PHY_MEX ${PHY_MEX_UE})
set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC)
set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE)
set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC)
set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE)
set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0)
set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0)
set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0)
set(RRC_DIR ${OPENAIR2_DIR}/RRC/LTE)
set(RRC_NBIOT_DIR ${OPENAIR2_DIR}/RRC/NBIOT)
set(PDCP_DIR ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0)
#NBIOT
set(L2_SRC_NBIOT
${PHY_INTERFACE_DIR}/IF_Module_NB_IoT.c
${PHY_INTERFACE_DIR}/IF_Module_L2_primitives_NB_IoT.c
${RRC_NBIOT_DIR}/rrc_eNB_NB_IoT.c
${RRC_NBIOT_DIR}/rrc_eNB_UE_context_NB_IoT.c
${RRC_NBIOT_DIR}/rrc_common_NB_IoT.c
#${RRC_NBIOT_DIR}/L2_interface_NB_IoT.c
)
set(L2_SRC
${OPENAIR2_DIR}/LAYER2/openair2_proc.c
${PDCP_DIR}/pdcp.c
@@ -1369,7 +1460,6 @@ set(L2_SRC
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
# ${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_eNB.c
${RRC_DIR}/rrc_eNB_S1AP.c
${RRC_DIR}/rrc_eNB_UE_context.c
@@ -1420,6 +1510,21 @@ set(L2_SRC_UE
${RRC_DIR}/L2_interface_ue.c
)
#NBIOT
set (MAC_SRC_NBIOT
${MAC_DIR}/main_NB_IoT.c
${MAC_DIR}/eNB_scheduler_NB_IoT.c
${MAC_DIR}/eNB_scheduler_dlsch_NB_IoT.c
${MAC_DIR}/eNB_scheduler_ulsch_NB_IoT.c
${MAC_DIR}/eNB_scheduler_bch_NB_IoT.c
${MAC_DIR}/output_handler_NB_IoT.c
${MAC_DIR}/eNB_scheduler_RA_NB_IoT.c
${MAC_DIR}/config_NB_IoT.c
${MAC_DIR}/schedule_tool_NB_IoT.c
)
set (MAC_SRC
#${PHY_INTERFACE_DIR}/phy_stub_UE.c
${PHY_INTERFACE_DIR}/IF_Module.c
@@ -1459,12 +1564,17 @@ set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_config.c
${OPENAIR2_DIR}/ENB_APP/enb_config_SL.c
${OPENAIR2_DIR}/ENB_APP/enb_config_eMTC.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_config.c
${OPENAIR2_DIR}/ENB_APP/RRC_config_tools.c
)
add_library(L2
${L2_SRC}
${MAC_SRC}
${L2_SRC_NBIOT}
${MAC_SRC_NBIOT}
${ENB_APP_SRC})
# ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)
add_dependencies(L2 rrc_flag s1ap_flag x2_flag)
@@ -1772,12 +1882,6 @@ if(NAS_UE)
endif()
# nbiot
add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16")
set (NBIOT_SOURCES
${OPENAIR2_DIR}/ENB_APP/NB_IoT_config.c
)
add_library(NB_IoT MODULE ${NBIOT_SOURCES} )
# shared library loader
set (SHLIB_LOADER_SOURCES
@@ -2036,6 +2140,7 @@ add_definitions(-DASN1_MINIMUM_VERSION=924)
add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-enb-nbiot.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/ru_control.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
@@ -2062,11 +2167,13 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag)
target_link_libraries (lte-softmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_NBIOT_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_NBIOT PHY_RU LFDS L2
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
add_executable(cu_test
${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c
${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
@@ -2180,7 +2287,7 @@ add_executable(dlsim_tm4
${T_SOURCE}
)
target_link_libraries (dlsim_tm4
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_NBIOT_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${T_LIB}
)
@@ -2196,7 +2303,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
)
target_link_libraries (${myExe}
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_NBIOT_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
endforeach(myExe)
@@ -2205,12 +2312,13 @@ add_executable(test_epc_generate_scenario
${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.c
${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.h
${OPENAIR2_DIR}/ENB_APP/enb_config.h
${OPENAIR2_DIR}/ENB_APP/NB_IoT_config.h
${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
)
target_link_libraries (test_epc_generate_scenario
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_NBIOT_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
add_executable(test_epc_play_scenario
@@ -2229,7 +2337,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_NBIOT_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
@@ -2269,7 +2377,7 @@ if (${T_TRACER})
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
oai_eth_transpro
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
SECU_CN SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY L2 default_sched
SECU_CN SCHED_LIB SCHED_NBIOT_LIB SCHED_RU_LIB SCHED_UE_LIB PHY L2 default_sched
remote_sched RAL CN_UTILS GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS
LFDS7 SIMU OPENAIR0_LIB PHY_MEX coding)
if (TARGET ${i})
@@ -2282,6 +2390,45 @@ endif (${T_TRACER})
# Generated specific cases is not regular code
###############################################
##################""
# itti symbolic debug print require to generate a specific include file
########################################
# retrieve the compiler options to send it to gccxml
get_directory_property( DirDefs COMPILE_DEFINITIONS )
foreach( d ${DirDefs} )
list(APPEND itti_compiler_options "-D${d}")
endforeach()
get_directory_property( DirDefs INCLUDE_DIRECTORIES )
foreach( d ${DirDefs} )
list(APPEND itti_compiler_options "-I${d}")
endforeach()
# castxml doesn't work with c11 (gcc 5 default)
# force castxml and clang compilation with gnu89 standard
# we can't use cXX standard as pthread_rwlock_t is gnu standard
list(APPEND itti_compiler_options "-std=gnu89")
set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h)
if(EXISTS /usr/bin/gccxml)
set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H})
else()
set(xml_command castxml --castxml-gccxml ${itti_compiler_options} ${ITTI_H} -o ${OPENAIR_BIN_DIR}/messages.xml)
endif()
add_custom_command (
OUTPUT ${OPENAIR_BIN_DIR}/messages.xml
COMMAND ${xml_command}
DEPENDS ${S1AP_OAI_generated} ${RRC_FULL_DIR}/LTE_asn_constant.h
)
add_custom_command (
OUTPUT ${OPENAIR_BIN_DIR}/messages_xml.h
COMMAND sed -e 's/ *//' -e 's/\"/\\\\\"/g' -e 's/^/\"/' -e 's/$$/\\\\n\"/' ${OPENAIR_BIN_DIR}/messages.xml > ${OPENAIR_BIN_DIR}/messages_xml.h
DEPENDS ${OPENAIR_BIN_DIR}/messages.xml ${RRC_FULL_DIR}/LTE_asn_constant.h
)
################
# Kernel modules
###############

View File

@@ -0,0 +1,92 @@
cmake_minimum_required(VERSION 2.8)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
set ( EMOS False )
set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME False )
set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False)
set ( ENABLE_VCD_FIFO False )
set ( ENB_MODE True )
set ( EXMIMO_IOT True )
set ( HARD_RT False )
set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False)
set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD 1 )
set ( DEADLINE_SCHEDULER False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False )
set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
set ( MESSAGE_CHART_GENERATOR_PHY False )
set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX True )
set ( NAS_BUILT_IN_UE False)
set ( NAS_MME False )
set ( NAS_UE False )
set ( NB_ANTENNAS_RX "2" )
set ( NB_ANTENNAS_TX "2" )
set ( NB_ANTENNAS_TXRX "2" )
set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU True )
set ( OAISIM True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK True )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
set ( OPENAIR_EMU False )
set ( OPENAIR_LTE True )
set ( PACKAGE_NAME "oaisim" )
set ( PBS_SIM False )
set ( PDCP_USE_NETLINK True )
set ( PC_DSP True )
set ( PC_TARGET True )
set ( PDCP_MSG_PRINT False )
set ( PERFECT_CE False )
set ( PHY_ABSTRACTION True )
set ( PHY_CONTEXT False )
set ( PHY_EMUL False )
set ( PHYSIM True )
set ( PUCCH True )
set ( RANDOM_BF False )
set ( RF_BOARD "False" )
set ( RRC_ASN1_VERSION "Rel10" )
set ( RLC_STOP_ON_LOST_PDU False )
set ( RRC_MSG_PRINT False )
set ( RTAI False )
set ( SECU False )
set ( SMBV False )
set ( SPECTRA False )
set ( TEST_OMG False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME "R10" )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( DEBUG_PHY False )
set ( DEBUG_PHY_PROC False)
set ( DEBUG_DLSCH False)
set ( CMAKE_BUILD_TYPE )
set ( CFLAGS_PROCESSOR_USER "" )
set ( XFORMS True )
set ( PRINT_STATS True )
set ( RRC_ASN1_VERSION "Rel14")
set ( ENABLE_VCD_FIFO False )
set ( T_TRACER False )
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)

4
common/ran_context.h Normal file → Executable file
View File

@@ -52,7 +52,7 @@
#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LTE/defs_NB_IoT.h"
#include "RRC/NBIOT/defs_NB_IoT.h"
@@ -88,7 +88,7 @@ typedef struct {
/// RRC context variables
struct eNB_RRC_INST_s **rrc;
/// NB_IoT RRC context variables
//struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc;
struct eNB_RRC_INST_NB_IoT_s **nbiotrrc;
/// MAC context variables
struct eNB_MAC_INST_s **mac;
/// NB_IoT MAC context variables

View File

@@ -370,6 +370,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_N(c, x...) /* */
# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
@@ -387,6 +388,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_E(c, x...) /* */
# define LOG_D(c, x...) /* */
# define LOG_T(c, x...) /* */
# define LOG_N(c, x...) /* */
# define LOG_DUMPMSG(c, b, s, x...) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)

View File

@@ -314,13 +314,13 @@ hashtable_rc_t hashtable_get(const hash_table_t *const hashtblP, const hash_key_
hash_node_t *node = NULL;
hash_size_t hash = 0;
if (hashtblP == NULL) {
*dataP = NULL;
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
}
hash=hashtblP->hashfunc(keyP)%hashtblP->size;
/* fprintf(stderr, "hashtable_get() key=%s, hash=%d\n", key, hash);*/
node=hashtblP->nodes[hash];
while(node) {

View File

@@ -146,7 +146,8 @@ typedef enum {
NFAPI_LBT_DL_INDICATION,
NFAPI_NB_HARQ_INDICATION,
NFAPI_NRACH_INDICATION,
NFAPI_UE_RELEASE_REQUEST,
NFAPI_UE_RELEASE_RESPONSE,
NFAPI_PNF_PARAM_REQUEST = 0x0100,
NFAPI_PNF_PARAM_RESPONSE,
NFAPI_PNF_CONFIG_REQUEST,
@@ -2392,6 +2393,18 @@ typedef struct {
} nfapi_tx_request_body_t;
#define NFAPI_TX_REQUEST_BODY_TAG 0x2022
#define NFAPI_RELEASE_MAX_RNTI 256
typedef struct {
uint32_t handle;
uint16_t rnti;
} nfapi_ue_release_request_TLVs_t;
typedef struct {
nfapi_tl_t tl;
uint16_t number_of_TLVs;
nfapi_ue_release_request_TLVs_t ue_release_request_TLVs_list[NFAPI_RELEASE_MAX_RNTI];
} nfapi_ue_release_request_body_t;
#define NFAPI_UE_RELEASE_BODY_TAG 0x2068
// P7 Message Structures
typedef struct {
nfapi_p7_message_header_t header;
@@ -3418,6 +3431,19 @@ typedef struct {
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_error_indication_t;
typedef struct {
nfapi_p7_message_header_t header;
uint16_t sfn_sf;
nfapi_ue_release_request_body_t ue_release_request_body;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_ue_release_request_t;
typedef struct {
nfapi_p7_message_header_t header;
uint32_t error_code;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_ue_release_response_t;
//
// P4 Messages
//

View File

@@ -963,6 +963,8 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
switch (crc_type) {
case CRC24_A:
crc_len=3;
break;
case CRC24_B:
crc_len=3;
break;

View File

@@ -0,0 +1,210 @@
/*
* 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.0 (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
*/
unsigned short f1f2mat_old[2*188] = {3, 10,
7, 12,
19, 42,
7, 16,
7, 18,
11, 20,
5, 22,
11, 24,
7, 26,
41, 84,
103, 90,
15, 32,
9, 34,
17, 108,
9, 38,
21, 120,
101, 84,
21, 44,
57, 46,
23, 48,
13, 50,
27, 52,
11, 36,
27, 56,
85, 58,
29, 60,
33, 62,
15, 32,
17, 198,
33, 68,
103, 210,
19, 36,
19, 74,
37, 76,
19, 78,
21, 120,
21, 82,
115, 84,
193, 86,
21, 44,
133, 90,
81, 46,
45, 94,
23, 48,
243, 98,
151, 40,
155, 102,
25, 52,
51, 106,
47, 72,
91, 110,
29, 168,
29, 114,
247, 58,
29, 118,
89, 180,
91, 122,
157, 62,
55, 84,
31, 64,
17, 66,
35, 68,
227, 420,
65, 96,
19, 74,
37, 76,
41, 234,
39, 80,
185, 82,
43, 252,
21, 86,
155, 44,
79, 120,
139, 92,
23, 94,
217, 48,
25, 98,
17, 80,
127, 102,
25, 52,
239, 106,
17, 48,
137, 110,
215, 112,
29, 114,
15, 58,
147, 118,
29, 60,
59, 122,
65, 124,
55, 84,
31, 64,
17, 66,
171, 204,
67, 140,
35, 72,
19, 74,
39, 76,
19, 78,
199, 240,
21, 82,
211, 252,
21, 86,
43, 88,
149, 60,
45, 92,
49, 846,
71, 48,
13, 28,
17, 80,
25, 102,
183, 104,
55, 954,
127, 96,
27, 110,
29, 112,
29, 114,
57, 116,
45, 354,
31, 120,
59, 610,
185, 124,
113, 420,
31, 64,
17, 66,
171, 136,
209, 420,
253, 216,
367, 444,
265, 456,
181, 468,
39, 80,
27, 164,
127, 504,
143, 172,
43, 88,
29, 300,
45, 92,
157, 188,
47, 96,
13, 28,
111, 240,
443, 204,
51, 104,
51, 212,
451, 192,
257, 220,
57, 336,
313, 228,
271, 232,
179, 236,
331, 120,
363, 244,
375, 248,
127, 168,
31, 64,
33, 130,
43, 264,
33, 134,
477, 408,
35, 138,
233, 280,
357, 142,
337, 480,
37, 146,
71, 444,
71, 120,
37, 152,
39, 462,
127, 234,
39, 158,
39, 80,
31, 96,
113, 902,
41, 166,
251, 336,
43, 170,
21, 86,
43, 174,
45, 176,
45, 178,
161, 120,
89, 182,
323, 184,
47, 186,
23, 94,
47, 190,
263, 480
};

View File

@@ -9,7 +9,7 @@ OPENAIR3 = $(OPENAIR3_DIR)
CFLAGS += -DNODE_RG -DNO_UL_REF -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DOPENAIR_LTE -DMAX_NUM_CCs=1
ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/NBIOT/MESSAGES
ifdef LLR8
CFLAGS += -DLLR8
@@ -24,7 +24,7 @@ include $(TOP_DIR)/PHY/Makefile.inc
SCHED_OBJS = $(TOP_DIR)/SCHED/phy_procedures_lte_common.o
include $(TOP_DIR)/SIMULATION/Makefile.inc
include $(TOP_DIR)/../openair2/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NBIOT/MESSAGES/Makefile.inc
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc

View File

@@ -0,0 +1,159 @@
/*
* 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.0 (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/LTE_CODING/ccoding_byte_NB_IoT.c
* \Fucntions for CRC attachment and tail-biting convolutional coding for NPBCH channel, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include "PHY/CODING/defs_NB_IoT.h"
unsigned char ccodelte_table_NB_IoT[128]; // for transmitter
unsigned short glte_NB_IoT[] = { 0133, 0171, 0165 }; // {A,B} //renaimed but is exactly the same as the one in the old implementation
/*************************************************************************
Encodes for an arbitrary convolutional code of rate 1/3
with a constraint length of 7 bits.
The inputs are bit packed in octets (from MSB to LSB).
An optional 8-bit CRC (3GPP) can be added.
Trellis tail-biting is included here
*************************************************************************/
void ccode_encode_NB_IoT (int32_t numbits,
uint8_t add_crc,
uint8_t *inPtr,
uint8_t *outPtr,
uint16_t rnti)
{
uint32_t state;
uint8_t c, out, first_bit;
int8_t shiftbit=0;
uint16_t c16;
uint16_t next_last_byte=0;
uint32_t crc=0;
/* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */
state = 0;
if (add_crc == 2) {
crc = crc16_NB_IoT(inPtr,numbits); // crc is 2 bytes
// scramble with RNTI
crc ^= (((uint32_t)rnti)<<16); // XOR with crc
first_bit = 2;
c = (uint8_t)((crc>>16)&0xff);
} else {
next_last_byte = numbits>>3;
first_bit = (numbits-6)&7;
c = inPtr[next_last_byte-1];
}
// Perform Tail-biting
// get bits from last byte of input (or crc)
for (shiftbit = 0 ; shiftbit <(8-first_bit) ; shiftbit++) {
if ((c&(1<<(7-first_bit-shiftbit))) != 0)
state |= (1<<shiftbit);
}
state = state & 0x3f; // true initial state of Tail-biting CCode
state<<=1; // because of loop structure in CCode
while (numbits > 0) { // Tail-biting is applied to input bits , input 34 bits , output 102 bits
c = *inPtr++;
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodelte_table_NB_IoT[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
}
}
// now code 16-bit CRC for DCI // Tail-biting is applied to CRC bits , input 16 bits , output 48 bits
if (add_crc == 2) {
c16 = (uint16_t)(crc>>16);
for (shiftbit = 15; (shiftbit>=0); shiftbit--) {
state >>= 1;
if ((c16&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodelte_table_NB_IoT[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
}
}
}
/*************************************************************************
Functions to initialize the code tables
*************************************************************************/
/* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */
void ccodelte_init_NB_IoT(void)
{
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
ccodelte_table_NB_IoT[i] = 0;
/* Compute 3 output bits */
for (j = 0; j < 3; j++) {
sum = 0;
for (k = 0; k < 7; k++)
if ((i & glte_NB_IoT[j]) & (1 << k))
sum++;
/* Write the sum modulo 2 in bit j */
ccodelte_table_NB_IoT[i] |= (sum & 1) << j;
}
}
}

View File

@@ -0,0 +1,211 @@
/*
* 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.0 (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: crc_byte.c
purpose: generate 3GPP LTE CRCs. Byte-oriented implementation of CRC's
author: raymond.knopp@eurecom.fr, matthieu.kanj@b-com.com
date: 07/2017
*/
#ifndef USER_MODE
#define __NO_VERSION__
#endif
//#include "PHY/types.h"
//#include "defs.h" // to delete in final code version
#include "PHY/CODING/defs_NB_IoT.h" //
/*ref 36-212 v8.6.0 , pp 8-9 */
/* the highest degree is set by default */
unsigned int poly24a_NB_IoT = 0x864cfb00; //1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
unsigned int poly24b_NB_IoT = 0x80006300; // 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1
unsigned int poly16_NB_IoT = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
unsigned int poly12_NB_IoT = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
unsigned int poly8_NB_IoT = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
/*********************************************************
For initialization && verification purposes,
bit by bit implementation with any polynomial
The first bit is in the MSB of each byte
*********************************************************/
unsigned int crcbit_NB_IoT (unsigned char * inputptr, int octetlen, unsigned int poly)
{
unsigned int i, crc = 0, c;
while (octetlen-- > 0) {
c = (*inputptr++) << 24;
for (i = 8; i != 0; i--) {
if ((1 << 31) & (c ^ crc))
crc = (crc << 1) ^ poly;
else
crc <<= 1;
c <<= 1;
}
}
return crc;
}
/*********************************************************
crc table initialization
*********************************************************/
static unsigned int crc24aTable_NB_IoT[256];
static unsigned int crc24bTable_NB_IoT[256];
static unsigned short crc16Table_NB_IoT[256];
static unsigned short crc12Table_NB_IoT[256];
static unsigned char crc8Table_NB_IoT[256];
void crcTableInit_NB_IoT (void)
{
unsigned char c = 0;
do {
crc24aTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24a_NB_IoT);
crc24bTable_NB_IoT[c] = crcbit_NB_IoT (&c, 1, poly24b_NB_IoT);
crc16Table_NB_IoT[c] = (unsigned short) (crcbit_NB_IoT (&c, 1, poly16_NB_IoT) >> 16);
crc12Table_NB_IoT[c] = (unsigned short) (crcbit_NB_IoT (&c, 1, poly12_NB_IoT) >> 16);
crc8Table_NB_IoT[c] = (unsigned char) (crcbit_NB_IoT (&c, 1, poly8_NB_IoT) >> 24);
} while (++c);
}
/*********************************************************
Byte by byte implementations,
assuming initial byte is 0 padded (in MSB) if necessary
*********************************************************/
unsigned int crc24a_NB_IoT (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = (crc << 8) ^ crc24aTable_NB_IoT[(*inptr++) ^ (crc >> 24)];
}
if (resbit > 0)
crc = (crc << resbit) ^ crc24aTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc;
}
unsigned int crc24b_NB_IoT (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = (crc << 8) ^ crc24bTable_NB_IoT[(*inptr++) ^ (crc >> 24)];
}
if (resbit > 0)
crc = (crc << resbit) ^ crc24bTable_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc;
}
unsigned int crc16_NB_IoT (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = (crc << 8) ^ (crc16Table_NB_IoT[(*inptr++) ^ (crc >> 24)] << 16);
}
if (resbit > 0)
crc = (crc << resbit) ^ (crc16Table_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
return crc;
}
unsigned int crc8_NB_IoT (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = crc8Table_NB_IoT[(*inptr++) ^ (crc >> 24)] << 24;
}
if (resbit > 0)
crc = (crc << resbit) ^ (crc8Table_NB_IoT[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24);
return crc;
}
//#ifdef DEBUG_CRC
/*******************************************************************/
/**
Test code
********************************************************************/
// #include <stdio.h>
// main()
// {
// unsigned char test[] = "Thebigredfox";
// crcTableInit();
// printf("%x\n", crcbit(test, sizeof(test) - 1, poly24));
// printf("%x\n", crc24(test, (sizeof(test) - 1)*8));
// printf("%x\n", crcbit(test, sizeof(test) - 1, poly8));
// printf("%x\n", crc8(test, (sizeof(test) - 1)*8));
// }
//#endif

View File

@@ -3,7 +3,9 @@
* 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
*
@@ -92,6 +94,10 @@ void ccode_encode_NB_IoT (int32_t numbits,
\brief This function initializes the generator polynomials for an LTE convolutional code.*/
void ccodelte_init_NB_IoT(void);
void ccodelte_init2_NB_IoT(void);
/*!\fn void crcTableInit(void)
\brief This function initializes the different crc tables.*/
void crcTableInit_NB_IoT (void);

View File

@@ -0,0 +1,212 @@
/*
* 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.0 (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
*/
/*
unsigned short f1f2mat_old[2*188] = {3, 10,
7, 12,
19, 42,
7, 16,
7, 18,
11, 20,
5, 22,
11, 24,
7, 26,
41, 84,
103, 90,
15, 32,
9, 34,
17, 108,
9, 38,
21, 120,
101, 84,
21, 44,
57, 46,
23, 48,
13, 50,
27, 52,
11, 36,
27, 56,
85, 58,
29, 60,
33, 62,
15, 32,
17, 198,
33, 68,
103, 210,
19, 36,
19, 74,
37, 76,
19, 78,
21, 120,
21, 82,
115, 84,
193, 86,
21, 44,
133, 90,
81, 46,
45, 94,
23, 48,
243, 98,
151, 40,
155, 102,
25, 52,
51, 106,
47, 72,
91, 110,
29, 168,
29, 114,
247, 58,
29, 118,
89, 180,
91, 122,
157, 62,
55, 84,
31, 64,
17, 66,
35, 68,
227, 420,
65, 96,
19, 74,
37, 76,
41, 234,
39, 80,
185, 82,
43, 252,
21, 86,
155, 44,
79, 120,
139, 92,
23, 94,
217, 48,
25, 98,
17, 80,
127, 102,
25, 52,
239, 106,
17, 48,
137, 110,
215, 112,
29, 114,
15, 58,
147, 118,
29, 60,
59, 122,
65, 124,
55, 84,
31, 64,
17, 66,
171, 204,
67, 140,
35, 72,
19, 74,
39, 76,
19, 78,
199, 240,
21, 82,
211, 252,
21, 86,
43, 88,
149, 60,
45, 92,
49, 846,
71, 48,
13, 28,
17, 80,
25, 102,
183, 104,
55, 954,
127, 96,
27, 110,
29, 112,
29, 114,
57, 116,
45, 354,
31, 120,
59, 610,
185, 124,
113, 420,
31, 64,
17, 66,
171, 136,
209, 420,
253, 216,
367, 444,
265, 456,
181, 468,
39, 80,
27, 164,
127, 504,
143, 172,
43, 88,
29, 300,
45, 92,
157, 188,
47, 96,
13, 28,
111, 240,
443, 204,
51, 104,
51, 212,
451, 192,
257, 220,
57, 336,
313, 228,
271, 232,
179, 236,
331, 120,
363, 244,
375, 248,
127, 168,
31, 64,
33, 130,
43, 264,
33, 134,
477, 408,
35, 138,
233, 280,
357, 142,
337, 480,
37, 146,
71, 444,
71, 120,
37, 152,
39, 462,
127, 234,
39, 158,
39, 80,
31, 96,
113, 902,
41, 166,
251, 336,
43, 170,
21, 86,
43, 174,
45, 176,
45, 178,
161, 120,
89, 182,
323, 184,
47, 186,
23, 94,
47, 190,
263, 480
};
*/
extern unsigned short f1f2mat_old[2*188];

View File

@@ -0,0 +1,223 @@
/***********************************************************************
**********************************************************************/
/*! \file PHY/LTE_CODING/lte_rate_matching_NB_IoT.c
* \Procedures for rate matching/interleaving for NB-IoT (turbo-coded transport channels) (TX/RX), TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
/* // check if this ifdef MAIN is required for NB-IoT
#ifdef MAIN
#include <stdio.h>
#include <stdlib.h>
#endif
*/
//#include "PHY/CODING/defs_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h"
//#include "assertions.h"
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h" // does this file is needed ?
static uint32_t bitrev_cc_NB_IoT[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30};
uint32_t sub_block_interleaving_cc_NB_IoT(uint32_t D, uint8_t *d,uint8_t *w)
{
uint32_t RCC = (D>>5), ND, ND3; // D = 50 ,
uint32_t row,col,Kpi,index;
uint32_t index3,k;
if ((D&0x1f) > 0)
RCC++;
Kpi = (RCC<<5); // Kpi = 32
ND = Kpi - D;
ND3 = ND*3; // ND3 = ND*3 = 18 *3 = 54
k=0;
for (col=0; col<32; col++) {
index = bitrev_cc_NB_IoT[col];
index3 = 3*index;
for (row=0; row<RCC; row++) {
w[k] = d[(int32_t)index3-(int32_t)ND3];
w[Kpi+k] = d[(int32_t)index3-(int32_t)ND3+1];
w[(Kpi<<1)+k] = d[(int32_t)index3-(int32_t)ND3+2];
index3+=96;
index+=32;
k++;
}
}
return(RCC);
}
uint32_t lte_rate_matching_cc_NB_IoT(uint32_t RCC, // RRC = 2
uint16_t E, // E = 1600
uint8_t *w, // length
uint8_t *e) // length 1600
{
uint32_t ind=0,k;
uint16_t Kw = 3*(RCC<<5); // 3*64 = 192
for (k=0; k<E; k++) {
while(w[ind] == LTE_NULL_NB_IoT) {
ind++;
if (ind==Kw)
ind=0;
}
e[k] = w[ind];
ind++;
if (ind==Kw)
ind=0;
}
return(E);
}
//******************* below functions related to uplink transmission , to be reviwed *********
// this function should be adapted to NB-IoT , this deinterleaving is for LTE
void sub_block_deinterleaving_cc_NB_IoT(uint32_t D,int8_t *d,int8_t *w)
{
//WANG_Hao uint32_t RCC = (D>>5), ND, ND3;
uint32_t RCC = (D>>5);
ptrdiff_t ND, ND3;
uint32_t row,col,Kpi,index;
//WANG_Hao uint32_t index3,k;
ptrdiff_t index3;
uint32_t k;
if ((D&0x1f) > 0)
RCC++;
Kpi = (RCC<<5);
// Kpi3 = Kpi*3;
ND = Kpi - D;
ND3 = ND*3;
k=0;
for (col=0; col<32; col++) {
index = bitrev_cc_NB_IoT[col];
index3 = 3*index;
for (row=0; row<RCC; row++) {
d[index3-ND3] = w[k];
d[index3-ND3+1] = w[Kpi+k];
d[index3-ND3+2] = w[(Kpi<<1)+k];
index3+=96;
index+=32;
k++;
}
}
}
void lte_rate_matching_cc_rx_NB_IoT(uint32_t RCC,
uint16_t E,
int8_t *w,
uint8_t *dummy_w,
int8_t *soft_input)
{
uint32_t ind=0,k;
uint16_t Kw = 3*(RCC<<5);
uint32_t acc=1;
int16_t w16[Kw];
memset(w,0,Kw);
memset(w16,0,Kw*sizeof(int16_t));
for (k=0; k<E; k++) {
while(dummy_w[ind] == LTE_NULL_NB_IoT) {
ind++;
if (ind==Kw)
ind=0;
}
w16[ind] += soft_input[k];
ind++;
if (ind==Kw) {
ind=0;
acc++;
}
}
// rescale
for (ind=0; ind<Kw; ind++) {
// w16[ind]=(w16[ind]/acc);
if (w16[ind]>7)
w[ind]=7;
else if (w16[ind]<-8)
w[ind]=-8;
else
w[ind]=(int8_t)w16[ind];
}
}
uint32_t generate_dummy_w_cc_NB_IoT(uint32_t D, uint8_t *w)
{
uint32_t RCC = (D>>5), ND;
uint32_t col,Kpi,index;
int32_t k;
if ((D&0x1f) > 0)
RCC++;
Kpi = (RCC<<5);
// Kpi3 = Kpi*3;
ND = Kpi - D;
// copy d02 to dD2 (for mod Kpi operation from clause (4), p.16 of 36.212
k=0;
for (col=0; col<32; col++) {
index = bitrev_cc_NB_IoT[col];
if (index<ND) {
w[k] = LTE_NULL_NB_IoT;
w[Kpi+k] = LTE_NULL_NB_IoT;
w[(Kpi<<1)+k] = LTE_NULL_NB_IoT;
}
k+=RCC;
}
return(RCC);
}

View File

@@ -0,0 +1,152 @@
/*
* 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.0 (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: lte_segmentation.c
purpose: Procedures for transport block segmentation for LTE (turbo-coded transport channels)
author: raymond.knopp@eurecom.fr
date: 21.10.2009
*/
#include "PHY/defs_L1_NB_IoT.h"
#include "SCHED_NBIOT/sched_common_extern_NB_IoT.h"
//#define DEBUG_SEGMENTATION
int lte_segmentation_NB_IoT(unsigned char *input_buffer,
unsigned char **output_buffers,
unsigned int B,
unsigned int *C,
unsigned int *Cplus,
unsigned int *Cminus,
unsigned int *Kplus,
unsigned int *Kminus,
unsigned int *F)
{
unsigned int L,Bprime,Bprime_by_C,r,Kr,k,s,crc;
if (B<=6144) {
L=0;
*C=1;
Bprime=B;
} else {
L=24;
*C = B/(6144-L);
if ((6144-L)*(*C) < B)
*C=*C+1;
Bprime = B+((*C)*L);
}
if ((*C)>MAX_NUM_DLSCH_SEGMENTS_NB_IoT) {
LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
return(-1);
}
// Find K+
Bprime_by_C = Bprime/(*C);
if (Bprime_by_C <= 40) {
*Kplus = 40;
*Kminus = 0;
} else if (Bprime_by_C<=512) { // increase by 1 byte til here
*Kplus = (Bprime_by_C>>3)<<3;
*Kminus = Bprime_by_C-8;
} else if (Bprime_by_C <=1024) { // increase by 2 bytes til here
*Kplus = (Bprime_by_C>>4)<<4;
if (*Kplus < Bprime_by_C)
*Kplus = *Kplus + 16;
*Kminus = (*Kplus - 16);
} else if (Bprime_by_C <= 2048) { // increase by 4 bytes til here
*Kplus = (Bprime_by_C>>5)<<5;
if (*Kplus < Bprime_by_C)
*Kplus = *Kplus + 32;
*Kminus = (*Kplus - 32);
} else if (Bprime_by_C <=6144 ) { // increase by 8 bytes til here
*Kplus = (Bprime_by_C>>6)<<6;
if (*Kplus < Bprime_by_C)
*Kplus = *Kplus + 64;
*Kminus = (*Kplus - 64);
} else {
msg("lte_segmentation.c: Illegal codeword size !!!\n");
return(-1);
}
if (*C == 1) {
*Cplus = *C;
*Kminus = 0;
*Cminus = 0;
} else {
// printf("More than one segment (%d), exiting \n",*C);
// exit(-1);
*Cminus = ((*C)*(*Kplus) - (Bprime))/((*Kplus) - (*Kminus));
*Cplus = (*C) - (*Cminus);
}
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
if ((input_buffer) && (output_buffers)) {
for (k=0; k<*F>>3; k++) {
output_buffers[0][k] = 0;
}
s=0;
for (r=0; r<*C; r++) {
if (r<*Cminus)
Kr = *Kminus;
else
Kr = *Kplus;
while (k<((Kr - L)>>3)) {
output_buffers[r][k] = input_buffer[s];
// printf("encoding segment %d : byte %d (%d) => %d\n",r,k,Kr>>3,input_buffer[s]);
k++;
s++;
}
if (*C > 1) { // add CRC
crc = crc24b_NB_IoT(output_buffers[r],Kr-24)>>8;
output_buffers[r][(Kr-24)>>3] = ((uint8_t*)&crc)[2];
output_buffers[r][1+((Kr-24)>>3)] = ((uint8_t*)&crc)[1];
output_buffers[r][2+((Kr-24)>>3)] = ((uint8_t*)&crc)[0];
}
k=0;
}
}
return(0);
}

View File

@@ -0,0 +1,336 @@
/*
* 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.0 (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: viterbit_lte.c
purpose: SIMD optimized LTE Viterbi Decoder for rate 1/3 Tail-biting convolutional code. Performs two iterations
of code. First pass does Viterbi with all initial partial metrics set to zero. Second pass does Viterbi
with initial partial metrics set to values from final state values after first pass. Max is selected at
end to do trace-back.
author: raymond.knopp@eurecom.fr
date: 21.10.2009
*/
#ifdef USER_MODE
#include <stdio.h>
#endif
#ifndef TEST_DEBUG
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define msg printf
#endif
#include "PHY/sse_intrin.h"
//extern uint8_t ccodelte_table[128],ccodelte_table_rev[128];
static int8_t m0_table[64*16*16*16] __attribute__ ((aligned(16)));
static int8_t m1_table[64*16*16*16] __attribute__ ((aligned(16)));
void phy_viterbi_lte_sse2_NB_IoT(int8_t *y,uint8_t *decoded_bytes,uint16_t n)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i TB[4*8192];
__m128i *m0_ptr,*m1_ptr,*TB_ptr = &TB[0];
__m128i metrics0_15,metrics16_31,metrics32_47,metrics48_63,even0_30a,even0_30b,even32_62a,even32_62b,odd1_31a,odd1_31b,odd33_63a,odd33_63b,TBeven0_30,TBeven32_62,TBodd1_31,
TBodd33_63;
__m128i min_state,min_state2;
#elif defined(__arm__)
uint8x16x2_t TB[2*8192]; // 2 int8x16_t per input bit, 8 bits / byte, 8192 is largest packet size in bits
uint8x16_t even0_30a,even0_30b,even32_62a,even32_62b,odd1_31a,odd1_31b,odd33_63a,odd33_63b,TBeven0_30,TBeven32_62,TBodd1_31,TBodd33_63;
uint8x16x2_t metrics0_31,metrics32_63;
uint8x16_t min_state;
uint8x16_t *m0_ptr,*m1_ptr;
uint8x16x2_t *TB_ptr = &TB[0];
#endif
int8_t *in = y;
uint8_t prev_state0,maxm,s;
static uint8_t *TB_ptr2;
uint32_t table_offset;
uint8_t iter;
int16_t position;
// set initial metrics
//debug_msg("Doing viterbi\n");
#if defined(__x86_64__) || defined(__i386__)
metrics0_15 = _mm_setzero_si128();
metrics16_31 = _mm_setzero_si128();
metrics32_47 = _mm_setzero_si128();
metrics48_63 = _mm_setzero_si128();
#elif defined(__arm__)
metrics0_31.val[0] = vdupq_n_u8(0);
metrics0_31.val[1] = vdupq_n_u8(0);
metrics32_63.val[0] = vdupq_n_u8(0);
metrics32_63.val[1] = vdupq_n_u8(0);
#endif
for (iter=0; iter<2; iter++) {
in = y;
TB_ptr=&TB[0];
for (position=0; position<n; position++) {
// get branch metric offsets for the 64 states
table_offset = (in[0]+8 + ((in[1]+8)<<4) + ((in[2]+8)<<8))<<6;
#if defined(__x86_64__) || defined(__i386__)
m0_ptr = (__m128i *)&m0_table[table_offset];
m1_ptr = (__m128i *)&m1_table[table_offset];
// even states
even0_30a = _mm_adds_epu8(metrics0_15,m0_ptr[0]);
even32_62a = _mm_adds_epu8(metrics16_31,m0_ptr[1]);
even0_30b = _mm_adds_epu8(metrics32_47,m0_ptr[2]);
even32_62b = _mm_adds_epu8(metrics48_63,m0_ptr[3]);
// odd states
odd1_31a = _mm_adds_epu8(metrics0_15,m1_ptr[0]);
odd33_63a = _mm_adds_epu8(metrics16_31,m1_ptr[1]);
odd1_31b = _mm_adds_epu8(metrics32_47,m1_ptr[2]);
odd33_63b = _mm_adds_epu8(metrics48_63,m1_ptr[3]);
// select maxima
even0_30a = _mm_max_epu8(even0_30a,even0_30b);
even32_62a = _mm_max_epu8(even32_62a,even32_62b);
odd1_31a = _mm_max_epu8(odd1_31a,odd1_31b);
odd33_63a = _mm_max_epu8(odd33_63a,odd33_63b);
// Traceback information
TBeven0_30 = _mm_cmpeq_epi8(even0_30a,even0_30b);
TBeven32_62 = _mm_cmpeq_epi8(even32_62a,even32_62b);
TBodd1_31 = _mm_cmpeq_epi8(odd1_31a,odd1_31b);
TBodd33_63 = _mm_cmpeq_epi8(odd33_63a,odd33_63b);
metrics0_15 = _mm_unpacklo_epi8(even0_30a ,odd1_31a);
metrics16_31 = _mm_unpackhi_epi8(even0_30a ,odd1_31a);
metrics32_47 = _mm_unpacklo_epi8(even32_62a,odd33_63a);
metrics48_63 = _mm_unpackhi_epi8(even32_62a,odd33_63a);
TB_ptr[0] = _mm_unpacklo_epi8(TBeven0_30,TBodd1_31);
TB_ptr[1] = _mm_unpackhi_epi8(TBeven0_30,TBodd1_31);
TB_ptr[2] = _mm_unpacklo_epi8(TBeven32_62,TBodd33_63);
TB_ptr[3] = _mm_unpackhi_epi8(TBeven32_62,TBodd33_63);
in+=3;
TB_ptr += 4;
// rescale by subtracting minimum
/****************************************************
USE SSSE instruction phminpos!!!!!!!
****************************************************/
min_state =_mm_min_epu8(metrics0_15,metrics16_31);
min_state =_mm_min_epu8(min_state,metrics32_47);
min_state =_mm_min_epu8(min_state,metrics48_63);
min_state2 = min_state;
min_state = _mm_unpacklo_epi8(min_state,min_state);
min_state2 = _mm_unpackhi_epi8(min_state2,min_state2);
min_state = _mm_min_epu8(min_state,min_state2);
min_state2 = min_state;
min_state = _mm_unpacklo_epi8(min_state,min_state);
min_state2 = _mm_unpackhi_epi8(min_state2,min_state2);
min_state = _mm_min_epu8(min_state,min_state2);
min_state2 = min_state;
min_state = _mm_unpacklo_epi8(min_state,min_state);
min_state2 = _mm_unpackhi_epi8(min_state2,min_state2);
min_state = _mm_min_epu8(min_state,min_state2);
min_state2 = min_state;
min_state = _mm_unpacklo_epi8(min_state,min_state);
min_state2 = _mm_unpackhi_epi8(min_state2,min_state2);
min_state = _mm_min_epu8(min_state,min_state2);
metrics0_15 = _mm_subs_epu8(metrics0_15,min_state);
metrics16_31 = _mm_subs_epu8(metrics16_31,min_state);
metrics32_47 = _mm_subs_epu8(metrics32_47,min_state);
metrics48_63 = _mm_subs_epu8(metrics48_63,min_state);
#elif defined(__arm__)
m0_ptr = (uint8x16_t *)&m0_table[table_offset];
m1_ptr = (uint8x16_t *)&m1_table[table_offset];
// even states
even0_30a = vqaddq_u8(metrics0_31.val[0],m0_ptr[0]);
even32_62a = vqaddq_u8(metrics0_31.val[1],m0_ptr[1]);
even0_30b = vqaddq_u8(metrics32_63.val[0],m0_ptr[2]);
even32_62b = vqaddq_u8(metrics32_63.val[1],m0_ptr[3]);
// odd states
odd1_31a = vqaddq_u8(metrics0_31.val[0],m1_ptr[0]);
odd33_63a = vqaddq_u8(metrics0_31.val[1],m1_ptr[1]);
odd1_31b = vqaddq_u8(metrics32_63.val[0],m1_ptr[2]);
odd33_63b = vqaddq_u8(metrics32_63.val[1],m1_ptr[3]);
// select maxima
even0_30a = vmaxq_u8(even0_30a,even0_30b);
even32_62a = vmaxq_u8(even32_62a,even32_62b);
odd1_31a = vmaxq_u8(odd1_31a,odd1_31b);
odd33_63a = vmaxq_u8(odd33_63a,odd33_63b);
// Traceback information
TBeven0_30 = vceqq_u8(even0_30a,even0_30b);
TBeven32_62 = vceqq_u8(even32_62a,even32_62b);
TBodd1_31 = vceqq_u8(odd1_31a,odd1_31b);
TBodd33_63 = vceqq_u8(odd33_63a,odd33_63b);
metrics0_31 = vzipq_u8(even0_30a,odd1_31a);
metrics32_63 = vzipq_u8(even32_62a,odd33_63a);
TB_ptr[0] = vzipq_u8(TBeven0_30,TBodd1_31);
TB_ptr[1] = vzipq_u8(TBeven32_62,TBodd33_63);
in+=2;
TB_ptr += 2;
// rescale by subtracting minimum
/****************************************************
USE SSSE instruction phminpos!!!!!!!
****************************************************/
min_state =vminq_u8(metrics0_31.val[0],metrics0_31.val[1]);
min_state =vminq_u8(min_state,metrics32_63.val[0]);
min_state =vminq_u8(min_state,metrics32_63.val[1]);
// here we have 16 maximum metrics from the 64 states
uint8x8_t min_state2 = vpmin_u8(((uint8x8_t*)&min_state)[0],((uint8x8_t*)&min_state)[0]);
// now the 8 maximum in min_state2
min_state2 = vpmin_u8(min_state2,min_state2);
// now the 4 maximum in min_state2, repeated twice
min_state2 = vpmin_u8(min_state2,min_state2);
// now the 2 maximum in min_state2, repeated 4 times
min_state2 = vpmin_u8(min_state2,min_state2);
// now the 1 maximum in min_state2, repeated 8 times
min_state = vcombine_u8(min_state2,min_state2);
// now the 1 maximum in min_state, repeated 16 times
metrics0_31.val[0] = vqsubq_u8(metrics0_31.val[0],min_state);
metrics0_31.val[1] = vqsubq_u8(metrics0_31.val[1],min_state);
metrics32_63.val[0] = vqsubq_u8(metrics32_63.val[0],min_state);
metrics32_63.val[1] = vqsubq_u8(metrics32_63.val[1],min_state);
#endif
}
} // iteration
// Traceback
prev_state0 = 0;
maxm = 0;
#if defined(__x86_64__) || defined(__i386__)
for (s=0; s<16; s++)
if (((uint8_t *)&metrics0_15)[s] > maxm) {
maxm = ((uint8_t *)&metrics0_15)[s];
prev_state0 = s;
}
for (s=0; s<16; s++)
if (((uint8_t *)&metrics16_31)[s] > maxm) {
maxm = ((uint8_t *)&metrics16_31)[s];
prev_state0 = s+16;
}
for (s=0; s<16; s++)
if (((uint8_t *)&metrics32_47)[s] > maxm) {
maxm = ((uint8_t *)&metrics32_47)[s];
prev_state0 = s+32;
}
for (s=0; s<16; s++)
if (((uint8_t *)&metrics48_63)[s] > maxm) {
maxm = ((uint8_t *)&metrics48_63)[s];
prev_state0 = s+48;
}
#elif defined(__arm__)
for (s=0; s<16; s++)
if (((uint8_t *)&metrics0_31.val[0])[s] > maxm) {
maxm = ((uint8_t *)&metrics0_31.val[0])[s];
prev_state0 = s;
}
for (s=0; s<16; s++)
if (((uint8_t *)&metrics0_31.val[1])[s] > maxm) {
maxm = ((uint8_t *)&metrics0_31.val[1])[s];
prev_state0 = s+16;
}
for (s=0; s<16; s++)
if (((uint8_t *)&metrics32_63.val[0])[s] > maxm) {
maxm = ((uint8_t *)&metrics32_63.val[0])[s];
prev_state0 = s+32;
}
for (s=0; s<16; s++)
if (((uint8_t *)&metrics32_63.val[1])[s] > maxm) {
maxm = ((uint8_t *)&metrics32_63.val[1])[s];
prev_state0 = s+48;
}
#endif
TB_ptr2 = (uint8_t *)&TB[(n-1)*4];
for (position = n-1 ; position>-1; position--) {
decoded_bytes[(position)>>3] += (prev_state0 & 0x1)<<(7-(position & 0x7));
if (TB_ptr2[prev_state0] == 0)
prev_state0 = (prev_state0 >> 1);
else
prev_state0 = 32 + (prev_state0>>1);
TB_ptr2-=64;
}
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
}

View File

@@ -3,7 +3,9 @@
* 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
*
@@ -24,31 +26,27 @@
#define __INIT_DEFS_NB_IOT__H__
//#include "PHY/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "nfapi_interface.h"
#include "nfapi_interface.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
//#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
//#include "RadioResourceConfigDedicated.h"
//#include "TDD-Config.h"
//#include "MBSFN-SubframeConfigList.h"
//#include "MobilityControlInfo.h"
//#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
//#include "SCellToAddMod-r10.h"
//#endif
/*brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB-NB decoding + primary/secondary synch).*/
void phy_config_mib_eNB_NB_IoT(int Mod_id,
int eutra_band,
int Nid_cell,
int Ncp,
int Ncp_UL,
int p_eNB,
uint16_t EARFCN,
uint16_t prb_index, // NB_IoT_RB_ID,
uint16_t operating_mode,
uint16_t control_region_size,
uint16_t eutra_NumCRS_ports);
void phy_config_mib_eNB_NB_IoT(int Mod_id,
int CC_id,
int eutra_band,
int Nid_cell,
int Ncp,
int Ncp_UL,
int p_eNB,
uint16_t EARFCN,
uint16_t prb_index, // NB_IoT_RB_ID,
uint16_t operating_mode,
uint16_t control_region_size,
uint16_t eutra_NumCRS_ports);
/*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/
@@ -59,15 +57,17 @@ void phy_config_mib_eNB_NB_IoT(int Mod_id,
// RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon
// );
void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
nfapi_nb_iot_config_t *config,
nfapi_rf_config_t *rf_config,
nfapi_uplink_reference_signal_config_t* ul_nrs_config,
extra_phyConfig_t* extra_phy_parms);
void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
int CC_id,
nfapi_nb_iot_config_t *config,
nfapi_rf_config_t *rf_config,
nfapi_uplink_reference_signal_config_t *ul_nrs_config,
extra_phyConfig_t *extra_phy_parms);
void phy_config_dedicated_eNB_NB_IoT(module_id_t Mod_id,
rnti_t rnti,
extra_phyConfig_t* extra_phy_parms);
void phy_config_dedicated_eNB_NB_IoT(uint8_t Mod_id,
int CC_id,
uint16_t rnti,
extra_phyConfig_t *extra_parms);
// void phy_init_lte_top_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
void phy_init_nb_iot_eNB(PHY_VARS_eNB_NB_IoT *phyvar);

View File

@@ -82,5 +82,6 @@ void free_lte_top(void) {
}
/*
* @}*/

35
openair1/PHY/INIT/lte_init.c Normal file → Executable file
View File

@@ -34,6 +34,9 @@
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
#include <math.h>
//NB-IoT
//#include "openair2/ENB_APP/NB_IoT_config.c"
#include "openair2/ENB_APP/NB_IoT_paramdef.h"
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
extern int32_t get_uldl_offset(int eutra_bandP);
@@ -84,6 +87,38 @@ l1_north_init_eNB ()
return(0);
}
//for NB-IoT layer1 to get informstion from layer2
int
l1_north_init_NB_IoT()
{
int j;
paramlist_def_t NbIoT_L1_ParamList = {NBIOT_L1LIST_CONFIG_STRING,NULL,0};
if (RC.L1_NB_IoT != NULL)
{
AssertFatal(RC.L1_NB_IoT!=NULL,"RC.L1_NB_IoT is null\n");
LOG_I(PHY,"RC.L1_NB_IoT = %p\n",RC.L1_NB_IoT);
for (j=0; j<NbIoT_L1_ParamList.numelt; j++) {
AssertFatal(RC.L1_NB_IoT[j]!=NULL,"RC.eNB_NB_IoT[%d] is null\n",j);
LOG_I(PHY,"RC.L1_NB_IoT = %p\n",RC.L1_NB_IoT);
if ((RC.L1_NB_IoT[j]->if_inst_NB_IoT = IF_Module_init_NB_IoT(j))<0) return(-1);
LOG_I(PHY,"RC.L1_NB_IoT = %p\n",RC.L1_NB_IoT);
RC.L1_NB_IoT[j]->if_inst_NB_IoT->PHY_config_req = PHY_config_req_NB_IoT;
RC.L1_NB_IoT[j]->if_inst_NB_IoT->schedule_response = schedule_response_NB_IoT;
}
}
else
{
LOG_I(PHY,"%s() Not installing PHY callbacks - RC.nb_nb_iot_L1_inst:%d RC.L1_NB_IoT:%p\n", __FUNCTION__, RC.nb_nb_iot_L1_inst, RC.L1_NB_IoT);
}
return(0);
}
void phy_config_request(PHY_Config_t *phy_config) {

View File

@@ -0,0 +1,469 @@
/*
* 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.0 (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
*/
//#include "defs.h"
#include "SCHED_NBIOT/defs_NB_IoT.h"
#include "PHY/phy_extern.h"
#include "PHY/extern_NB_IoT.h" // PHY/defs_NB_IoT.h is called here , log.h & LTE_TRANSPORT/defs_NB_IoT.h are included through PHY/defs_NB_IoT.h
#include "openair2/LAYER2/MAC/proto_NB_IoT.h" // for functions: from_earfcn_NB_IoT, get_uldl_offset_NB_IoT
//#include "SIMULATION/TOOLS/defs.h"
//#include "RadioResourceConfigCommonSIB.h"
//#include "RadioResourceConfigDedicated.h"
//#include "TDD-Config.h"
//#include "LAYER2/MAC/extern.h"
//#include "MBSFN-SubframeConfigList.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_PHY
#include "assertions.h"
//#include <math.h>
//NB-IoT
#include "PHY/INIT/defs_NB_IoT.h" // nfapi_interface.h & IF_Module_NB_IoT.h are included here
//#include "RadioResourceConfigCommonSIB-NB-r13.h"
//#include "RadioResourceConfigDedicated-NB-r13.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
//#include "openair2/RRC/NBIOT/proto_NB_IoT.h"
//extern uint16_t prach_root_sequence_map0_3[838];
//extern uint16_t prach_root_sequence_map4[138];
//uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
void phy_config_mib_eNB_NB_IoT(int Mod_id,
int CC_id,
int eutra_band,
int Nid_cell,
int Ncp,
int Ncp_UL,
int p_eNB,
uint16_t EARFCN,
uint16_t prb_index, // NB_IoT_RB_ID,
uint16_t operating_mode,
uint16_t control_region_size,
uint16_t eutra_NumCRS_ports)
{
AssertFatal(PHY_vars_eNB_NB_IoT_g != NULL, "PHY_vars_eNB_NB_IoT_g instance pointer doesn't exist\n");
AssertFatal(PHY_vars_eNB_NB_IoT_g[Mod_id] != NULL, "PHY_vars_eNB_NB_IoT_g instance %d doesn't exist\n",Mod_id);
AssertFatal(PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id] != NULL, "PHY_vars_eNB_NB_IoT_g instance %d, CCid %d doesn't exist\n",Mod_id,CC_id);
NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms_NB_IoT;
fp = (NB_IoT_DL_FRAME_PARMS*) malloc (sizeof(NB_IoT_DL_FRAME_PARMS));
LOG_I(PHY,"Configuring MIB-NB for instance %d, CCid %d : (band %d,Nid_cell %d,p %d,EARFCN %u)\n",Mod_id, CC_id, eutra_band, Nid_cell, p_eNB,EARFCN);
// fp->N_RB_DL
// fp->N_RB_UL also this two values need to be known when we are dealing with in-band and guard-band operating mode
fp->Nid_cell = Nid_cell;
fp->nushift = Nid_cell%6;
fp->eutra_band = eutra_band;
fp->Ncp = Ncp;
fp->Ncp_UL = Ncp_UL;
fp->nb_antenna_ports_eNB = p_eNB; //tx antenna port
fp->dl_CarrierFreq = from_earfcn_NB_IoT(eutra_band,EARFCN,0);
fp->ul_CarrierFreq = fp->dl_CarrierFreq - get_uldl_offset_NB_IoT(eutra_band);
fp->operating_mode = operating_mode; //see how are defined by FAPI structure
fp->NB_IoT_RB_ID = prb_index; //XXX to be better understand how should be managed
//fp->nb_rx_antenna_ports_eNB
fp->control_region_size = control_region_size; //(assume that this value is negative if not used)
fp->eutra_NumCRS_ports = eutra_NumCRS_ports; //(valid only for in-band operating mode with different PCI)
LOG_I(PHY,"Configure-MIB complete\n");
//TODO (new Raymond implementation) in the classic implementation seems to be used only by oaisim
//init_frame_parms(fp,1);
//init_lte_top(fp);
}
//Before FAPI implementation
//void NB_phy_config_sib2_eNB(uint8_t Mod_id,
// int CC_id,
// RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon
// )
//{
// NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms;
// //LTE_eNB_UE_stats *eNB_UE_stats = PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->eNB_UE_stats;
// //int32_t rx_total_gain_eNB_dB = PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->rx_total_gain_eNB_dB;
// uint8_t MAX_NPRACH = 4;
// NPRACH_Parameters_NB_r13_t *np;
//
// LOG_D(PHY,"[eNB%d] CCid %d: Applying radioResourceConfigCommon_NB\n",Mod_id,CC_id);
//
// /*NPRACH configCommon*/
// fp->nprach_config_common.nprach_CP_Length =radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
// //fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list =radioResourceConfigCommon->nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13.list;
// //LOG_D(PHY,"nprach_config_common.rsrp_ThresholdsPrachInfoList = %d\n",fp->nprach_config_common.rsrp_ThresholdsPrachInfoList);
//
// /*Loop over the configuration according to the maxNPRACH_Resources*/
// for (fp->CE=1; fp->CE <= MAX_NPRACH;fp->CE++){
// np = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[fp->CE];
// /*fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->maxNumPreambleAttemptCE =np->maxNumPreambleAttemptCE_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.maxNumPreambleAttemptCE = %d\n",fp->nprach_config_common.nprach_ParametersList.list.maxNumPreambleAttemptCE);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_NumRepetitions_RA =np->npdcch_NumRepetitions_RA_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_NumRepetitions_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.npdcch_NumRepetitions_RA);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_Periodicity =np->nprach_Periodicity_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_Periodicity = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_Periodicity);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_StartTime =np->nprach_StartTime_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_StartTime);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_SubcarrierOffset =np->nprach_SubcarrierOffset_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierOffset = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierOffset);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->nprach_SubcarrierMSG3_RangeStart =np->nprach_SubcarrierMSG3_RangeStart_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierMSG3_RangeStart = %d\n",fp->nprach_config_common.nprach_ParametersList.list.nprach_SubcarrierMSG3_RangeStart);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_Offset_RA =np->npdcch_Offset_RA_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_Offset_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.npdcch_Offset_RA);
// fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_StartSF_CSS_RA =np->npdcch_StartSF_CSS_RA_r13;
// //LOG_D(PHY,"nprach_config_common.nprach_ParametersList.list.npdcch_StartSF_CSS_RA = %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[fp->CE]->npdcch_StartSF_CSS_RA);
// */
// }
//
// /*Should modify to compute_nprach_seq*/
// //compute_prach_seq(&fp->prach_config_common,fp->frame_type,PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->X_u);
//
// /*NPDSCH ConfigCommon*/
// fp->npdsch_config_common.nrs_Power = radioResourceConfigCommon->npdsch_ConfigCommon_r13.nrs_Power_r13;
//
// /*NPUSCH ConfigCommon*/
// /*A list (1-3) should be loop for ack_NACK_NumRepetitions_Msg4*/
// for (fp->CE=1; fp->CE <= MAX_NPRACH;fp->CE++){
// fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4[fp->CE] = radioResourceConfigCommon->npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list.array[fp->CE];
// //LOG_D(PHY,"npusch_config_common.ack_NACK_NumRepetitions_Msg4 = %d]n",fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4);
// }
// fp->npusch_config_common.srs_SubframeConfig = radioResourceConfigCommon->npusch_ConfigCommon_r13.srs_SubframeConfig_r13;
// LOG_D(PHY,"npusch_config_common.srs_SubframeConfig = %d]n",fp->npusch_config_common.srs_SubframeConfig);
// fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_BaseSequence_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence);
// fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_BaseSequence_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence);
// fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_CyclicShift = %d]n",fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift);
// fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_CyclicShift = %d]n",fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift);
// fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->twelveTone_BaseSequence_r13;
// LOG_D(PHY,"npusch_config_common.dmrs_Config.twelveTone_BaseSequence = %d]n",fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence);
//
// fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13;
// LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH);
// fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13;
// LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled);
//
// /*should change the part that implement the ul hopping in NB-IoT*/
// //init_ul_hopping(fp);
//
// /*UL Power Control Config Common*/
//
// fp->ul_power_control_config_common.p0_NominalNPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13;
// fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon_r13.alpha_r13;
// fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13;
//
// /*DL gap*/
//
// fp->DL_gap_config.dl_GapDurationCoeff = radioResourceConfigCommon->dl_Gap_r13->dl_GapDurationCoeff_r13;
// fp->DL_gap_config.dl_GapPeriodicity = radioResourceConfigCommon->dl_Gap_r13->dl_GapPeriodicity_r13;
// fp->DL_gap_config.dl_GapThreshold = radioResourceConfigCommon->dl_Gap_r13->dl_GapThreshold_r13;
//
// /*PUCCH stuff in LTE*/
// //init_ncs_cell(fp,PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->ncs_cell);
//
// //init_ul_hopping(fp);
//
//
//
//}
void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
int CC_id,
nfapi_nb_iot_config_t *config,
nfapi_rf_config_t *rf_config,
nfapi_uplink_reference_signal_config_t *ul_nrs_config,
extra_phyConfig_t *extra_phy_parms)
{
NB_IoT_DL_FRAME_PARMS *fp = &PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->frame_parms_NB_IoT;
// PHY_VARS_eNB *eNB = &PHY_vars_eNB_g[0][0];
LOG_I(PHY,"[eNB%d] CCid %d: Applying config_NB_IoT from sib2_NB\n",Mod_id,CC_id);
fp = (NB_IoT_DL_FRAME_PARMS*) malloc (sizeof(NB_IoT_DL_FRAME_PARMS));
/*NPRACH_ConfigSIB_NB_r13----------------------------------------------------------*/
//MP: FAPI style approach: instead of a list they consider the 3 possible configuration separately
if(config->nprach_config_0_enabled.value == 1){
LOG_I(PHY, "NPRACH Config #0 enabled\n");
fp->nprach_config_common.nprach_CP_Length = config->nprach_config_0_cp_length.value; //NPRACH_ConfigSIB_NB_r13__nprach_CP_Length_r13_us66dot7
LOG_D(PHY," config#0: nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//FIXME: MP: memory for the list should be allocated? initialization??
fp->nprach_config_common.nprach_ParametersList.list[0].nprach_Periodicity = config->nprach_config_0_sf_periodicity.value;
LOG_D(PHY,"config#0: nprach_Periodicity = %d\n", fp->nprach_config_common.nprach_ParametersList.list[0].nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list[0].nprach_StartTime = config->nprach_config_0_start_time.value;
LOG_D(PHY,"config#0: nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list[0].nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list[0].nprach_SubcarrierOffset = config->nprach_config_0_subcarrier_offset.value;
LOG_D(PHY,"config#0: nprach_SubcarrierOffset= %d\n", fp->nprach_config_common.nprach_ParametersList.list[0].nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list[0].nprach_NumSubcarriers = config->nprach_config_0_number_of_subcarriers.value;
LOG_D(PHY,"config#0: nprach_NumSubcarriers= %d\n",fp->nprach_config_common.nprach_ParametersList.list[0].nprach_NumSubcarriers);
fp->nprach_config_common.nprach_ParametersList.list[0].numRepetitionsPerPreambleAttempt = config->nprach_config_0_number_of_repetitions_per_attempt.value;
LOG_D(PHY,"config#0: numRepetitionsPerPreambleAttempt= %d\n",fp->nprach_config_common.nprach_ParametersList.list[0].numRepetitionsPerPreambleAttempt);
//////////////////////////////////////////////////////////////////////////
/* eNB->nprach_config_common.nprach_CP_Length = config->nprach_config_0_cp_length.value;
eNB->nprach_config_common.nprach_ParametersList.list[0].nprach_Periodicity = config->nprach_config_0_sf_periodicity.value;
eNB->nprach_config_common.nprach_ParametersList.list[0].nprach_StartTime = config->nprach_config_0_start_time.value;
eNB->nprach_config_common.nprach_ParametersList.list[0].nprach_SubcarrierOffset = config->nprach_config_0_subcarrier_offset.value;
eNB->nprach_config_common.nprach_ParametersList.list[0].nprach_NumSubcarriers = config->nprach_config_0_number_of_subcarriers.value;
eNB->nprach_config_common.nprach_ParametersList.list[0].numRepetitionsPerPreambleAttempt = config->nprach_config_0_number_of_repetitions_per_attempt.value;
*/
//////////////////////////////////////////////////////////////////////////
//missed configuration in FAPI config_request (TS 36.331 pag 610) (may not needed)
/*fp->nprach_config_common.nprach_ParametersList.list.array[0]->nprach_SubcarrierMSG3_RangeStart = extra_phy_parms->nprach_config_0_subcarrier_MSG3_range_start;
fp->nprach_config_common.nprach_ParametersList.list.array[0]->npdcch_StartSF_CSS_RA = extra_phy_parms->nprach_config_0_npdcch_startSF_CSS_RA;
fp->nprach_config_common.nprach_ParametersList.list.array[0]->npdcch_NumRepetitions_RA = extra_phy_parms->nprach_config_0_npdcch_num_repetitions_RA;
fp->nprach_config_common.nprach_ParametersList.list.array[0]->npdcch_Offset_RA = extra_phy_parms->nprach_config_0_npdcch_offset_RA;
fp->nprach_config_common.nprach_ParametersList.list.array[0]->maxNumPreambleAttemptCE = extra_phy_parms->nprach_config_0_max_num_preamble_attempt_CE;
*/
//fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list /*OPTIONAL*/
}
if(config->nprach_config_1_enabled.value == 1){
LOG_I(PHY, "NPRACH Config #1 enabled\n");
fp->nprach_config_common.nprach_CP_Length = config->nprach_config_1_cp_length.value; //NPRACH_ConfigSIB_NB_r13__nprach_CP_Length_r13_us66dot7
LOG_D(PHY," config#1: nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//FIXME: MP: memory for the list should be allocated? initialization??
fp->nprach_config_common.nprach_ParametersList.list[1].nprach_Periodicity = config->nprach_config_1_sf_periodicity.value;
LOG_D(PHY,"config#1: nprach_Periodicity = %d\n", fp->nprach_config_common.nprach_ParametersList.list[1].nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list[1].nprach_StartTime = config->nprach_config_1_start_time.value;
LOG_D(PHY,"config#1: nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list[1].nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list[1].nprach_SubcarrierOffset = config->nprach_config_1_subcarrier_offset.value;
LOG_D(PHY,"config#1: nprach_SubcarrierOffset= %d\n", fp->nprach_config_common.nprach_ParametersList.list[1].nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list[1].nprach_NumSubcarriers = config->nprach_config_1_number_of_subcarriers.value;
LOG_D(PHY,"config#1: nprach_NumSubcarriers= %d\n",fp->nprach_config_common.nprach_ParametersList.list[1].nprach_NumSubcarriers);
fp->nprach_config_common.nprach_ParametersList.list[1].numRepetitionsPerPreambleAttempt = config->nprach_config_1_number_of_repetitions_per_attempt.value;
LOG_D(PHY,"config#1: numRepetitionsPerPreambleAttempt= %d\n",fp->nprach_config_common.nprach_ParametersList.list[1].numRepetitionsPerPreambleAttempt);
///////////////////////////////////////////////////////////////////////////////////////
/* eNB->nprach_config_common.nprach_CP_Length = config->nprach_config_1_cp_length.value;
eNB->nprach_config_common.nprach_ParametersList.list[1].nprach_Periodicity = config->nprach_config_1_sf_periodicity.value;
eNB->nprach_config_common.nprach_ParametersList.list[1].nprach_StartTime = config->nprach_config_1_start_time.value;
eNB->nprach_config_common.nprach_ParametersList.list[1].nprach_SubcarrierOffset = config->nprach_config_1_subcarrier_offset.value;
eNB->nprach_config_common.nprach_ParametersList.list[1].nprach_NumSubcarriers = config->nprach_config_1_number_of_subcarriers.value;
eNB->nprach_config_common.nprach_ParametersList.list[1].numRepetitionsPerPreambleAttempt = config->nprach_config_1_number_of_repetitions_per_attempt.value;
*/
//////////////////////////////////////////////////////////////////////////////////////
//missed configuration in FAPI config_request (TS 36.331 pag 610) (may not needed)
/*fp->nprach_config_common.nprach_ParametersList.list.array[1]->nprach_SubcarrierMSG3_RangeStart = extra_phy_parms->nprach_config_1_subcarrier_MSG3_range_start;
fp->nprach_config_common.nprach_ParametersList.list.array[1]->npdcch_StartSF_CSS_RA = extra_phy_parms->nprach_config_1_npdcch_startSF_CSS_RA;
fp->nprach_config_common.nprach_ParametersList.list.array[1]->npdcch_NumRepetitions_RA = extra_phy_parms->nprach_config_1_npdcch_num_repetitions_RA;
fp->nprach_config_common.nprach_ParametersList.list.array[1]->npdcch_Offset_RA = extra_phy_parms->nprach_config_1_npdcch_offset_RA;
fp->nprach_config_common.nprach_ParametersList.list.array[1]->maxNumPreambleAttemptCE = extra_phy_parms->nprach_config_1_max_num_preamble_attempt_CE;
*/
//fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list /*OPTIONAL*/
}
if(config->nprach_config_2_enabled.value == 1){
LOG_I(PHY, "NPRACH Config #2 enabled\n");
fp->nprach_config_common.nprach_CP_Length = config->nprach_config_2_cp_length.value; //NPRACH_ConfigSIB_NB_r13__nprach_CP_Length_r13_us66dot7
LOG_D(PHY," config#2: nprach_CP_Length = %d\n",fp->nprach_config_common.nprach_CP_Length);
//FIXME: MP: memory for the list should be allocated? initialization?? where??
fp->nprach_config_common.nprach_ParametersList.list[2].nprach_Periodicity = config->nprach_config_2_sf_periodicity.value;
LOG_D(PHY,"config#2: nprach_Periodicity = %d\n", fp->nprach_config_common.nprach_ParametersList.list[2].nprach_Periodicity);
fp->nprach_config_common.nprach_ParametersList.list[2].nprach_StartTime = config->nprach_config_2_start_time.value;
LOG_D(PHY,"config#2: nprach_StartTime = %d\n",fp->nprach_config_common.nprach_ParametersList.list[2].nprach_StartTime);
fp->nprach_config_common.nprach_ParametersList.list[2].nprach_SubcarrierOffset = config->nprach_config_2_subcarrier_offset.value;
LOG_D(PHY,"config#2: nprach_SubcarrierOffset= %d\n", fp->nprach_config_common.nprach_ParametersList.list[2].nprach_SubcarrierOffset);
fp->nprach_config_common.nprach_ParametersList.list[2].nprach_NumSubcarriers = config->nprach_config_2_number_of_subcarriers.value;
LOG_D(PHY,"config#2: nprach_NumSubcarriers= %d\n",fp->nprach_config_common.nprach_ParametersList.list[2].nprach_NumSubcarriers);
fp->nprach_config_common.nprach_ParametersList.list[2].numRepetitionsPerPreambleAttempt = config->nprach_config_2_number_of_repetitions_per_attempt.value;
LOG_D(PHY,"config#2: numRepetitionsPerPreambleAttempt= %d\n",fp->nprach_config_common.nprach_ParametersList.list[2].numRepetitionsPerPreambleAttempt);
//////////////////////////////////////////////////////////////////////////////////////
/*
eNB->nprach_config_common.nprach_CP_Length = config->nprach_config_2_cp_length.value;
eNB->nprach_config_common.nprach_ParametersList.list[2].nprach_Periodicity = config->nprach_config_2_sf_periodicity.value;
eNB->nprach_config_common.nprach_ParametersList.list[2].nprach_StartTime = config->nprach_config_2_start_time.value;
eNB->nprach_config_common.nprach_ParametersList.list[2].nprach_SubcarrierOffset = config->nprach_config_2_subcarrier_offset.value;
eNB->nprach_config_common.nprach_ParametersList.list[2].nprach_NumSubcarriers = config->nprach_config_2_number_of_subcarriers.value;
eNB->nprach_config_common.nprach_ParametersList.list[2].numRepetitionsPerPreambleAttempt = config->nprach_config_2_number_of_repetitions_per_attempt.value;
*/
//////////////////////////////////////////////////////////////////////////////////////
//missed configuration in FAPI config_request (TS 36.331 pag 610) (may not needed)
/*fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_SubcarrierMSG3_RangeStart = extra_phy_parms->nprach_config_2_subcarrier_MSG3_range_start;
LOG_D(PHY,"config#2: nprach_SubcarrierMSG3_RangeStart= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->nprach_SubcarrierMSG3_RangeStart);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_StartSF_CSS_RA = extra_phy_parms->nprach_config_2_npdcch_startSF_CSS_RA;
LOG_D(PHY,"config#2: npdcch_StartSF_CSS_RA= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_StartSF_CSS_RA);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_NumRepetitions_RA = extra_phy_parms->nprach_config_2_npdcch_num_repetitions_RA;
LOG_D(PHY,"config#2: npdcch_NumRepetitions_RA= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_NumRepetitions_RA);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_Offset_RA = extra_phy_parms->nprach_config_2_npdcch_offset_RA;
LOG_D(PHY,"config#2: npdcch_Offset_RA= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->npdcch_Offset_RA);
fp->nprach_config_common.nprach_ParametersList.list.array[2]->maxNumPreambleAttemptCE = extra_phy_parms->nprach_config_2_max_num_preamble_attempt_CE;
LOG_D(PHY,"config#2: maxNumPreambleAttemptCE= %d\n",fp->nprach_config_common.nprach_ParametersList.list.array[2]->maxNumPreambleAttemptCE);
*/
//fp->nprach_config_common.rsrp_ThresholdsPrachInfoList.list /*OPTIONAL*/
}
//TODO: Should modify to compute_nprach_seq --> nprach.
//compute_prach_seq(&fp->prach_config_common,fp->frame_type,PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id]->X_u);
/*NPDSCH ConfigCommon-------------------------------------------------------------------*/
//NPDSCH_ConfigCommon_NB_r13_t b;
//FIXME: the FAPI specs pag 140 fix a range of value (0->255) but i don't find any similar correspondence in the 3GPP specs (TS 36.331 pag 608 and TS 36.213 ch 16.2.2)
fp->npdsch_config_common.nrs_Power = rf_config->reference_signal_power.value;
/*NPUSCH ConfigCommon-------------------------------------------------------------------*/
//NPUSCH_ConfigCommon_NB_r13_t c;
fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence = config->three_tone_base_sequence.value;
LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_BaseSequence = %d\n",fp->npusch_config_common.dmrs_Config.threeTone_BaseSequence);
fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence = config->six_tone_base_sequence.value;
LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_BaseSequence = %d\n",fp->npusch_config_common.dmrs_Config.sixTone_BaseSequence);
fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift = config->three_tone_cyclic_shift.value;
LOG_D(PHY,"npusch_config_common.dmrs_Config.threeTone_CyclicShift = %d\n",fp->npusch_config_common.dmrs_Config.threeTone_CyclicShift);
fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift = config->six_tone_cyclic_shift.value;
LOG_D(PHY,"npusch_config_common.dmrs_Config.sixTone_CyclicShift = %d\n",fp->npusch_config_common.dmrs_Config.sixTone_CyclicShift);
fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence= config->twelve_tone_base_sequence.value;
LOG_D(PHY,"npusch_config_common.dmrs_Config.twelveTone_BaseSequence = %d\n",fp->npusch_config_common.dmrs_Config.twelveTone_BaseSequence);
fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = ul_nrs_config->uplink_rs_hopping.value;
LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled = %d\n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled);
LOG_D(PHY,"**%s**\n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled == 1 ? "RS_GROUP_HOPPING" : "RS_NO_HOPPING");
fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = ul_nrs_config->group_assignment.value;
LOG_D(PHY,"npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH = %d]n",fp->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH);
//MP: FAPI missed parameters (may not needed at eNB side and some of them are optional by the 3GPP specs)
//fp->npusch_config_common.ack_NACK_NumRepetitions_Msg4 --> list of size maxNPRACH_Resources_NB_r13 (3 elements)
//fp->npusch_config_common.srs_SubframeConfig /*OPTIONAL*/
//No Frequency hopping in NULSCH for NB-IoT and not init_ncs_cell used for PUCCH
/*UL Power Control Config Common---------------------------------------------------------*/
//F nothing has been defined in FAPI specs for this (may because are only UE stuffs)
/*fp->ul_power_control_config_common.p0_NominalNPUSCH = extra_phy_parms->p0_nominal_npusch;
fp->ul_power_control_config_common.alpha = extra_phy_parms->alpha;
fp->ul_power_control_config_common.deltaPreambleMsg3 = extra_phy_parms->delta_preamle_MSG*/
/*DL gap Config - OPTIONAL----------------------------------------------------------------*/
//DL_GapConfig_NB_r13_t a;
if(config->dl_gap_config_enable.value == 1){
fp->DL_gap_config.dl_GapDurationCoeff= config->dl_gap_periodicity.value;
fp->DL_gap_config.dl_GapPeriodicity = config->dl_gap_periodicity.value;
fp->DL_gap_config.dl_GapThreshold = config->dl_gap_threshold.value;
}
LOG_I(PHY,"SIB-2 configure complete\n");
}
void phy_config_dedicated_eNB_NB_IoT(uint8_t Mod_id,
int CC_id,
uint16_t rnti,
extra_phyConfig_t *extra_parms)
{
PHY_VARS_eNB_NB_IoT *eNB = PHY_vars_eNB_NB_IoT_g[Mod_id][CC_id];
NB_IoT_eNB_NPDCCH_t *npdcch;
uint8_t UE_id = find_ue_NB_IoT(rnti,eNB);
if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
return;
}
//configure UE specific parameters for NPDCCH Search Space
if (eNB->npdcch[UE_id]) {
npdcch = eNB->npdcch[UE_id];
npdcch->rnti[0] = rnti;
npdcch->npdcch_NumRepetitions[0] = extra_parms->npdcch_NumRepetitions; //Rmax maybe is the only one needed
//npdcch->npdcch_Offset_USS = extra_parms->npdcch_Offset_USS;
//npdcch->npdcch_StartSF_USS = extra_parms->npdcch_StartSF_USS;
LOG_I(PHY,"phy_config_dedicated_eNB_NB_IoT: npdcch_NumRepetitions = %d\n",npdcch->npdcch_NumRepetitions[0]);
} else {
LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
return;
}
}
void phy_init_lte_top_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms)
{
crcTableInit_NB_IoT();
//ccodedot11_init();
//ccodedot11_init_inv();
ccodelte_init_NB_IoT();
ccodelte_init2_NB_IoT();
//ccodelte_init_inv();
//treillis_table_init();
//phy_generate_viterbi_tables();
//phy_generate_viterbi_tables_lte();
//init_td8();
// init_td16();
#ifdef __AVX2__
// init_td16avx2();
#endif
//lte_sync_time_init_NB_IoT(frame_parms);
//generate_ul_ref_sigs();
//generate_ul_ref_sigs_rx();
generate_ul_ref_sigs_rx_NB_IoT();
// generate_64qam_table();
//generate_16qam_table();
// generate_RIV_tables();
init_unscrambling_lut_NB_IoT();
// init_scrambling_lut();
//set_taus_seed(1328);
}

View File

@@ -19,6 +19,9 @@
* contact@openairinterface.org
*/
#include "defs.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "phy_init.h"
#include "common/utils/LOG/log.h"
@@ -187,3 +190,154 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) {
LOG_I(PHY,"frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
LOG_I(PHY,"frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
}
///////////////////////////////////////////////// NB-IoT ///////////////////////////////////////////////////////////////
int init_frame_parms_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint8_t osf)
{
uint8_t log2_osf;
#if DISABLE_LOG_X
printf("Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf);
#else
LOG_I(PHY,"Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf);
#endif
frame_parms->nb_prefix_samples0 = 160;
frame_parms->nb_prefix_samples = 144;
frame_parms->symbols_per_tti = 14;
switch(osf) {
case 1:
log2_osf = 0;
break;
case 2:
log2_osf = 1;
break;
case 4:
log2_osf = 2;
break;
case 8:
log2_osf = 3;
break;
case 16:
log2_osf = 4;
break;
default:
printf("Illegal oversampling %d\n",osf);
return(-1);
}
switch (frame_parms->N_RB_DL) {
case 100:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-600;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
}
else {
frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 2048-600;
}
break;
case 75:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-450;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
break;
case 50:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1024*osf;
frame_parms->samples_per_tti = 15360*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300;
frame_parms->nb_prefix_samples>>=(1-log2_osf);
frame_parms->nb_prefix_samples0>>=(1-log2_osf);
break;
case 25:
if (osf>2) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 512*osf;
frame_parms->samples_per_tti = 7680*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150;
frame_parms->nb_prefix_samples>>=(2-log2_osf);
frame_parms->nb_prefix_samples0>>=(2-log2_osf);
break;
case 15:
frame_parms->ofdm_symbol_size = 256*osf;
frame_parms->samples_per_tti = 3840*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90;
frame_parms->nb_prefix_samples>>=(3-log2_osf);
frame_parms->nb_prefix_samples0>>=(3-log2_osf);
break;
case 6:
frame_parms->ofdm_symbol_size = 128*osf;
frame_parms->samples_per_tti = 1920*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36;
frame_parms->nb_prefix_samples>>=(4-log2_osf);
frame_parms->nb_prefix_samples0>>=(4-log2_osf);
break;
default:
printf("init_frame_parms: Error: Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
return(-1);
break;
}
printf("lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size);
// frame_parms->tdd_config=3;
return(0);
}

View File

@@ -24,7 +24,8 @@
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "LTE_SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
@@ -377,10 +378,39 @@ void phy_cleanup(void);
void phy_config_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
void init_dfts(void);
/** @} */
//////////////////////// for NB-IoT ////////////////////////////////////////////
int init_frame_parms_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void phy_init_lte_top_NB_IoT(NB_IoT_DL_FRAME_PARMS *lte_frame_parms);
/*!
\brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is initialized.
@param[out] phy_vars_eNb Pointer to eNB Variables
@param is_secondary_eNb Flag to indicate this eNB gets synch from another
@param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
@returns 0 on success
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
*/
int phy_init_lte_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNb,
unsigned char is_secondary_eNb,
unsigned char abstraction_flag);
#endif

View File

@@ -0,0 +1,80 @@
/*
* 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.0 (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
*/
#ifndef __LTE_ESTIMATION_DEFS_NB_IOT__H__
#define __LTE_ESTIMATION_DEFS_NB_IOT__H__
#include "PHY/defs_L1_NB_IoT.h"
/*
int lte_est_timing_advance(NB_IoT_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_SRS *lte_eNb_srs,
unsigned int *eNb_id,
unsigned char clear,
unsigned char number_of_cards,
short coef);
*/
////////// Vincent: NB-IoT DL synchronization //////////////////////////////////////////////////
int lte_sync_time_init_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms );
void lte_sync_time_free_NB_IoT(void);
int lte_sync_time_NB_IoT(int **rxdata, ///rx data in time domain
NB_IoT_DL_FRAME_PARMS *frame_parms,
int *eNB_id);
void lte_sync_timefreq_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int band,unsigned int DL_freq);
////////////////////////////////////////////////////////////////////////////////////////////////
int NB_IoT_est_timing_advance_pusch(PHY_VARS_eNB_NB_IoT* phy_vars_eNB,module_id_t UE_id);
////////// Vincent: NB-IoT specific adapted function for channel estimation ////////////////////
/*
int ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id,
uint8_t UE_id,
unsigned char l,
unsigned char Ns,
uint8_t N_sc_RU,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint8_t cooperation_flag); */
////////////////////////////////////////////////////////////////////////////////////////////////
int16_t lte_ul_freq_offset_estimation_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t *ul_ch_estimates,
uint16_t nb_rb);
void freq_equalization_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
int **ul_ch_mag,
int **ul_ch_mag_b,
unsigned char symbol,
unsigned short Msc_RS,
unsigned char Qm);
/** @} */
#endif

View File

@@ -17,8 +17,10 @@
#ifndef __LTE_REFSIG_DEFS_NB_IOT__H__
#define __LTE_REFSIG_DEFS_NB_IOT__H__
#include "PHY/defs_L1_NB_IoT.h"
/** @ingroup _PHY_REF_SIG
* @{
*/
@@ -27,10 +29,16 @@
@param lte_gold_table pointer to table where sequences are stored
@param Nid_cell Cell Id for NB_IoT (to compute sequences for local and adjacent cells) */
void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
void lte_gold_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t lte_gold_table_NB_IoT[20][2][14],
uint16_t Nid_cell);
unsigned int lte_gold_generic_NB_IoT(unsigned int *x1, unsigned int *x2, unsigned char reset);
/*! \brief This function generates the Narrowband reference signal (NRS) sequence (36-211, Sec 6.10.1.1)
@param phy_vars_eNB Pointer to eNB variables
@param output Output vector for OFDM symbol (Frequency Domain)
@@ -40,7 +48,9 @@ void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
@param p antenna index
@param RB_IoT_ID the ID of the RB dedicated for NB_IoT
*/
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,

View File

@@ -0,0 +1,47 @@
function [ theta_estim, estim_CFO ] = Fc_first_synchro( observation, L_frame, L_sub_frame, FFT_size, L_symbol, N_subframe_observation, L_CP, SNR, type_first_estim )
% This function performs the estimation of the beginning of symbols as well
% as the estimation of CFO. It allows for a coarse synchronization
gamma = zeros(1,L_frame);
epsilon = zeros(1,L_frame);
for n = 1 : 1 : length(gamma)
gamma(n) = sum(observation(n:n+L_CP-1).*conj(observation(n+FFT_size:n+FFT_size+L_CP-1)));
epsilon(n) = sum(abs(observation(n:n+L_CP-1)).^2 + abs(observation(n+FFT_size:n+FFT_size+L_CP-1)).^2);
end
rho = 10^(SNR/20)/(10^(SNR/20)+1);
theta = 2*abs(gamma)-rho*(epsilon);
% Estimation of the symbol start and the corresponding CFO
theta_reshape = reshape(theta,L_symbol,N_subframe_observation*L_sub_frame);
% gamma_reshape = reshape(gamma,L_symbol,N_subframe_observation*L_sub_frame); % useful for estimation of CFO
[~,index_max] = max(theta_reshape); % where theta is max symbol by symbol
switch type_first_estim
case 1
%estimation by mean
theta_estim = sum(index_max)/length(index_max); % estimation by mean
estim_CFO = -1/(2*pi)*atan(imag(gamma(round(theta_estim)))/real(gamma(round(theta_estim))));
case 2
%estimation by majority
counter_index = zeros(1,L_symbol);
for k = 1 : 1 : length(index_max)
counter_index(index_max(k)) = counter_index(index_max(k)) + 1; % add the number of index_max
end
[~,theta_estim] = max(counter_index); % get the max of index max -> theta estim
% index_index_max = find(index_max == theta_estim);
% estim_CFO = -1/(2*pi)*atan(imag(gamma(round(theta_estim)))/real(gamma(round(theta_estim))));
estim_CFO_vec = -1/(2*pi)*atan(imag(gamma(round(theta_estim:L_symbol:end)))./real(gamma(round(theta_estim:L_symbol:end))));
% estim_CFO_vec2 = -1/(2*pi)*atan(imag(gamma_reshape(theta_estim,index_max(index_index_max)))./real(gamma_reshape(theta_estim,index_max(index_index_max))));
estim_CFO = sum(estim_CFO_vec)/length(estim_CFO_vec);
% estim_CFO_2 = sum(estim_CFO_vec2)/length(estim_CFO_vec2);
otherwise
print('error: type of estimation not defined')
end

View File

@@ -0,0 +1,166 @@
clear all
close all
% description: test synchro using CP for time-freq. synchro
% and ZC sequence for beginning of the radio frame estimation
% date : 09/03/2017
% author : Vincent Savaux, b<>com, Rennes, France
% email: vincent.savaux@b-com.com
% Parameters
u = 5; % root of ZC sequence
size_RB = 12; % number of sub-carrier per RB
N_ZC = size_RB-1;
L_sub_frame = 14;
j = 1i;
CFO = 0.1; % normalized CFO
N_frames = 4; % at least 3
N_sub_frame = 10*N_frames; % how many simulated sub_frame you want
FFT_size = 128;
N_zeros = (FFT_size-size_RB)/2; % Number of zero subcarriers in upper and lower frequencies
L_CP = round(4.6875/(66.7)*FFT_size); % Number of samples of the CP
L_symbol = (FFT_size + L_CP);
L_frame = (FFT_size + L_CP)*L_sub_frame*10;
L_signal = (FFT_size + L_CP)*L_sub_frame*N_sub_frame;
normalized_time = 0 : 1 : L_signal-1;
SNR_start = 0; % in dB
SNR_end = 30; % in dB
N_subframe_observation = 10; % length of observation for syncronization
N_loop = 1000; % number of runs, for good statistics
type_first_estim = 2; % 1 -> estimation by mean, 2-> estimation by majority
matrix_error_theta_1 = zeros(N_loop,SNR_end-SNR_start+1);
matrix_error_theta_2 = zeros(N_loop,SNR_end-SNR_start+1);
matrix_error_angle_1 = zeros(N_loop,SNR_end-SNR_start+1);
matrix_error_angle_2 = zeros(N_loop,SNR_end-SNR_start+1);
matrix_error_angle_3 = zeros(N_loop,SNR_end-SNR_start+1);
matrix_error_BOF = zeros(N_loop,SNR_end-SNR_start+1);
for SNR = SNR_start : 2 : SNR_end
for loop = 1 : N_loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Creation of the signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ZC sequence in frequency domain
vec_n = 0:N_ZC-1;
f_ZC_sequence = exp(-j*pi*u*vec_n.*(vec_n+1)/N_ZC);
f_NPSS_symbol = [f_ZC_sequence.';0]; % one NPSS symbol
f_NPSS_frame = [zeros(size_RB,3),kron(ones(1,L_sub_frame-3),f_NPSS_symbol)];
% OFDM sub_frame in frequency domain -> modulation : QPSK
%random QPSK elements:
f_OFDM_frames = (2*randi([0,1],size_RB,L_sub_frame*N_sub_frame)-1) + j*(2*randi([0,1],size_RB,L_sub_frame*N_sub_frame)-1);
%replace the k*6th subframes by f_NPSS_frame:
f_LTE_frames = f_OFDM_frames;
for k = 0 : N_frames-1
N_index = k*10*L_sub_frame + 85;
f_LTE_frames(:,N_index:N_index+13) = f_NPSS_frame;
end
% IFFT: get frames in time domain (Parralel representation)
f_zero_carriers = zeros(N_zeros,L_sub_frame*N_sub_frame);
f_ups_LTE_frames = [f_zero_carriers;f_LTE_frames;f_zero_carriers]; % add zero carriers up and down the symbols
t_P_LTE_frames = ifft(f_ups_LTE_frames,FFT_size);
% Add CP (Parralel representation)
t_P_LTE_frames_CP = [t_P_LTE_frames(end-L_CP+1:end,:);t_P_LTE_frames];
% Parralel to series conversion
t_S_LTE_frames = reshape(t_P_LTE_frames_CP,1,[]);
% Add a channel frequency offset (CFO)
t_S_received_frames = t_S_LTE_frames.*exp(j*2*pi*CFO*normalized_time/FFT_size);
% Add noise
P_signal = sum(abs(t_S_received_frames).^2)/length(t_S_received_frames);
P_noise = P_signal*10^(-SNR/20);
init_noise = randn(size(t_S_received_frames));
normalized_noise = init_noise/sqrt(sum(abs(init_noise).^2)/length(init_noise));
noise = sqrt(P_noise)*normalized_noise;
t_S_noisy_frames = t_S_received_frames + noise;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Time and frequency synchronization
% The principle is based on the croos-correlation between the received
% sequence and the transmitted SC sequence.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Get an observation, the duration of which is one frame length. The
% beginning of the stored samples is at 1 frame +- 0.5 frame
index_start = L_frame + randi([-L_frame/2,L_frame/2],1);
observation = t_S_noisy_frames(index_start:index_start+1.5*L_frame-1);
f_oversampl_NPSS_symbol = [f_zero_carriers(:,1);f_NPSS_symbol;f_zero_carriers(:,1)];
t_NPPS_unit = ifft(f_oversampl_NPSS_symbol,FFT_size);
t_NPPS_correl = [t_NPPS_unit(end-L_CP+1:end);t_NPPS_unit];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Estimation of start of the symbols and the CFO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[ theta_estim, estim_CFO ] = first_synchro( observation, L_frame, L_sub_frame, FFT_size, L_symbol, N_subframe_observation, L_CP, SNR, type_first_estim );
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Time and frequency synchronization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
new_index_start = index_start + theta_estim - 1;
new_vec_time = new_index_start-1 : 1 : new_index_start+1.5*L_frame-2;
new_observation = t_S_noisy_frames(new_index_start:new_index_start+1.5*L_frame-1).*exp(-j*2*pi*estim_CFO*new_vec_time/FFT_size);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Second synchronization: beginning of frame (BOF)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[ BOF ] = second_synchro( new_observation, f_NPSS_symbol , L_frame, L_symbol, FFT_size, L_CP, N_zeros );
exact_index = L_symbol - rem(index_start,L_symbol) + 2;
[error_theta_1,ind_error1] = min([abs(exact_index - theta_estim-L_symbol), abs(exact_index - theta_estim),abs(exact_index - theta_estim+L_symbol)]);
% [error_theta_2,ind_error2] = min([abs(exact_index - theta_estim_2-137), abs(exact_index - theta_estim_2),abs(exact_index - theta_estim_2+137)]);
error_CFO_1 = CFO - estim_CFO;
% error_CFO_2 = CFO - estim_CFO_1;
% error_CFO_3 = CFO - estim_CFO_2;
vec_exact_index = 85 : 140 : N_frames*140;
estim_BOF = ceil((index_start-1)/L_symbol) + BOF ;
error_BOF = min(abs(estim_BOF-vec_exact_index));
matrix_error_theta_1(loop,SNR-SNR_start+1) = error_theta_1;
% matrix_error_theta_2(loop,SNR-SNR_start+1) = error_theta_2;
matrix_error_angle_1(loop,SNR-SNR_start+1) = error_CFO_1;
% matrix_error_angle_2(loop,SNR-SNR_start+1) = error_CFO_2;
% matrix_error_angle_3(loop,SNR-SNR_start+1) = error_CFO_3;
matrix_error_BOF(loop,SNR-SNR_start+1) = error_BOF;
end
end
plot(SNR_start:2:SNR_end,sqrt(sum(abs(matrix_error_theta_1(:,1:2:SNR_end+1)).^2)/N_loop))
hold
% plot(SNR_start:2:SNR_end,sqrt(sum(abs(matrix_error_theta_2(:,1:2:SNR_end+1)).^2)/N_loop))
figure
plot(SNR_start:2:SNR_end,sqrt(sum(abs(matrix_error_angle_1(:,1:2:SNR_end+1)).^2)/N_loop))
hold
% plot(SNR_start:SNR_end,sum(abs(matrix_error_angle_2(:,1:31)))/N_loop)
% plot(SNR_start:SNR_end,sum(abs(matrix_error_angle_3(:,1:31)))/N_loop)
% plot(SNR_start:2:SNR_end,sqrt(sum(abs(matrix_error_angle_2(:,1:2:SNR_end+1)).^2)/N_loop),'s')
% plot(SNR_start:2:SNR_end,sqrt(sum(abs(matrix_error_angle_3(:,1:2:SNR_end+1)).^2)/N_loop),'d')
figure
plot(SNR_start:2:SNR_end,sqrt(sum(abs(matrix_error_BOF(:,1:2:SNR_end+1)).^2)/N_loop))
hold
save

View File

@@ -0,0 +1,18 @@
/***********************************************************************
**********************************************************************/
/*! \file PHY/LTE_REFSIG/primary_synch_NB_IoT.c
* \Narrowband Primary Synchronisation Signal(NPSS) for NB-IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
// 12x11= 132 RE ( x 2= 264 since Re,Img).
// For the In-band case: the RE dedicated to LTE pilots are supposed to overwrite 16 REs of the NPSS signal.
short primary_synch_NB_IoT[264] = {32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,-32767,0,31439,9231,21457,24763,4663,-32434,31439,-9232,-13612,-29806,31439,-9232,4663,-32434,21457,24763,31439,9231,-32767,0,0,0,-32767,0,31439,9231,21457,24763,4663,-32434,31439,-9232,-13612,-29806,31439,-9232,4663,-32434,21457,24763,31439,9231,-32767,0,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0,-32767,0,31439,9231,21457,24763,4663,-32434,31439,-9232,-13612,-29806,31439,-9232,4663,-32434,21457,24763,31439,9231,-32767,0,0,0,32767,0,-31440,-9232,-21458,-24764,-4664,32433,-31440,9231,13611,29805,-31440,9231,-4664,32433,-21458,-24764,-31440,-9232,32767,-1,0,0};

View File

@@ -0,0 +1,20 @@
function [ BOF ] = Fc_second_synchro( new_observation, f_NPSS_symbol , L_frame, L_symbol, FFT_size, L_CP , N_zeros )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
% new_obs_reshape = reshape(new_observation(1:L_frame), L_symbol, []);
new_obs_reshape = reshape(new_observation, L_symbol, []);
t_new_obs_CP_remov = new_obs_reshape(L_CP+1:end,:);
f_new_symbols = fft(t_new_obs_CP_remov,FFT_size);
for n = 1 : length(f_new_symbols(1,:))
corr(:,n) = xcorr(f_new_symbols(N_zeros+1:N_zeros+12,n),f_NPSS_symbol);
mean = sum(abs(corr(:,n)));
mm(n) = sum((abs(corr(:,n))-mean).^2);
end
for k = 1 : length(mm) - 13
min_var(k) = sum(mm(k:k+13));
end
[~,BOF] = min(min_var);
end

1
openair1/PHY/LTE_TRANSPORT/dci.c Normal file → Executable file
View File

@@ -536,4 +536,3 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
return(num_pdcch_symbols);
}

View File

@@ -219,6 +219,136 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
free_eNB_dlsch(dlsch);
return(NULL);
}
/*
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(//unsigned char Kmimo,
//unsigned char Mdlharq,
uint32_t Nsoft,
//unsigned char N_RB_DL,
uint8_t abstraction_flag,
NB_IoT_DL_FRAME_PARMS* frame_parms)
{
NB_IoT_eNB_NDLSCH_t *dlsch;
unsigned char exit_flag = 0,i,j,r,aa,layer;
int re;
unsigned char bw_scaling =1;
// switch (N_RB_DL) {
// case 6:
// bw_scaling =16;
// break;
//
// case 25:
// bw_scaling =4;
// break;
//
// case 50:
// bw_scaling =2;
// break;
//
// default:
// bw_scaling =1;
// break;
// }
dlsch = (NB_IoT_eNB_NDLSCH_t *)malloc16(sizeof(NB_IoT_eNB_NDLSCH_t));
if (dlsch) {
bzero(dlsch,sizeof(NB_IoT_eNB_NDLSCH_t));
dlsch->Mlimit = 4;//max number of retransmission
dlsch->Nsoft = Nsoft;
for (layer=0; layer<4; layer++) {
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*));
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
}
}
}
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*));
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
}
//In NB-IoT we have only 1 HARQ process for each User-------------
dlsch->harq_process = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
LOG_T(PHY, "[NB-IoT] Required mem size %d (bw scaling %d), dlsch->harq_process %p\n",
MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling,dlsch->harq_process);
if (dlsch->harq_process) {
bzero(dlsch->harq_process,sizeof(LTE_DL_eNB_HARQ_t));
// dlsch->harq_processes[i]->first_tx=1;
dlsch->harq_process->b = (unsigned char*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
if (dlsch->harq_process->b) {
bzero(dlsch->harq_process->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
} else {
printf("Can't get b\n");
exit_flag=1;
}
if (abstraction_flag==0) {
//XXX MAX_NUM_DLSCH_SEGMENTS may should be changed for NB-IoT
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
// account for filler in first segment and CRCs for multiple segment case
dlsch->harq_process->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
dlsch->harq_process->d[r] = (uint8_t*)malloc16((96+12+3+(3*6144)));
if (dlsch->harq_process->c[r]) {
bzero(dlsch->harq_process->c[r],((r==0)?8:0) + 3+ 768);
} else {
printf("Can't get c\n");
exit_flag=2;
}
if (dlsch->harq_process->d[r]) {
bzero(dlsch->harq_process->d[r],(96+12+3+(3*6144)));
} else {
printf("Can't get d\n");
exit_flag=2;
}
}
}
} else {
printf("Can't get harq_p %d\n",i);
exit_flag=3;
}
//---------------------------------------------
if (exit_flag==0) {
dlsch->harq_process->round=0;
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
if (dlsch->harq_process->d[r])
dlsch->harq_process->d[r][j] = LTE_NULL;
}
return(dlsch);
}
}
// memory allocation failed for ndlsch
LOG_D(PHY,"new_eNB_ndlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(LTE_eNB_DLSCH_t));
free_eNB_dlsch(dlsch);
return(NULL);
}
*/
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
unsigned char Mdlharq;
@@ -256,6 +386,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
}
int dlsch_encoding_2threads0(te_params *tep) {
int dlsch_encoding_2threads0(te_params *tep) {
@@ -325,6 +456,7 @@ int dlsch_encoding_2threads0(te_params *tep) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_OUT);
return(0);
}
}
extern int oai_exit;
@@ -353,7 +485,7 @@ void *te_thread(void *param) {
return(NULL);
}
/*if(opp_enabled == 1 && te_wakeup_stats0->p_time>50*3000){
/* if(opp_enabled == 1 && te_wakeup_stats0->p_time>50*3000){
print_meas_now(te_wakeup_stats0,"coding_wakeup",stderr);
printf("te_thread0 delay for waking up in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
}*/
@@ -554,6 +686,7 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
}
int dlsch_encoding_all(PHY_VARS_eNB *eNB,
unsigned char *a,
uint8_t num_pdcch_symbols,

View File

@@ -178,17 +178,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
void init_scrambling_lut(void) {
uint32_t s;
int i=0,j;
for (s=0;s<=65535;s++) {
for (j=0;j<16;j++) {
scrambling_lut[i++] = (uint8_t)((s>>j)&1);
}
}
}
void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
int mbsfn_flag,
@@ -242,3 +232,16 @@ void init_unscrambling_lut(void) {
}
}
}
void init_scrambling_lut() {
uint32_t s;
int i=0,j;
for (s=0;s<=65535;s++) {
for (j=0;j<16;j++) {
scrambling_lut[i++] = (uint8_t)((s>>j)&1);
}
}
}

View File

@@ -19,6 +19,10 @@
* contact@openairinterface.org
*/
#ifndef __DLSCH_TBS_FULL_H__
#define __DLSCH_TBS_FULL_H__
#define TBStable_rowCnt 27
/** \brief "Transport block size table"
@@ -54,3 +58,10 @@ unsigned int TBStable[TBStable_rowCnt][110] = {{16,32,56,88,120,152,176,208,224,
};
unsigned int TBStable1C[32] = {40, 56, 72, 120, 136, 144, 176, 208, 224, 256, 280, 296, 328, 336, 392, 488, 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1224, 1288, 1384, 1480, 1608, 1736};
#endif

View File

@@ -36,8 +36,13 @@
#include "transport_proto.h"
#include "PHY/phy_extern.h"
#include "PHY/sse_intrin.h"
#ifdef PHY_ABSTRACTION
#include "SIMULATION/TOOLS/defs.h"
#endif
#include "PHY/LTE_REFSIG/lte_refsig.h"
//#define DEBUG_PBCH 1
//#define DEBUG_PBCH_ENCODING
//#define INTERFERENCE_MITIGATION 1

View File

@@ -1,362 +0,0 @@
/*
* 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/LTE_TRANSPORT/proto.h
* \brief Function prototypes for PHY physical/transport channel processing and generation V8.6 2009-03
* \author R. Knopp, F. Kaltenberger
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __LTE_TRANSPORT_PROTO_NB_IOT__H__
#define __LTE_TRANSPORT_PROTO_NB_IOT__H__
#include "PHY/defs_L1_NB_IoT.h"
//#include <math.h>
//NPSS
int generate_npss_NB_IoT(int32_t **txdataF,
short amp,
NB_IoT_DL_FRAME_PARMS *frame_parms,
unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
unsigned short slot_offset,
unsigned short RB_IoT_ID); // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
//NSSS
int generate_sss_NB_IoT(int32_t **txdataF,
int16_t amp,
NB_IoT_DL_FRAME_PARMS *frame_parms,
uint16_t symbol_offset, // symbol_offset = 3 for NB-IoT
uint16_t slot_offset,
unsigned short frame_number, // new attribute (Get value from higher layer), it does not exist for LTE
unsigned short RB_IoT_ID); // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
//*****************Vincent part for Cell ID estimation from NSSS ******************//
int rx_nsss_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int32_t *tot_metric);
int nsss_extract_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **nsss_ext,
int l);
//NRS
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
unsigned short RB_IoT_ID, // RB reserved for NB-IoT
unsigned short With_NSSS); // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
//NPBCH
int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
unsigned short id_offset,
uint32_t *re_allocated);
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID);
void npbch_scrambling(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length);
// Functions below implement 36-211 and 36-212
/*Function to pack the DCI*/
// newly added function for NB-IoT , does not exist for LTE
void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,
void *pdu,
rnti_t rnti,
unsigned char dci_size_bytes,
unsigned char aggregation,
unsigned char dci_size_bits,
unsigned char dci_fmt,
uint8_t npdcch_start_symbol);
/*Use the UL DCI Information to configure PHY and also Pack the DCI*/
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
uint8_t UE_id,
uint8_t aggregation,
uint8_t npdcch_start_symbol);
/*Use the DL DCI Information to configure PHY and also Pack the DCI*/
int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t npdcch_start_symbol);
/*Function for DCI encoding, scrambling, modulation*/
uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
uint8_t Num_dci,
DCI_ALLOC_NB_IoT_t *dci_alloc,
int16_t amp,
NB_IoT_DL_FRAME_PARMS *fp,
int32_t **txdataF,
uint32_t subframe,
uint8_t npdcch_start_symbol);
/*!
\brief Decoding of PUSCH/ACK/RI/ACK from 36-212.
@param phy_vars_eNB Pointer to eNB top-level descriptor
@param proc Pointer to RXTX proc variables
@param UE_id ID of UE transmitting this PUSCH
@param subframe Index of subframe for PUSCH
@param control_only_flag Receive PUSCH with control information only
@param Nbundled Nbundled parameter for ACK/NAK scrambling from 36-212/36-213
@param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
@returns 0 on success
*/
unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag);
//NB-IoT version
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(//unsigned char Kmimo,
//unsigned char Mdlharq,
uint32_t Nsoft,
//unsigned char N_RB_DL,
uint8_t abstraction_flag,
NB_IoT_DL_FRAME_PARMS* frame_parms);
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t abstraction_flag);
uint8_t subframe2harq_pid_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe);
/** \brief Compute Q (modulation order) based on I_MCS for PUSCH. Implements table 8.6.1-1 from 36.213.
@param I_MCS */
//uint8_t get_Qm_ul_NB_IoT(uint8_t I_MCS);
unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU);
/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe)
\brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
- CRC computation and addition
- Code block segmentation and sub-block CRC addition
- Channel coding (Turbo coding)
- Rate matching (sub-block interleaving, bit collection, selection and transmission
- Code block concatenation
@param eNB Pointer to eNB PHY context
@param input_buffer Pointer to input buffer for sub-frame
@param frame_parms Pointer to frame descriptor structure
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch Pointer to dlsch to be encoded
@param frame Frame number
@param subframe Subframe number
@param rm_stats Time statistics for rate-matching
@param te_stats Time statistics for turbo-encoding
@param i_stats Time statistics for interleaving
@returns status
*/
int32_t dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_DLSCH_t *dlsch,
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G, // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
void rx_ulsch_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id,
NB_IoT_eNB_NULSCH_t **ulsch,
uint8_t cooperation_flag);
void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
int32_t **rxdataF_ext,
// uint32_t first_rb,
//uint32_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block
uint8_t N_sc_RU, // number of subcarriers in UL
uint32_t I_sc, // subcarrier indication field
uint32_t nb_rb,
uint8_t l,
uint8_t Ns,
NB_IoT_DL_FRAME_PARMS *frame_parms);
void extract_CQI_NB_IoT(void *o,UCI_format_NB_IoT_t uci_format,NB_IoT_eNB_UE_stats *stats,uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode);
//*****************Vincent part for nprach ******************//
void RX_NPRACH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_buffer);
uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int16_t *Rx_sub_sampled_buffer,
uint16_t sub_sampling_rate,
uint16_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
uint32_t estimated_TA_coarse,
char coarse);
uint8_t NPRACH_detection_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_sub_sampled_buffer, uint16_t sub_sampling_rate, uint32_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES);
int16_t* sub_sampling_NB_IoT(int16_t *input_buffer, uint32_t length_input, uint32_t *length_ouput, uint16_t sub_sampling_rate);
//************************************************************//
//*****************Vincent part for ULSCH demodulation ******************//
uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc);
void generate_grouphop_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
void init_ul_hopping_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
void rotate_single_carrier_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint8_t UE_id,
uint8_t symbol,
uint8_t Qm);
void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint8_t UE_id,
uint8_t symbol);
int32_t ulsch_bpsk_llr_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *ulsch_llr,
uint8_t symbol,
uint8_t uint8_t,
int16_t **llrp);
int32_t ulsch_qpsk_llr_NB_IoT(
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *ulsch_llr,
uint8_t symbol,
uint8_t nb_rb,
int16_t **llrp);
void rotate_bpsk_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint8_t UE_id,
uint8_t symbol);
//************************************************************//
//************************************************************//
//*****************Vincent part for DLSCH demodulation ******************//
int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
unsigned char eNB_id,
unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
uint32_t frame,
uint8_t subframe,
unsigned char symbol,
unsigned char first_symbol_flag,
unsigned char i_mod,
unsigned char harq_pid);
unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
int **dl_ch_estimates,
int **rxdataF_ext,
int **dl_ch_estimates_ext,
unsigned short pmi,
unsigned char *pmi_ext,
unsigned int *rb_alloc,
unsigned char symbol,
unsigned char subframe,
uint32_t frame,
uint32_t high_speed_flag,
NB_IoT_DL_FRAME_PARMS *frame_parms);
void dlsch_channel_level_NB_IoT(int **dl_ch_estimates_ext,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t *avg,
uint8_t symbol,
unsigned short nb_rb);
void dlsch_channel_compensation_NB_IoT(int **rxdataF_ext,
int **dl_ch_estimates_ext,
int **dl_ch_mag,
int **dl_ch_magb,
int **rxdataF_comp,
int **rho,
NB_IoT_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
uint8_t first_symbol_flag,
unsigned char mod_order,
unsigned short nb_rb,
unsigned char output_shift,
PHY_MEASUREMENTS_NB_IoT *measurements);
int dlsch_qpsk_llr_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *dlsch_llr,
uint8_t symbol,
uint8_t first_symbol_flag,
uint16_t nb_rb,
int16_t **llr32p,
uint8_t beamforming_mode);
//************************************************************//
#endif

View File

@@ -138,6 +138,7 @@ typedef struct {
} LTE_DL_eNB_HARQ_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
@@ -481,5 +482,9 @@ typedef struct {
} LTE_eNB_ULSCH_t;
//---------------------------------------------------------------------------------------
/**@}*/
#endif

View File

@@ -20,6 +20,7 @@
*/
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110],TBStable1C[32];
extern unsigned short lte_cqi_eff1024[16];
extern char lte_cqi_snr_dB[15];
extern short conjugate[8],conjugate2[8];

View File

@@ -36,6 +36,7 @@
#include "nfapi_interface.h"
#include "transport_common_proto.h"
// Functions below implement 36-211 and 36-212
/** @addtogroup _PHY_TRANSPORT_
@@ -122,8 +123,6 @@ int32_t dlsch_encoding(PHY_VARS_eNB *eNB,
time_stats_t *i_stats);
/** \fn dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
uint8_t num_pdcch_symbols,

View File

@@ -152,6 +152,88 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uin
return(NULL);
}
/*
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag)
{
NB_IoT_eNB_NULSCH_t *ulsch;
uint8_t exit_flag = 0,i,r;
unsigned char bw_scaling =1;
// switch (N_RB_UL) {
// case 6:
// bw_scaling =16;
// break;
//
// case 25:
// bw_scaling =4;
// break;
//
// case 50:
// bw_scaling =2;
// break;
//
// default:
// bw_scaling =1;
// break;
// }
ulsch = (NB_IoT_eNB_NULSCH_t *)malloc16(sizeof(NB_IoT_eNB_NULSCH_t));
if (ulsch) {
memset(ulsch,0,sizeof(LTE_eNB_ULSCH_t));
//MP: add some parameters in npusch structure for convolutional coding to be set
ulsch->Mlimit = 4;
ulsch->harq_process = (LTE_UL_eNB_HARQ_t *)malloc16(sizeof(LTE_UL_eNB_HARQ_t));
if (ulsch->harq_process) {
memset(ulsch->harq_process,0,sizeof(LTE_UL_eNB_HARQ_t));
ulsch->harq_process->b = (uint8_t*)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
if (ulsch->harq_process->b)
memset(ulsch->harq_process->b,0,MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
else
exit_flag=3;
if (abstraction_flag==0) {
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS/bw_scaling; r++) {
ulsch->harq_process->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+768);
if (ulsch->harq_process->c[r])
memset(ulsch->harq_process->c[r],0,((r==0)?8:0) + 3+768);
else
exit_flag=2;
ulsch->harq_process->d[r] = (short*)malloc16(((3*8*6144)+12+96)*sizeof(short));
if (ulsch->harq_process->d[r])
memset(ulsch->harq_process->d[r],0,((3*8*6144)+12+96)*sizeof(short));
else
exit_flag=2;
}
ulsch->harq_process->subframe_scheduling_flag = 0;
}
} else {
exit_flag=1;
}
if (exit_flag==0)
return(ulsch);
}
LOG_E(PHY,"new_ue_ulsch: exit_flag = %d\n",exit_flag);
free_eNB_ulsch(ulsch);
return(NULL);
}
*/
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch) {
unsigned char i;
@@ -212,7 +294,7 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH) {
int ulsch_decoding_data_2thread0(td_params *tdp) {
int ulsch_decoding_data_2thread0(td_params* tdp) {
PHY_VARS_eNB *eNB = tdp->eNB;
int UE_id = tdp->UE_id;
int harq_pid = tdp->harq_pid;
@@ -544,6 +626,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
return( (ret>proc->tdp.ret) ? ret : proc->tdp.ret );
}
int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) {
unsigned int r,r_offset=0,Kr,Kr_bytes;
uint8_t crc_type;

View File

@@ -642,9 +642,11 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t *rxF = (uint32_t*)&rxdataF_comp[0][((int32_t)symbol*frame_parms->N_RB_DL*12)];
uint32_t *llr32;
int len;
uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol;
/*
if (first_symbol_flag==1) {
llr32 = (uint32_t*)dlsch_llr;
@@ -659,6 +661,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
}
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
if (frame_parms->nb_antenna_ports_eNB!=1)
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
@@ -668,8 +671,9 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4);
} else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
} else {
len = (nb_rb*12) - pbch_pss_sss_adjust;
len = nb_rb*12;
}

View File

@@ -30,6 +30,7 @@
* \warning
*/
#include "PHY/types.h"
#include "PHY/defs_UE.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "PHY/phy_extern_ue.h"
@@ -39,6 +40,7 @@
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "openair2/LAYER2/MAC/mac_proto.h"
#include "common_lib.h"
#include "PHY/INIT/phy_init.h"

View File

@@ -35,6 +35,7 @@
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
#include <math.h>
#include "nfapi_interface.h"
#include "PHY/defs_L1_NB_IoT.h"
// Functions below implement 36-211 and 36-212
@@ -42,6 +43,10 @@
* @{
*/
/** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
\brief This function frees memory allocated for a particular DLSCH at UE
@param dlsch Pointer to DLSCH to be removed
@@ -63,10 +68,202 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch);
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag);
int32_t dlsch_encoding_SIC(PHY_VARS_UE *ue,
uint8_t *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
void dlsch_encoding_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t *DLSCH_pdu,
LTE_eNB_DLSCH_t *dlsch);
// Functions below implement 36-211
/** \fn allocate_REs_in_RB(int32_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
int16_t *qam_table_s,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t use2ndpilots,
LTE_DL_FRAME_PARMS *frame_parms);
\brief Fills RB with data
\param txdataF pointer to output data (frequency domain signal)
\param jj index to output (from CW 1)
\param jj2 index to output (from CW 2)
\param re_offset index of the first RE of the RB
\param symbol_offset index to the OFDM symbol
\param dlsch0_harq Pointer to Transport block 0 HARQ structure
\param dlsch0_harq Pointer to Transport block 1 HARQ structure
\param pilots =1 if symbol_offset is an OFDM symbol that contains pilots, 0 otherwise
\param amp Amplitude for symbols
\param qam_table_s0 pointer to scaled QAM table for Transport Block 0 (by rho_a or rho_b)
\param qam_table_s1 pointer to scaled QAM table for Transport Block 1 (by rho_a or rho_b)
\param re_allocated pointer to allocation counter
\param skip_dc offset for positive RBs
\param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS
\param ue_spec_rs UE specific RS indicator
\param nb_antennas_tx_phy Physical antenna elements which can be different with antenna port number, especially in beamforming case
\param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH
\param frame_parms Frame parameter descriptor
*/
// Functions below implement 36-211
/** \fn allocate_REs_in_RB(int32_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
int16_t *qam_table_s,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t use2ndpilots,
LTE_DL_FRAME_PARMS *frame_parms);
\brief Fills RB with data
\param txdataF pointer to output data (frequency domain signal)
\param jj index to output (from CW 1)
\param jj index to output (from CW 2)
\param re_offset index of the first RE of the RB
\param symbol_offset index to the OFDM symbol
\param dlsch0_harq Pointer to Transport block 0 HARQ structure
\param dlsch0_harq Pointer to Transport block 1 HARQ structure
\param pilots =1 if symbol_offset is an OFDM symbol that contains pilots, 0 otherwise
\param amp Amplitude for symbols
\param qam_table_s0 pointer to scaled QAM table for Transport Block 0 (by rho_a or rho_b)
\param qam_table_s1 pointer to scaled QAM table for Transport Block 1 (by rho_a or rho_b)
\param re_allocated pointer to allocation counter
\param skip_dc offset for positive RBs
\param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS
\param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH
\param frame_parms Frame parameter descriptor
*/
int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
int32_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t lprime,
uint8_t mprime,
uint8_t Ns,
int *P1_SHIFT,
int *P2_SHIFT);
/** \fn int32_t dlsch_modulation(int32_t **txdataF,
int16_t amp,
uint32_t sub_frame_offset,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch);
\brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for DLSCH.
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param sub_frame_offset Offset of this subframe in units of subframes (usually 0)
@param frame_parms Pointer to frame descriptor
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch0 Pointer to Transport Block 0 DLSCH descriptor for this allocation
@param dlsch1 Pointer to Transport Block 0 DLSCH descriptor for this allocation
*/
int32_t dlsch_modulation_SIC(int32_t **sic_buffer,
uint32_t sub_frame_offset,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0,
int G);
/*
\brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH.
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param subframe_offset Offset of this subframe in units of subframes (usually 0)
@param frame_parms Pointer to frame descriptor
@param dlsch Pointer to DLSCH descriptor for this allocation
*/
int mch_modulation(int32_t **txdataF,
int16_t amp,
uint32_t subframe_offset,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_eNB_DLSCH_t *dlsch);
/** \brief Top-level generation function for eNB TX of MBSFN
@param phy_vars_eNB Pointer to eNB variables
@param a Pointer to transport block
@param abstraction_flag
*/
//void generate_mch(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_NB_IoT_t *proc,uint8_t *a);
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
@param phy_vars_eNB Pointer to eNB variables
@param proc Pointer to RXn-TXnp4 proc information
@param mcs MCS for MBSFN
@param ndi new data indicator
@param rdvix
*/
void fill_eNB_dlsch_MCH(PHY_VARS_eNB *phy_vars_eNB,int mcs,int ndi,int rvidx);
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
@param phy_vars_ue Pointer to UE variables
@param mcs MCS for MBSFN
@param eNB_id index of eNB in ue variables
*/
void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eNB_id);
/** \brief Receiver processing for MBSFN, symbols can be done separately for time/CPU-scheduling purposes
@param phy_vars_ue Pointer to UE variables
@param eNB_id index of eNB in ue variables
@param subframe Subframe index of PMCH
@param symbol Symbol index on which to act
*/
void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id);
int rx_pmch(PHY_VARS_UE *phy_vars_ue,
unsigned char eNB_id,
uint8_t subframe,
@@ -89,6 +286,69 @@ void dump_mch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_co
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
for N subframes.
@param phy_vars_eNB Pointer to eNB variables
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param N Number of sub-frames to generate
*/
void generate_pilots(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t N);
/**
\brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) for one slot only
@param phy_vars_eNB Pointer to eNB variables
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param slot index (0..19)
@param first_pilot_only (0 no)
*/
int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t slot,
int first_pilot_only);
/*
int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
int32_t **txdataF,
int16_t amp);
*/
void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti,
uint8_t beamforming_mode);
int32_t generate_pss(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint16_t l,
uint16_t Ns);
int32_t generate_pss_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t sect_id);
int32_t generate_sss(int32_t **txdataF,
short amp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned short symbol,
unsigned short slot_offset);
int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch,
int32_t **txdataF,
int32_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *pbch_pdu,
uint8_t frame_mod4);
int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu);
/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception.
@param stream0_in Input from channel compensated (MR combined) stream 0
@param stream1_in Input from channel compensated (MR combined) stream 1
@@ -1437,7 +1697,7 @@ int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id);
double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id,
uint8_t subframe);
uint8_t subframe);
uint8_t sinr2cqi(double sinr,uint8_t trans_mode);

View File

@@ -0,0 +1,337 @@
/*
* 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.0 (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
*/
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/extern_NB_IoT.h"
//#include "PHY/sse_intrin.h"
// This is 512/(1:256) in __m128i format
int16_t inv_ch_NB_IoT[256*8] = {512,512,512,512,512,512,512,512,
256,256,256,256,256,256,256,256,
170,170,170,170,170,170,170,170,
128,128,128,128,128,128,128,128,
102,102,102,102,102,102,102,102,
85,85,85,85,85,85,85,85,
73,73,73,73,73,73,73,73,
64,64,64,64,64,64,64,64,
56,56,56,56,56,56,56,56,
51,51,51,51,51,51,51,51,
46,46,46,46,46,46,46,46,
42,42,42,42,42,42,42,42,
39,39,39,39,39,39,39,39,
36,36,36,36,36,36,36,36,
34,34,34,34,34,34,34,34,
32,32,32,32,32,32,32,32,
30,30,30,30,30,30,30,30,
28,28,28,28,28,28,28,28,
26,26,26,26,26,26,26,26,
25,25,25,25,25,25,25,25,
24,24,24,24,24,24,24,24,
23,23,23,23,23,23,23,23,
22,22,22,22,22,22,22,22,
21,21,21,21,21,21,21,21,
20,20,20,20,20,20,20,20,
19,19,19,19,19,19,19,19,
18,18,18,18,18,18,18,18,
18,18,18,18,18,18,18,18,
17,17,17,17,17,17,17,17,
17,17,17,17,17,17,17,17,
16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,
15,15,15,15,15,15,15,15,
15,15,15,15,15,15,15,15,
14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,14,
13,13,13,13,13,13,13,13,
13,13,13,13,13,13,13,13,
13,13,13,13,13,13,13,13,
12,12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12,
11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,
10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,
9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
};
void freq_equalization_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
uint8_t symbol,
uint16_t Msc_RS,
uint8_t Qm)
{
uint16_t re;
int16_t amp;
#if defined(__x86_64__) || defined(__i386__)
__m128i *ul_ch_mag128,*ul_ch_magb128,*rxdataF_comp128;
rxdataF_comp128 = (__m128i *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128 = (__m128i *)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_magb128 = (__m128i *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
#elif defined(__arm__)
int16x8_t *ul_ch_mag128,*ul_ch_magb128,*rxdataF_comp128;
rxdataF_comp128 = (int16x8_t*)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128 = (int16x8_t*)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_magb128 = (int16x8_t*)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
#endif
for (re=0; re<(Msc_RS>>2); re++) {
amp=(*((int16_t*)&ul_ch_mag128[re]));
if (amp>255)
amp=255;
// printf("freq_eq: symbol %d re %d => %d,%d,%d, (%d) (%d,%d) => ",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,inv_ch[8*amp],*((int16_t*)(&ul_ch_mag128[re]))*inv_ch[8*amp],*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
#if defined(__x86_64__) || defined(__i386__)
rxdataF_comp128[re] = _mm_mullo_epi16(rxdataF_comp128[re],*((__m128i *)&inv_ch_NB_IoT[8*amp]));
// if (Qm==4)
// ul_ch_mag128[re] = _mm_set1_epi16(324); // this is 512*2/sqrt(10)
// else {
// ul_ch_mag128[re] = _mm_set1_epi16(316); // this is 512*4/sqrt(42)
// ul_ch_magb128[re] = _mm_set1_epi16(158); // this is 512*2/sqrt(42)
// }
#elif defined(__arm__)
rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],*((int16x8_t *)&inv_ch_NB_IoT[8*amp]));
// if (Qm==4)
// ul_ch_mag128[re] = vdupq_n_s16(324); // this is 512*2/sqrt(10)
//else {
// ul_ch_mag128[re] = vdupq_n_s16(316); // this is 512*4/sqrt(42)
// ul_ch_magb128[re] = vdupq_n_s16(158); // this is 512*2/sqrt(42)
//}
#endif
// printf("(%d,%d)\n",*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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.0 (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
*/
//#include "PHY/types.h"
#include "PHY/defs_L1_NB_IoT.h"
//#include "PHY/extern.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
#define DEBUG_PHY
int NB_IoT_est_timing_advance_pusch(PHY_VARS_eNB_NB_IoT* eNB,uint8_t UE_id)
{
static int first_run=1;
static int max_pos_fil2=0;
int temp, i, aa, max_pos=0, max_val=0;
short Re,Im,coef=24576;
short ncoef = 32768 - coef;
NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
NB_IoT_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time[0];
uint8_t cyclic_shift = 0;
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
temp = 0;
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)];
Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)];
temp += (Re*Re/2) + (Im*Im/2);
}
if (temp > max_val) {
max_pos = i;
max_val = temp;
}
}
if (max_pos>frame_parms->ofdm_symbol_size/2)
max_pos = max_pos-frame_parms->ofdm_symbol_size;
// filter position to reduce jitter
if (first_run == 1) {
first_run=0;
max_pos_fil2 = max_pos;
} else
max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15;
#ifdef DEBUG_PHY
LOG_D(PHY,"frame %d: max_pos = %d, max_pos_fil = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,max_pos_fil2,sync_pos);
#endif //DEBUG_PHY
return(max_pos_fil2-sync_pos);
}

View File

@@ -0,0 +1,637 @@
/*
* 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.0 (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: lte_sync_time.c
purpose: coarse timing synchronization for LTE (using PSS)
author: florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
date: 22.10.2009
*/
//#include <string.h>
#include "PHY/LTE_ESTIMATION/defs_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/extern_NB_IoT.h"
// #include "SCHED/extern_NB_IoT.h"
#include <math.h>
/*
#ifdef OPENAIR2
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "RRC/NBIOT/extern.h"
#include "PHY_INTERFACE/extern.h"
#endif
*/
//#define DEBUG_PHY
int* sync_corr_ue0 = NULL;
// int* sync_corr_ue1 = NULL;
// int* sync_corr_ue2 = NULL;
int sync_tmp[2048*4] __attribute__((aligned(32)));
short syncF_tmp[2048*2] __attribute__((aligned(32)));
int lte_sync_time_init_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *common_vars
{
int i,k,k2,l;
sync_corr_ue0_NB_IoT = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
// sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
// sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
if (sync_corr_ue0) {
#ifdef DEBUG_PHY
msg("[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue0);
#endif
//common_vars->sync_corr = sync_corr;
} else {
msg("[openair][LTE_PHY][SYNC] sync_corr_ue0 not allocated\n");
return(-1);
}
// if (sync_corr_ue1) {
// #ifdef DEBUG_PHY
// msg("[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue1);
// #endif
// //common_vars->sync_corr = sync_corr;
// } else {
// msg("[openair][LTE_PHY][SYNC] sync_corr_ue1 not allocated\n");
// return(-1);
// }
// if (sync_corr_ue2) {
// #ifdef DEBUG_PHY
// msg("[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue2);
// #endif
// //common_vars->sync_corr = sync_corr;
// } else {
// msg("[openair][LTE_PHY][SYNC] sync_corr_ue2 not allocated\n");
// return(-1);
// }
// primary_synch0_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
// Consider the CPs 10 normal length + 1 longer due to first symbol in slot
primary_synch0_time_NB_IoT = (int16_t *)malloc16((frame_parms->ofdm_symbol_size*11 + frame_parms->nb_prefix_samples*10 + frame_parms->nb_prefix_samples0)*sizeof(int16_t)*2); // 11 symbols per subframe dedicated to primary synchro
if (primary_synch0_time_NB_IoT) {
// bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
bzero(primary_synch0_time_NB_IoT,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2*11);
#ifdef DEBUG_PHY
msg("[openair][LTE_PHY][SYNC] primary_synch0_time allocated at %p\n", primary_synch0_time_NB_IoT);
#endif
} else {
msg("[openair][LTE_PHY][SYNC] primary_synch0_time not allocated\n");
return(-1);
}
// primary_synch1_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
// primary_synch1_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
// if (primary_synch1_time) {
// // bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
// bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
// #ifdef DEBUG_PHY
// msg("[openair][LTE_PHY][SYNC] primary_synch1_time allocated at %p\n", primary_synch1_time);
// #endif
// } else {
// msg("[openair][LTE_PHY][SYNC] primary_synch1_time not allocated\n");
// return(-1);
// }
// // primary_synch2_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
// primary_synch2_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
// if (primary_synch2_time) {
// // bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
// bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
// #ifdef DEBUG_PHY
// msg("[openair][LTE_PHY][SYNC] primary_synch2_time allocated at %p\n", primary_synch2_time);
// #endif
// } else {
// msg("[openair][LTE_PHY][SYNC] primary_synch2_time not allocated\n");
// return(-1);
// }
// generate oversampled sync_time sequences
if (frame_parms->NB_IoT_RB_ID <= (frame_parms->N_RB_DL>>1)) { // NB-IoT RB is in the first half
k = frame_parms->ofdm_symbol_size - frame_parms->N_RB_DL*6 + frame_parms->NB_IoT_RB_ID*12;
}else{// second half: DC carrier offset
k = 1 + 6*(2*frame_parms->NB_IoT_RB_ID - frame_parms->N_RB_DL);
}
for (l=0; l<11 ; l++){
k2 = k;
for (i=0; i<12; i++) { // 12 subcarriers in NB-IoT
syncF_tmp[2*k2] = primary_synch_NB_IoT[12*l + 2*i]>>2; //we need to shift input to avoid overflow in fft
syncF_tmp[2*k2+1] = primary_synch_NB_IoT[12*l + 2*i+1]>>2;
k2++;
}
switch (frame_parms->N_RB_DL) {
case 6:
idft128((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 25:
idft512((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 50:
idft1024((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 75:
idft1536((short*)syncF_tmp, /// complex input
(short*)sync_tmp,
1); /// complex output
break;
case 100:
idft2048((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
default:
LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
for (i=0; i<frame_parms->ofdm_symbol_size; i++)
if (l < 4){ // Skip longest CP length
((int32_t*)primary_synch0_time_NB_IoT)[l*(frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) + i] = sync_tmp[i];
}else{ // take into account the longest CP length is second slot of subframe
((int32_t*)primary_synch0_time_NB_IoT)[frame_parms->nb_prefix_samples0 + frame_parms->ofdm_symbol_size +
(l-1)*(frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) + i] = sync_tmp[i];
}
}
// k=frame_parms->ofdm_symbol_size-36;
// for (i=0; i<72; i++) {
// syncF_tmp[2*k] = primary_synch1[2*i]>>2; //we need to shift input to avoid overflow in fft
// syncF_tmp[2*k+1] = primary_synch1[2*i+1]>>2;
// k++;
// if (k >= frame_parms->ofdm_symbol_size) {
// k++; // skip DC carrier
// k-=frame_parms->ofdm_symbol_size;
// }
// }
// switch (frame_parms->N_RB_DL) {
// case 6:
// idft128((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 25:
// idft512((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 50:
// idft1024((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 75:
// idft1536((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 100:
// idft2048((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// default:
// LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
// break;
// }
// for (i=0; i<frame_parms->ofdm_symbol_size; i++)
// ((int32_t*)primary_synch1_time)[i] = sync_tmp[i];
// k=frame_parms->ofdm_symbol_size-36;
// for (i=0; i<72; i++) {
// syncF_tmp[2*k] = primary_synch2[2*i]>>2; //we need to shift input to avoid overflow in fft
// syncF_tmp[2*k+1] = primary_synch2[2*i+1]>>2;
// k++;
// if (k >= frame_parms->ofdm_symbol_size) {
// k++; // skip DC carrier
// k-=frame_parms->ofdm_symbol_size;
// }
// }
// switch (frame_parms->N_RB_DL) {
// case 6:
// idft128((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 25:
// idft512((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 50:
// idft1024((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 75:
// idft1536((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// case 100:
// idft2048((short*)syncF_tmp, /// complex input
// (short*)sync_tmp, /// complex output
// 1);
// break;
// default:
// LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
// break;
// }
// for (i=0; i<frame_parms->ofdm_symbol_size; i++)
// ((int32_t*)primary_synch2_time)[i] = sync_tmp[i];
#ifdef DEBUG_PHY
write_output("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
// write_output("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
// write_output("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
#endif
return (1);
}
void lte_sync_time_free_NB_IoT(void)
{
if (sync_corr_ue0) {
msg("Freeing sync_corr_ue (%p)...\n",sync_corr_ue0);
free(sync_corr_ue0);
}
// if (sync_corr_ue1) {
// msg("Freeing sync_corr_ue (%p)...\n",sync_corr_ue1);
// free(sync_corr_ue1);
// }
// if (sync_corr_ue2) {
// msg("Freeing sync_corr_ue (%p)...\n",sync_corr_ue2);
// free(sync_corr_ue2);
// }
if (primary_synch0_time_NB_IoT) {
msg("Freeing primary_sync0_time ...\n");
free(primary_synch0_time_NB_IoT);
}
// if (primary_synch1_time) {
// msg("Freeing primary_sync1_time ...\n");
// free(primary_synch1_time);
// }
// if (primary_synch2_time) {
// msg("Freeing primary_sync2_time ...\n");
// free(primary_synch2_time);
// }
sync_corr_ue0_NB_IoT = NULL;
// sync_corr_ue1 = NULL;
// sync_corr_ue2 = NULL;
primary_synch0_time_NB_IoT = NULL;
// primary_synch1_time = NULL;
// primary_synch2_time = NULL;
}
static inline int abs32(int x)
{
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
}
#ifdef DEBUG_PHY
int debug_cnt=0;
#endif
#define SHIFT 17
int lte_sync_time_NB_IoT(int **rxdata, ///rx data in time domain
NB_IoT_DL_FRAME_PARMS *frame_parms,
int *eNB_id)
{
// perform a time domain correlation using the oversampled sync sequence
unsigned int n, ar, /*s,*/ peak_pos, peak_val/*, sync_source*/;
int result;//result2;
// int sync_out[3] = {0,0,0},sync_out2[3] = {0,0,0};
// int tmp[3] = {0,0,0};
int sync_out = 0;//sync_out2 = 0;
int tmp = 0;
// int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1;
int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti;
//msg("[SYNC TIME] Calling sync_time.\n");
if (sync_corr_ue0 == NULL) {
msg("[SYNC TIME] sync_corr_ue0 not yet allocated! Exiting.\n");
return(-1);
}
// if (sync_corr_ue1 == NULL) {
// msg("[SYNC TIME] sync_corr_ue1 not yet allocated! Exiting.\n");
// return(-1);
// }
// if (sync_corr_ue2 == NULL) {
// msg("[SYNC TIME] sync_corr_ue2 not yet allocated! Exiting.\n");
// return(-1);
// }
peak_val = 0;
peak_pos = 0;
// sync_source = 0;
for (n=0; n<length; n+=4) {
#ifdef RTAI_ENABLED
// This is necessary since the sync takes a long time and it seems to block all other threads thus screwing up RTAI. If we pause it for a little while during its execution we give RTAI a chance to catch up with its other tasks.
if ((n%frame_parms->samples_per_tti == 0) && (n>0) && (openair_daq_vars.sync_state==0)) {
#ifdef DEBUG_PHY
msg("[SYNC TIME] pausing for 1000ns, n=%d\n",n);
#endif
rt_sleep(nano2count(1000));
}
#endif
sync_corr_ue0[n] = 0;
// sync_corr_ue0[n+length] = 0;
// sync_corr_ue1[n] = 0;
// sync_corr_ue1[n+length] = 0;
// sync_corr_ue2[n] = 0;
// sync_corr_ue2[n+length] = 0;
// for (s=0; s<3; s++) {
// sync_out[s]=0;
// sync_out2[s]=0;
// }
// if (n<(length-frame_parms->ofdm_symbol_size-frame_parms->nb_prefix_samples)) {
if (n<(length-frame_parms->ofdm_symbol_size)) {
//calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n];
// for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
for (ar=0; ar<1; ar++) {
result = dot_product((short*)primary_synch0_time_NB_IoT, (short*) &(rxdata[ar][n]), 11*frame_parms->ofdm_symbol_size, SHIFT);
// result2 = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n+length]), 11*frame_parms->ofdm_symbol_size, SHIFT);
((short*)sync_corr_ue0_NB_IoT)[2*n] += ((short*) &result)[0];
((short*)sync_corr_ue0_NB_IoT)[2*n+1] += ((short*) &result)[1];
// ((short*)sync_corr_ue0)[2*(length+n)] += ((short*) &result2)[0];
// ((short*)sync_corr_ue0)[(2*(length+n))+1] += ((short*) &result2)[1];
((short*)sync_out)[0] += ((short*) &result)[0];
((short*)sync_out)[1] += ((short*) &result)[1];
// ((short*)sync_out2)[0] += ((short*) &result2)[0];
// ((short*)sync_out2)[1] += ((short*) &result2)[1];
}
// for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
// result = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
// result2 = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
// ((short*)sync_corr_ue1)[2*n] += ((short*) &result)[0];
// ((short*)sync_corr_ue1)[2*n+1] += ((short*) &result)[1];
// ((short*)sync_corr_ue1)[2*(length+n)] += ((short*) &result2)[0];
// ((short*)sync_corr_ue1)[(2*(length+n))+1] += ((short*) &result2)[1];
// ((short*)sync_out)[2] += ((short*) &result)[0];
// ((short*)sync_out)[3] += ((short*) &result)[1];
// ((short*)sync_out2)[2] += ((short*) &result2)[0];
// ((short*)sync_out2)[3] += ((short*) &result2)[1];
// }
// for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
// result = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
// result2 = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
// ((short*)sync_corr_ue2)[2*n] += ((short*) &result)[0];
// ((short*)sync_corr_ue2)[2*n+1] += ((short*) &result)[1];
// ((short*)sync_corr_ue2)[2*(length+n)] += ((short*) &result2)[0];
// ((short*)sync_corr_ue2)[(2*(length+n))+1] += ((short*) &result2)[1];
// ((short*)sync_out)[4] += ((short*) &result)[0];
// ((short*)sync_out)[5] += ((short*) &result)[1];
// ((short*)sync_out2)[4] += ((short*) &result2)[0];
// ((short*)sync_out2)[5] += ((short*) &result2)[1];
// }
}
// calculate the absolute value of sync_corr[n]
sync_corr_ue0_NB_IoT[n] = abs32(sync_corr_ue0_NB_IoT[n]);
// sync_corr_ue0[n+length] = abs32(sync_corr_ue0[n+length]);
// sync_corr_ue1[n] = abs32(sync_corr_ue1[n]);
// sync_corr_ue1[n+length] = abs32(sync_corr_ue1[n+length]);
// sync_corr_ue2[n] = abs32(sync_corr_ue2[n]);
// sync_corr_ue2[n+length] = abs32(sync_corr_ue2[n+length]);
// for (s=0; s<3; s++) {
tmp = (abs32(sync_out)>>1); // + (abs32(sync_out2)>>1);
if (tmp>peak_val) {
peak_val = tmp;
peak_pos = n;
// sync_source = s;
/*
printf("s %d: n %d sync_out %d, sync_out2 %d (sync_corr %d,%d), (%d,%d) (%d,%d)\n",s,n,abs32(sync_out[s]),abs32(sync_out2[s]),sync_corr_ue0[n],
sync_corr_ue0[n+length],((int16_t*)&sync_out[s])[0],((int16_t*)&sync_out[s])[1],((int16_t*)&sync_out2[s])[0],((int16_t*)&sync_out2[s])[1]);
*/
}
// }
}
// *eNB_id = sync_source;
LOG_D(PHY,"[UE] lte_sync_time: Peak found at pos %d, val = %d (%d dB)\n",peak_pos,peak_val,dB_fixed(peak_val)/2);
#ifdef DEBUG_PHY
if (debug_cnt == 0) {
write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
// write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
// write_output("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
write_output("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
// exit(-1);
} else {
debug_cnt++;
}
#endif
return(peak_pos);
}
//#define DEBUG_PHY
// int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
// LTE_DL_FRAME_PARMS *frame_parms,
// uint32_t length,
// uint32_t *peak_val_out,
// uint32_t *sync_corr_eNB)
// {
// // perform a time domain correlation using the oversampled sync sequence
// unsigned int n, ar, peak_val, peak_pos;
// uint64_t mean_val;
// int result;
// short *primary_synch_time;
// int eNB_id = frame_parms->Nid_cell%3;
// // msg("[SYNC TIME] Calling sync_time_eNB(%p,%p,%d,%d)\n",rxdata,frame_parms,eNB_id,length);
// if (sync_corr_eNB == NULL) {
// LOG_E(PHY,"[SYNC TIME] sync_corr_eNB not yet allocated! Exiting.\n");
// return(-1);
// }
// switch (eNB_id) {
// case 0:
// primary_synch_time = (short*)primary_synch0_time;
// break;
// case 1:
// primary_synch_time = (short*)primary_synch1_time;
// break;
// case 2:
// primary_synch_time = (short*)primary_synch2_time;
// break;
// default:
// LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n");
// return (-1);
// }
// peak_val = 0;
// peak_pos = 0;
// mean_val = 0;
// for (n=0; n<length; n+=4) {
// sync_corr_eNB[n] = 0;
// if (n<(length-frame_parms->ofdm_symbol_size-frame_parms->nb_prefix_samples)) {
// //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n];
// for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
// result = dot_product((short*)primary_synch_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
// //((short*)sync_corr)[2*n] += ((short*) &result)[0];
// //((short*)sync_corr)[2*n+1] += ((short*) &result)[1];
// sync_corr_eNB[n] += abs32(result);
// }
// }
// /*
// if (eNB_id == 2) {
// printf("sync_time_eNB %d : %d,%d (%d)\n",n,sync_corr_eNB[n],mean_val,
// peak_val);
// }
// */
// mean_val += sync_corr_eNB[n];
// if (sync_corr_eNB[n]>peak_val) {
// peak_val = sync_corr_eNB[n];
// peak_pos = n;
// }
// }
// mean_val/=length;
// *peak_val_out = peak_val;
// if (peak_val <= (40*(uint32_t)mean_val)) {
// LOG_D(PHY,"[SYNC TIME] No peak found (%u,%u,%"PRIu64",%"PRIu64")\n",peak_pos,peak_val,mean_val,40*mean_val);
// return(-1);
// } else {
// LOG_D(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %"PRIu64"\n",peak_pos,peak_val,mean_val);
// return(peak_pos);
// }
// }
// #ifdef PHY_ABSTRACTION
// #include "SIMULATION/TOOLS/defs.h"
// #include "SIMULATION/RF/defs.h"
// //extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
// int lte_sync_time_eNB_emul(PHY_VARS_eNB *phy_vars_eNB,
// uint8_t sect_id,
// int32_t *sync_val)
// {
// uint8_t UE_id;
// uint8_t CC_id = phy_vars_eNB->CC_id;
// msg("[PHY] EMUL lte_sync_time_eNB_emul eNB %d, sect_id %d\n",phy_vars_eNB->Mod_id,sect_id);
// *sync_val = 0;
// for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
// //msg("[PHY] EMUL : eNB %d checking UE %d (PRACH %d) PL %d dB\n",phy_vars_eNB->Mod_id,UE_id,PHY_vars_UE_g[UE_id]->generate_prach,UE2eNB[UE_id][phy_vars_eNB->Mod_id]->path_loss_dB);
// if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach == 1) && (phy_vars_eNB->Mod_id == (UE_id % NB_eNB_INST))) {
// *sync_val = 1;
// return(0);
// }
// }
// return(-1);
// }
// #endif

View File

@@ -0,0 +1,357 @@
/*
* 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.0 (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/LTE_ESTIMATION/lte_sync_timefreq.c
* \brief Initial time frequency scan of entire LTE band
* \author R. Knopp
* \date 2014
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr
* \note
* \warning
*/
/* file: lte_sync_timefreq.c
purpose: scan for likely cells over entire LTE band using PSS. Provides coarse frequency offset in addtition to 10 top likelihoods per PSS sequence
author: raymond.knopp@eurecom.fr
date: 23.01.2015
*/
//#include "defs.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/extern_NB_IoT.h"
#if defined(__x86_64__) || defined(__i386__)
#include "PHY/LTE_ESTIMATION/pss6144.h"
extern void print_shorts(char*,__m128i*);
#endif
void lte_sync_timefreq_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int band,unsigned int DL_freq)
{
#if defined(__x86_64__) || defined(__i386__)
UE_SCAN_INFO_NB_IoT_t *scan_info = &ue->scan_info[band];
int16_t spectrum[12288] __attribute__((aligned(32)));
int16_t spectrum_p5ms[12288] __attribute__((aligned(32)));
int i,f,band_idx;
__m128i autocorr0[256/4],autocorr1[256/4],autocorr2[256/4];
__m128i autocorr0_t[256/4],autocorr1_t[256/4],autocorr2_t[256/4];
__m128i tmp_t[256/4];
int32_t *rxp;
int16_t *sp;
__m128i *sp2 = NULL;
__m128i s;
int re,re256;
__m128i mmtmp00,mmtmp01,mmtmp02,mmtmp10,mmtmp11,mmtmp12;
int maxcorr[3],minamp,pos=0,pssind;
int16_t *pss6144_0 = NULL, *pss6144_1 = NULL, *pss6144_2 = NULL;
/* char fname[100],vname[100];*/
for (i=0; i<38400*4; i+=3072) { // steps of 200 us with 100 us overlap, 0 to 5s
// write_output("rxsig0.m","rxs0",ue->lte_ue_common_vars.rxdata[0],30720,1,1);
//for (i = 15360-3072*2; i<15360+3072+1; i+=3072) {
//compute frequency-domain representation of 6144-sample chunk
rxp = &ue->common_vars.rxdata[0][i];
sp=spectrum;
while (1) {
//compute frequency-domain representation of 6144-sample chunk
// Nick : Not sure about scale
dft6144((int16_t *)rxp,
sp,1);
/*
printf("i %d: sp %p\n",i,sp);
if (i==12288) {
write_output("scan6144F.m","s6144F",sp,6144,1,1);
write_output("scan6144.m","s6144",rxp,6144,1,1);
write_output("pss0_6144.m","pss0",pss6144_0_0,256,1,1);
}*/
for (f = -2000; f<2000; f++) { // this is -10MHz to 10 MHz in 5 kHz steps
if ((f<-256)||(f>=0)) { // no split around DC
// printf("No split, f %d (%d)\n",f,f&3);
// align filters and input buffer pointer to 128-bit
switch (f&3) {
case 0:
pss6144_0 = &pss6144_0_0[0];
pss6144_1 = &pss6144_1_0[0];
pss6144_2 = &pss6144_2_0[0];
sp2 = (f<0) ? (__m128i*)&sp[12288+(f<<1)] : (__m128i*)&sp[(f<<1)];
break;
case 1:
pss6144_0 = &pss6144_0_1[0];
pss6144_1 = &pss6144_1_1[0];
pss6144_2 = &pss6144_2_1[0];
sp2 = (f<0) ? (__m128i*)&sp[12286+(f<<1)] : (__m128i*)&sp[-2+(f<<1)];
break;
case 2:
pss6144_0 = &pss6144_0_2[0];
pss6144_1 = &pss6144_1_2[0];
pss6144_2 = &pss6144_2_2[0];
sp2 = (f<0) ? (__m128i*)&sp[12284+(f<<1)] : (__m128i*)&sp[-4+(f<<1)];
break;
case 3:
pss6144_0 = &pss6144_0_3[0];
pss6144_1 = &pss6144_1_3[0];
pss6144_2 = &pss6144_2_3[0];
sp2 = (f<0) ? (__m128i*)&sp[12282+(f<<1)] : (__m128i*)&sp[-6+(f<<1)];
break;
}
re256=32;
for (re = 0; re<256/4; re++) { // loop over 256 points of upsampled PSS
// printf("f %d, re %d\n",f,re);
s = sp2[re];
mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
autocorr0[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
autocorr1[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
autocorr2[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
re256 = (re256+1)&0x3f;
}
} else { // Split around DC, this is the negative frequencies
// printf("split around DC, f %d (f/4 %d, f&3 %d)\n",f,f>>2,f&3);
// align filters and input buffer pointer to 128-bit
switch (f&3) {
case 0:
pss6144_0 = &pss6144_0_0[0];
pss6144_1 = &pss6144_1_0[0];
pss6144_2 = &pss6144_2_0[0];
sp2 = (__m128i*)&sp[12288+(f<<1)];
break;
case 1:
pss6144_0 = &pss6144_0_1[0];
pss6144_1 = &pss6144_1_1[0];
pss6144_2 = &pss6144_2_1[0];
sp2 = (__m128i*)&sp[12286+(f<<1)];
break;
case 2:
pss6144_0 = &pss6144_0_2[0];
pss6144_1 = &pss6144_1_2[0];
pss6144_2 = &pss6144_2_2[0];
sp2 = (__m128i*)&sp[12284+(f<<1)];
break;
case 3:
pss6144_0 = &pss6144_0_3[0];
pss6144_1 = &pss6144_1_3[0];
pss6144_2 = &pss6144_2_3[0];
sp2 = (__m128i*)&sp[12282+(f<<1)];
break;
}
re256 = 32;
for (re = 0; re<(-f+3)/4; re++) { // loop over 256 points of upsampled PSS
s = sp2[re];
/* printf("re %d, %p\n",re,&sp2[re]);
print_shorts("s",&s);
print_shorts("pss",&((__m128i*)pss6144_0)[re]);*/
mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
autocorr0[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
autocorr1[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
autocorr2[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
re256 = (re256+1)&0x3f;
}
// This is the +ve frequencies
// align filters to 128-bit
sp2 = (__m128i*)&sp[0];
switch (f&3) {
case 0:
pss6144_0 = &pss6144_0_0[256];
pss6144_1 = &pss6144_1_0[256];
pss6144_2 = &pss6144_2_0[256];
break;
case 1:
pss6144_0 = &pss6144_0_1[256];
pss6144_1 = &pss6144_1_1[256];
pss6144_2 = &pss6144_2_1[256];
break;
case 2:
pss6144_0 = &pss6144_0_2[256];
pss6144_1 = &pss6144_1_2[256];
pss6144_2 = &pss6144_2_2[256];
break;
case 3:
pss6144_0 = &pss6144_0_3[256];
pss6144_1 = &pss6144_1_3[256];
pss6144_2 = &pss6144_2_3[256];
break;
}
for (re = 0; re<(256+f)/4; re++) { // loop over 256 points of upsampled PSS
s = sp2[re];
/* printf("re %d %p\n",re,&sp2[re]);
print_shorts("s",&s);
print_shorts("pss",&((__m128i*)pss6144_0)[re]);*/
mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
autocorr0[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
autocorr1[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
autocorr2[re256] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
re256 = (re256+1)&0x3f;
}
}
// ifft, accumulate energy over two half-frames
idft256((int16_t*)autocorr0,(int16_t*)tmp_t,1);
/*
if (i==12288) {
sprintf(fname,"corr256F_%d.m",abs(f));
sprintf(vname,"c256F_%d",abs(f));
write_output(fname,vname,autocorr0,256,1,1);
sprintf(fname,"corr256_%d.m",abs(f));
sprintf(vname,"c256_%d",abs(f));
write_output(fname,vname,tmp_t,256,1,1);
}*/
memset((void*)autocorr0_t,0,256*4);
memset((void*)autocorr1_t,0,256*4);
memset((void*)autocorr2_t,0,256*4);
for (re=0; re<(256/4); re++)
autocorr0_t[re] = _mm_add_epi32(autocorr0_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
idft256((int16_t*)autocorr1,(int16_t*)tmp_t,1);
for (re=0; re<(256/4); re++)
autocorr1_t[re] = _mm_add_epi32(autocorr1_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
idft256((int16_t*)autocorr2,(int16_t*)tmp_t,1);
for (re=0; re<(256/4); re++)
autocorr2_t[re] = _mm_add_epi32(autocorr2_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
//compute max correlation over time window
maxcorr[0] = 0;
maxcorr[1] = 0;
maxcorr[2] = 0;
for (re=0; re<256; re++) {
if (((int32_t*)autocorr0_t)[re] > maxcorr[0]) {
maxcorr[0]=((int32_t*)autocorr0_t)[re];
}
if (((int32_t*)autocorr1_t)[re] > maxcorr[1])
maxcorr[1]=((int32_t*)autocorr1_t)[re];
if (((int32_t*)autocorr2_t)[re] > maxcorr[2])
maxcorr[2]=((int32_t*)autocorr2_t)[re];
}
for (pssind=0; pssind<3; pssind++) {
minamp=(int)((1<<30)-1);
for (band_idx=0; band_idx<10; band_idx++)
if (minamp > scan_info->amp[pssind][band_idx]) {
minamp = scan_info->amp[pssind][band_idx];
pos = band_idx;
}
if (maxcorr[pssind]>minamp) {
scan_info->amp[pssind][pos]=maxcorr[pssind];
scan_info->freq_offset_Hz[pssind][pos]=((f+128)*5000)+DL_freq;
printf("pss %d, amp %d (%d>%d) freq %u (%d), i %d\n",pssind,dB_fixed(maxcorr[pssind]),maxcorr[pssind],minamp,((f+128)*5000)+DL_freq,f,i);
}
} // loop on pss index
}
if (rxp == &ue->common_vars.rxdata[0][i+38400*4]) {
rxp = &ue->common_vars.rxdata[0][i+38400*4];
sp=spectrum_p5ms;
} else {
break;
}
}
}// loop on time index i
for (band_idx=0; band_idx<10; band_idx++)
printf("pss 0: level %d dB, freq %u\n", dB_fixed(scan_info->amp[0][band_idx]),scan_info->freq_offset_Hz[0][band_idx]);
for (band_idx=0; band_idx<10; band_idx++)
printf("pss 1: level %d dB, freq %u\n", dB_fixed(scan_info->amp[1][band_idx]),scan_info->freq_offset_Hz[1][band_idx]);
for (band_idx=0; band_idx<10; band_idx++)
printf("pss 2: level %d dB, freq %u\n", dB_fixed(scan_info->amp[2][band_idx]),scan_info->freq_offset_Hz[2][band_idx]);
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,161 @@
/***********************************************************************
**********************************************************************/
/*! \file PHY/LTE_REFSIG/lte_dl_cell_spec_NB_IoT.c
* \function called by pilots_NB_IoT.c , TS 36-211, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
/* check if this is required for NB-IoT
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#endif
*/
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h"
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,
unsigned char l,
unsigned char p,
unsigned short RB_IoT_ID) // the ID of the RB dedicated for NB_IoT
{
unsigned char nu,m;
unsigned char mprime,mprime_dword,mprime_qpsk_symb;
unsigned short k,a;
unsigned short NB_IoT_start,bandwidth_even_odd;
int32_t qpsk[4];
a = (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
((short *)&qpsk[0])[0] = a;
((short *)&qpsk[0])[1] = a;
((short *)&qpsk[1])[0] = -a;
((short *)&qpsk[1])[1] = a;
((short *)&qpsk[2])[0] = a;
((short *)&qpsk[2])[1] = -a;
((short *)&qpsk[3])[0] = -a;
((short *)&qpsk[3])[1] = -a;
if ((p==0) && (l==0) )
nu = 0;
else if ((p==0) && (l>0))
nu = 3;
else if ((p==1) && (l==0))
nu = 3;
else if ((p==1) && (l>0))
nu = 0;
else {
printf("lte_dl_cell_spec_NB_IoT: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
//mprime = 110 - eNB->frame_parms.N_RB_DL;
mprime = 109;
// testing if the total number of RBs is even or odd
bandwidth_even_odd = phy_vars_eNB->frame_parms.N_RB_DL % 2; // 0 even, 1 odd
//mprime = 0; // mprime = 0,1 for NB_IoT // for LTE , maximum number of resources blocks (110) - the total number of RB in the selected bandwidth (.... 15 , 25 , 50, 100)
k = (nu + phy_vars_eNB->frame_parms.nushift)%6;
if(RB_IoT_ID < (phy_vars_eNB->frame_parms.N_RB_DL/2))
{ //XXX this mod operation is not valid since the second member is not an integer but double (for the moment i put a cast)
NB_IoT_start = phy_vars_eNB->frame_parms.ofdm_symbol_size - 12*(phy_vars_eNB->frame_parms.N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
} else {
//XXX invalid mod operation (put a cast for the moment)
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
}
k+=NB_IoT_start;
DevAssert( Ns < 20 );
DevAssert( l < 2 );
for (m=0; m<2; m++) {
mprime_dword = mprime>>4;
mprime_qpsk_symb = mprime&0xf;
output[k] = qpsk[(phy_vars_eNB->lte_gold_table_NB_IoT[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb)) & 3]; //TODO should be defined one for NB-IoT
mprime++;
k+=6;
}
return(0);
}
/////////////////////////////////////////////////////////////////////////
/*
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,
unsigned char l,
unsigned char p,
unsigned short RB_IoT_ID) // the ID of the RB dedicated for NB_IoT
{
unsigned char nu,m;
unsigned short k,a;
unsigned short NB_IoT_start,bandwidth_even_odd;
int32_t qpsk[4];
a = (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
((short *)&qpsk[0])[0] = a;
((short *)&qpsk[0])[1] = a;
((short *)&qpsk[1])[0] = -a;
((short *)&qpsk[1])[1] = a;
((short *)&qpsk[2])[0] = a;
((short *)&qpsk[2])[1] = -a;
((short *)&qpsk[3])[0] = -a;
((short *)&qpsk[3])[1] = -a;
if ((p==0) && (l==0) )
nu = 0;
else if ((p==0) && (l>0))
nu = 3;
else if ((p==1) && (l==0))
nu = 3;
else if ((p==1) && (l>0))
nu = 0;
else {
printf("lte_dl_cell_spec_NB_IoT: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
// testing if the total number of RBs is even or odd
bandwidth_even_odd = phy_vars_eNB->frame_parms.N_RB_DL % 2; // 0 even, 1 odd
//mprime = 0; // mprime = 0,1 for NB_IoT // for LTE , maximum number of resources blocks (110) - the total number of RB in the selected bandwidth (.... 15 , 25 , 50, 100)
k = (nu + phy_vars_eNB->frame_parms.nushift)%6;
if(RB_IoT_ID < (phy_vars_eNB->frame_parms.N_RB_DL/2))
{ //XXX this mod operation is not valid since the second member is not an integer but double (for the moment i put a cast)
NB_IoT_start = phy_vars_eNB->frame_parms.ofdm_symbol_size - 12*(phy_vars_eNB->frame_parms.N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
} else {
//XXX invalid mod operation (put a cast for the moment)
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
}
k+=NB_IoT_start;
DevAssert( Ns < 20 );
DevAssert( l < 2 );
for (m=0; m<2; m++) {
output[k] = qpsk[(phy_vars_eNB->lte_gold_table_NB_IoT[Ns][l][0]) & 3]; //TODO should be defined one for NB-IoT
k+=6;
}
return(0);
}
*/

View File

@@ -0,0 +1,82 @@
/***********************************************************************
**********************************************************************/
/*! \file PHY/LTE_REFSIG/lte_gold_NB_IoT.c
* \function called by lte_dl_cell_spec_NB_IoT.c , TS 36-211, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
//#include "defs.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void lte_gold_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table_NB_IoT[20][2][14],uint16_t Nid_cell) // Nid_cell = Nid_cell_NB_IoT
{
unsigned char ns,l,Ncp=1;
unsigned int n,x1,x2;
for (ns=0; ns<20; ns++) {
for (l=0; l<2; l++) {
x2 = Ncp + (Nid_cell<<1) + (((1+(Nid_cell<<1))*(1 + (l+5) + (7*(1+ns))))<<10); //cinit
x1 = 1+ (1<<31);
x2 = x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
for (n=1; n<50; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
}
for (n=0; n<14; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
lte_gold_table_NB_IoT[ns][l][n] = x1^x2;
}
}
}
}
// \brief gold sequenquence generator
//\param x1
//\param x2 this should be set to c_init if reset=1
//\param reset resets the generator
//\return 32 bits of the gold sequence
unsigned int lte_gold_generic_NB_IoT(unsigned int *x1, unsigned int *x2, unsigned char reset)
{
int n;
if (reset) {
*x1 = 1+ (1<<31);
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
for (n=1; n<50; n++) {
*x1 = (*x1>>1) ^ (*x1>>4);
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
}
}
*x1 = (*x1>>1) ^ (*x1>>4);
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
return(*x1^*x2);
}

View File

@@ -0,0 +1,328 @@
/*
* 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.0 (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/LTE_REFSIG/lte_ul_ref_NB_IoT.c
* \function called by lte_dl_cell_spec_NB_IoT.c , TS 36-211, V13.4.0 2017-02
* \author: Vincent Savaux
* \date 2018
* \version 0.0
* \company b<>com
* \email: vincent.savaux@b-com.com
* \note
* \warning
*/
#ifdef MAIN
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#endif
// #include "defs.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h"
// uint16_t dftsizes[33] = {12,24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,864,900,960,972,1080,1152,1200};
// uint16_t ref_primes[33] = {11,23,31,47,59,71,89,107,113,139,179,191,211,239,283,293,317,359,383,431,479,523,571,599,647,719,863,887,953,971,1069,1151,1193};
uint16_t sequence_length[4] = {100,100,100,100}; //the "32" value corresponds to the max gold sequence length
// int16_t *ul_ref_sigs[30][33];
int16_t *ul_ref_sigs_rx_NB_IoT[30][4]; //these contain the sequences in repeated format and quantized to QPSK ifdef IFFT_FPGA
int16_t *ul_ref_sigs_f2_rx_NB_IoT[16]; //this table contain the 16 possible pilots for format 2 NPUSCH
uint16_t u_max[4] = {16,12,14,30}; // maximum u value, see 36.211, Section 10.1.4
/* 36.211 table 5.5.1.2-1 */
char ref12_NB_IoT[360] = {-1,1,3,-3,3,3,1,1,3,1,-3,3,1,1,3,3,3,-1,1,-3,-3,1,-3,3,1,1,-3,-3,-3,-1,-3,-3,1,-3,1,-1,-1,1,1,1,1,-1,-3,-3,1,-3,3,-1,-1,3,1,-1,1,-1,-3,-1,1,-1,1,3,1,-3,3,-1,-1,1,1,-1,-1,3,-3,1,-1,3,-3,-3,-3,3,1,-1,3,3,-3,1,-3,-1,-1,-1,1,-3,3,-1,1,-3,3,1,1,-3,3,1,-1,-1,-1,1,1,3,-1,1,1,-3,-1,3,3,-1,-3,1,1,1,1,1,-1,3,-1,1,1,-3,-3,-1,-3,-3,3,-1,3,1,-1,-1,3,3,-3,1,3,1,3,3,1,-3,1,1,-3,1,1,1,-3,-3,-3,1,3,3,-3,3,-3,1,1,3,-1,-3,3,3,-3,1,-1,-3,-1,3,1,3,3,3,-1,1,3,-1,1,-3,-1,-1,1,1,3,1,-1,-3,1,3,1,-1,1,3,3,3,-1,-1,3,-1,-3,1,1,3,-3,3,-3,-3,3,1,3,-1,-3,3,1,1,-3,1,-3,-3,-1,-1,1,-3,-1,3,1,3,1,-1,-1,3,-3,-1,-3,-1,-1,-3,1,1,1,1,3,1,-1,1,-3,-1,-1,3,-1,1,-3,-3,-3,-3,-3,1,-1,-3,1,1,-3,-3,-3,-3,-1,3,-3,1,-3,3,1,1,-1,-3,-1,-3,1,-1,1,3,-1,1,1,1,3,1,3,3,-1,1,-1,-3,-3,1,1,-3,3,3,1,3,3,1,-3,-1,-1,3,1,3,-3,-3,3,-3,1,-1,-1,3,-1,-3,-3,-1,-3,-1,-3,3,1,-1,1,3,-3,-3,-1,3,-3,3,-1,3,3,-3,3,3,-1,-1,3,-3,-3,-1,-1,-3,-1,3,-3,3,1,-1};
/* 36.211 table 5.5.1.2-2 */
// char ref24[720] = {
// -1,3,1,-3,3,-1,1,3,-3,3,1,3,-3,3,1,1,-1,1,3,-3,3,-3,-1,-3,-3,3,-3,-3,-3,1,-3,-3,3,-1,1,1,1,3,1,-1,3,-3,-3,1,3,1,1,-3,3,-1,3,3,1,1,-3,3,3,3,3,1,-1,3,-1,1,1,-1,-3,-1,-1,1,3,3,-1,-3,1,1,3,-3,1,1,-3,-1,-1,1,3,1,3,1,-1,3,1,1,-3,-1,-3,-1,-1,-1,-1,-3,-3,-1,1,1,3,3,-1,3,-1,1,-1,-3,1,-1,-3,-3,1,-3,-1,-1,-3,1,1,3,-1,1,3,1,-3,1,-3,1,1,-1,-1,3,-1,-3,3,-3,-3,-3,1,1,1,1,-1,-1,3,-3,-3,3,-3,1,-1,-1,1,-1,1,1,-1,-3,-1,1,-1,3,-1,-3,-3,3,3,-1,-1,-3,-1,3,1,3,1,3,1,1,-1,3,1,-1,1,3,-3,-1,-1,1,-3,1,3,-3,1,-1,-3,3,-3,3,-1,-1,-1,-1,1,-3,-3,-3,1,-3,-3,-3,1,-3,1,1,-3,3,3,-1,-3,-1,3,-3,3,3,3,-1,1,1,-3,1,-1,1,1,-3,1,1,-1,1,-3,-3,3,-1,3,-1,-1,-3,-3,-3,-1,-3,-3,1,-1,1,3,3,-1,1,-1,3,1,3,3,-3,-3,1,3,1,-1,-3,-3,-3,3,3,-3,3,3,-1,-3,3,-1,1,-3,1,1,3,3,1,1,1,-1,-1,1,-3,3,-1,1,1,-3,3,3,-1,-3,3,-3,-1,-3,-1,3,-1,-1,-1,-1,-3,-1,3,3,1,-1,1,3,3,3,-1,1,1,-3,1,3,-1,-3,3,-3,-3,3,1,3,1,-3,3,1,3,1,1,3,3,-1,-1,-3,1,-3,-1,3,1,1,3,-1,-1,1,-3,1,3,-3,1,-1,-3,-1,3,1,3,1,-1,-3,-3,-1,-1,-3,-3,-3,-1,-1,-3,3,-1,-1,-1,-1,1,1,-3,3,1,3,3,1,-1,1,-3,1,-3,1,1,-3,-1,1,3,-1,3,3,-1,-3,1,-1,-3,3,3,3,-1,1,1,3,-1,-3,-1,3,-1,-1,-1,1,1,1,1,1,-1,3,-1,-3,1,1,3,-3,1,-3,-1,1,1,-3,-3,3,1,1,-3,1,3,3,1,-1,-3,3,-1,3,3,3,-3,1,-1,1,-1,-3,-1,1,3,-1,3,-3,-3,-1,-3,3,-3,-3,-3,-1,-1,-3,-1,-3,3,1,3,-3,-1,3,-1,1,-1,3,-3,1,-1,-3,-3,1,1,-1,1,-1,1,-1,3,1,-3,-1,1,-1,1,-1,-1,3,3,-3,-1,1,-3,-3,-1,-3,3,1,-1,-3,-1,-3,-3,3,-3,3,-3,-1,1,3,1,-3,1,3,3,-1,-3,-1,-1,-1,-1,3,3,3,1,3,3,-3,1,3,-1,3,-1,3,3,-3,3,1,-1,3,3,1,-1,3,3,-1,-3,3,-3,-1,-1,3,-1,3,-1,-1,1,1,1,1,-1,-1,-3,-1,3,1,-1,1,-1,3,-1,3,1,1,-1,-1,-3,1,1,-3,1,3,-3,1,1,-3,-3,-1,-1,-3,-1,1,3,1,1,-3,-1,-1,-3,3,-3,3,1,-3,3,-3,1,-1,1,-3,1,1,1,-1,-3,3,3,1,1,3,-1,-3,-1,-1,-1,3,1,-3,-3,-1,3,-3,-1,-3,-1,-3,-1,-1,-3,-1,-1,1,-3,-1,-1,1,-1,-3,1,1,-3,1,-3,-3,3,1,1,-1,3,-1,-1,1,1,-1,-1,-3,-1,3,-1,3,-1,1,3,1,-1,3,1,3,-3,-3,1,-1,-1,1,3
// };
// 36.211, Section 10.1.4.1.2, Table 10.1.4.1.2-1
char ref3[36] = {1, -3, -3, 1, -3, -1, 1, -3, 3, 1, -1, -1, 1, -1, 1, 1, -1, 3, 1, 1, -3, 1, 1, -1, 1, 1, 3, 1, 3, -1, 1, 3, 1, 1, 3, 3 };
// 36.211, Section 10.1.4.1.2, Table 10.1.4.1.2-2
char ref6[84] = {1, 1, 1, 1, 3, -3, 1, 1, 3, 1, -3, 3, 1, -1, -1, -1, 1, -3, 1, -1, 3, -3, -1, -1, 1, 3, 1, -1, -1, 3, 1, -3, -3, 1, 3, 1, -1, -1, 1, -3, -3, -1,
-1, -1, -1, 3, -3, -1, 3, -1, 1, -3, -3, 3, 3, -1, 3, -3, -1, 1, 3, -3, 3, -1, 3, 3, -3, 1, 3, 1, -3, -1, -3, 1, -3, 3, -3, -1, -3, 3, -3, 1, 1, -3};
// NB-IoT: 36.211, Section 10.1.4.1.1, Table 10.1.4.1.1-1
int16_t w_n[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1,
1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1,
1, 1, 1, 1,-1,-1,-1,-1, 1, 1, 1, 1,-1,-1,-1,-1,
1,-1, 1,-1,-1, 1,-1, 1, 1,-1, 1,-1,-1, 1,-1, 1,
1, 1,-1,-1,-1,-1, 1, 1, 1, 1,-1,-1,-1,-1, 1, 1,
1,-1,-1, 1,-1, 1, 1,-1, 1,-1,-1, 1,-1, 1, 1,-1,
1, 1, 1, 1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1,
1,-1, 1,-1, 1,-1, 1,-1,-1, 1,-1, 1,-1, 1,-1, 1,
1, 1,-1,-1, 1, 1,-1,-1,-1,-1, 1, 1,-1,-1, 1, 1,
1,-1,-1, 1, 1,-1,-1, 1,-1, 1, 1,-1,-1, 1, 1,-1,
1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1, 1, 1,
1,-1, 1,-1,-1, 1,-1, 1,-1, 1,-1, 1, 1,-1, 1,-1,
1, 1,-1,-1,-1,-1, 1, 1,-1,-1, 1, 1, 1, 1,-1,-1,
1,-1,-1, 1,-1, 1, 1,-1,-1, 1, 1,-1, 1,-1,-1, 1
};
// void generate_ul_ref_sigs(void)
// {
// double qbar,phase;
// unsigned int u,v,Msc_RS,q,m,n;
// // These are the Zadoff-Chu sequences (for RB 3-100)
// for (Msc_RS=2; Msc_RS<33; Msc_RS++) {
// for (u=0; u<30; u++) {
// for (v=0; v<2; v++) {
// qbar = ref_primes[Msc_RS] * (u+1)/(double)31;
// ul_ref_sigs[u][v][Msc_RS] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
// if ((((int)floor(2*qbar))&1) == 0)
// q = (int)(floor(qbar+.5)) - v;
// else
// q = (int)(floor(qbar+.5)) + v;
// #ifdef MAIN
// printf("Msc_RS %d (%d), u %d, v %d -> q %d (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
// #endif
// for (n=0; n<dftsizes[Msc_RS]; n++) {
// m=n%ref_primes[Msc_RS];
// phase = (double)q*m*(m+1)/ref_primes[Msc_RS];
// ul_ref_sigs[u][v][Msc_RS][n<<1] =(int16_t)(floor(32767*cos(M_PI*phase)));
// ul_ref_sigs[u][v][Msc_RS][1+(n<<1)] =-(int16_t)(floor(32767*sin(M_PI*phase)));
// #ifdef MAIN
// if (Msc_RS<5)
// printf("(%d,%d) ",ul_ref_sigs[u][v][Msc_RS][n<<1],ul_ref_sigs[u][v][Msc_RS][1+(n<<1)]);
// #endif
// }
// #ifdef MAIN
// if (Msc_RS<5)
// printf("\n");
// #endif
// }
// }
// }
// // These are the sequences for RB 1
// for (u=0; u<30; u++) {
// ul_ref_sigs[u][0][0] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[0]);
// for (n=0; n<dftsizes[0]; n++) {
// ul_ref_sigs[u][0][0][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4)));
// ul_ref_sigs[u][0][0][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref12[(u*12) + n]/4)));
// }
// }
// // These are the sequences for RB 2
// for (u=0; u<30; u++) {
// ul_ref_sigs[u][0][1] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[1]);
// for (n=0; n<dftsizes[1]; n++) {
// ul_ref_sigs[u][0][1][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4)));
// ul_ref_sigs[u][0][1][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4)));
// }
// }
// }
/*void generate_ul_ref_sigs_rx_NB_IoT(void)
{
unsigned int u,index_Nsc_RU,n; // Vincent: index_Nsc_RU 0,1,2,3 ---> number of sc 1,3,6,12
uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer
int16_t a;
int16_t qpsk[2];
unsigned int x1, x2=35; // NB-IoT: defined in 36.211, Section 10.1.4.1.1
int16_t ref_sigs_sc1[2*sequence_length[0]];
uint32_t s;
a = (ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
qpsk[0] = a;
qpsk[1] = -a;
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
for (index_Nsc_RU=0; index_Nsc_RU<4; index_Nsc_RU++) {
for (u=0; u<u_max[index_Nsc_RU]; u++) {
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc16(2*sizeof(int16_t)*sequence_length[index_Nsc_RU]);
switch (index_Nsc_RU){
case 0: // 36.211, Section 10.1.4.1.1
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*sequence_length[index_Nsc_RU]*12+24)); // *12 is mandatory to fit channel estimation functions
// NB-IoT: for same reason, +24 is added in order to fit the possible subcarrier start shift when index_Nsc_RU = 0, 1, 2 --> see ul_sc_start in channel estimation function
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
if (n!=0 && n%32==0)
{
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
}
ref_sigs_sc1[n<<1] = qpsk[(s>>(n%32))&1]*w_n[16*u+n%16];
// ref_sigs_sc1[1+(n<<1)] = qpsk[(s>>n)&1]*w_n[16*u+n%16];
ref_sigs_sc1[1+(n<<1)] = ref_sigs_sc1[n<<1];
}
if (npusch_format==1){
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][n<<1] = ref_sigs_sc1[n<<1];
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+(n<<1)]= ref_sigs_sc1[1+(n<<1)];
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][12*(n<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+12*(n<<1)+24]= ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
}
if (npusch_format==2){// NB-IoT: to be implemented
printf("Not coded yet\n");
}
break;
case 1: // 36.211, Section 10.1.4.1.2
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*12+24)); // *12 is mandatory to fit channel estimation functions
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref3[(u*3) + n]/4 + alpha3[threetnecyclicshift])));
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+(n<<1)]= (int16_t)(floor(32767*sin(M_PI*ref3[(u*3) + n]/4 + alpha3[threetnecyclicshift])));
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][(n<<1)+24] = (int16_t)(floor(32767*cos(M_PI*ref3[(u*3) + n]/4 )));
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+(n<<1)+24]= (int16_t)(floor(32767*sin(M_PI*ref3[(u*3) + n]/4 )));
}
break;
case 2:
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*12+24)); // *12 is mandatory to fit channel estimation functions
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref6[(u*6) + n]/4 + alpha6[sixtonecyclichift])));
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+(n<<1)]= (int16_t)(floor(32767*sin(M_PI*ref6[(u*6) + n]/4 + alpha6[sixtonecyclichift])));
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][(n<<1)+24] = (int16_t)(floor(32767*cos(M_PI*ref6[(u*6) + n]/4 )));
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+(n<<1)+24]= (int16_t)(floor(32767*sin(M_PI*ref6[(u*6) + n]/4 )));
}
break;
case 3:
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*12+24)); // *12 is mandatory to fit channel estimation functions
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref12_NB_IoT[(u*12) + n]/4)));
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+(n<<1)]= (int16_t)(floor(32767*sin(M_PI*ref12_NB_IoT[(u*12) + n]/4)));
}
break;
}
}
}
}*/
void generate_ul_ref_sigs_rx_NB_IoT(void)
{
unsigned int u,index_Nsc_RU,n,m; // Vincent: index_Nsc_RU 0,1,2,3 ---> number of sc 1,3,6,12
//uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer
int16_t a;
int16_t qpsk[2];
unsigned int x1, x2; // NB-IoT: defined in 36.211, Section 10.1.4.1.1
int16_t ref_sigs_sc1[2*sequence_length[0]]; // this is for format 1
//int16_t ref_sigs_sc1_f2[2*sequence_length[0]]; // this is for format 2
uint32_t s;
a = ONE_OVER_SQRT2_Q15_NB_IoT;
qpsk[0] = a;
qpsk[1] = -a;
//printf("\n\n\n in generate_ul_ref_sigs_rx_NB_IoT %d \n\n\n",a);
for (index_Nsc_RU=0; index_Nsc_RU<4; index_Nsc_RU++)
{
for (u=0; u<u_max[index_Nsc_RU]; u++)
{
// ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc16(2*sizeof(int16_t)*sequence_length[index_Nsc_RU]);
switch (index_Nsc_RU)
{
case 0: // 36.211, Section 10.1.4.1.1
x2=35;
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*sequence_length[index_Nsc_RU]*12+24)); // *12 is mandatory to fit channel estimation functions
ul_ref_sigs_f2_rx_NB_IoT[u] = (int16_t*)malloc(sizeof(int16_t)*(2*12*12+24)); // first "*12" is mandatory to fit channel estimation functions; first "*12" is the length of pilot sequence for format 2
// NB-IoT: for same reason, +24 is added in order to fit the possible subcarrier start shift when index_Nsc_RU = 0, 1, 2 --> see ul_sc_start in channel estimation function
for (n=0; n<sequence_length[index_Nsc_RU]; n++)
{
if (n>0 && n%32==0)
{
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
}
ref_sigs_sc1[n<<1] = qpsk[(s>>(n%32))&1]*w_n[16*u+n%16];
// ref_sigs_sc1[1+(n<<1)] = qpsk[(s>>n)&1]*w_n[16*u+n%16];
ref_sigs_sc1[1+(n<<1)] = ref_sigs_sc1[n<<1];
}
for (n=0; n<sequence_length[index_Nsc_RU]; n++)
{
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][12*(n<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+12*(n<<1)+24]= ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
for (n=0; n<4; n++)
{
for (m=0; m<3; m++)
{
ul_ref_sigs_f2_rx_NB_IoT[u][12*((3*n+m)<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_f2_rx_NB_IoT[u][1+12*((3*n+m)<<1)+24] = ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
}
break;
}
}
}
}
void free_ul_ref_sigs_NB_IoT(void)
{
unsigned int u,index_Nsc_RU;
for (index_Nsc_RU=0; index_Nsc_RU<4; index_Nsc_RU++) {
for (u=0; u<30; u++) {
if (ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU])
free16(ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU],4*sizeof(int16_t)*sequence_length[index_Nsc_RU]);
}
}
}
// void free_ul_ref_sigs(void)
// {
// unsigned int u,index_Nsc_RU;
// for (index_Nsc_RU=0; index_Nsc_RU<4; index_Nsc_RU++) {
// for (u=0; u<30; u++) {
// if (ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU])
// free16(ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU],4*sizeof(int16_t)*sequence_length[index_Nsc_RU]);
// }
// }
// }
#ifdef MAIN
main()
{
//generate_ul_ref_sigs();
generate_ul_ref_sigs_rx();
free_ul_ref_sigs();
}
#endif

120
openair1/PHY/NBIoT_TRANSPO Normal file
View File

@@ -0,0 +1,120 @@
/*
* 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.0 (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
*/
int16_t s_n11_re[336] = {23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, -1, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039};
int16_t s_n11_im[336] = {23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, 0, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852};
int16_t s_n10_re[336] = {-23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, -1, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962};
int16_t s_n10_im[336] = {23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786};
int16_t s_n9_re[336] = {-23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, -1, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808};
int16_t s_n9_im[336] = {-23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, 0, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413};
int16_t s_n8_re[336] = {23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, -1, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608};
int16_t s_n8_im[336] = {-23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728};
int16_t s_n7_re[336] = {23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, -1, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607};
int16_t s_n7_im[336] = {23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728};
int16_t s_n6_re[336] = {-23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, -1, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807};
int16_t s_n6_im[336] = {23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413};
int16_t s_n5_re[336] = {-23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, -1, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961};
int16_t s_n5_im[336] = {-23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786};
int16_t s_n4_re[336] = {23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038};
int16_t s_n4_im[336] = {-23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852};
int16_t s_n3_re[336] = {23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009};
int16_t s_n3_im[336] = {23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622};
int16_t s_n2_re[336] = {-23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, -1, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845};
int16_t s_n2_im[336] = {23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106};
int16_t s_n1_re[336] = {-23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519};
int16_t s_n1_im[336] = {-23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319};
int16_t s_n0_re[336] = {23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004};
int16_t s_n0_im[336] = {-23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, 0, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279};
int16_t s_n_12_re[4032] = {23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004,
-23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519,
-23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, -1, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845,
23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009,
23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038,
-23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, -1, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961,
-23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, -1, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807,
23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, -1, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607,
23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, -1, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608,
-23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, -1, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808,
-23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, -1, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962,
23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, -1, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039};
int16_t s_n_12_im[4032] = {-23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, 0, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279,
-23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319,
23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106,
23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622,
-23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852,
-23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786,
23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413,
23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728,
-23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728,
-23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, 0, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413,
23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786,
23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, 0, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852};

View File

@@ -0,0 +1,481 @@
/* 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.0 (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/LTE_TRANSPORT/SIB_NB_IoT.c
* \Fucntions for the generation of SIB information for NB_IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2018
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include "PHY/NBIoT_TRANSPORT/defs_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/CODING/defs_NB_IoT.h"
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
//#include "PHY/impl_defs_lte_NB_IoT.h"
//#include "PHY/impl_defs_top_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
/////////////////////////////////////////////////////////////////////////////////////////
int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t operation_mode,
uint8_t release_v13_5_0)
{
int done=0;
uint8_t *sib1_pdu = sib1_struct->harq_process->pdu;
uint8_t opr_mode = 3;
if(operation_mode>=2)
{
opr_mode =0;
}
uint8_t tmp =0;
uint8_t rep_val = 0;
uint8_t start_frame = get_start_frame_SIB1_NB_IoT(frame_parms, get_rep_num_SIB1_NB_IoT(sib1_struct->repetition_number_SIB1));
switch( get_rep_num_SIB1_NB_IoT(sib1_struct->repetition_number_SIB1) )
{
case 4:
rep_val = 64;
break;
case 8:
rep_val = 32;
break;
case 16:
rep_val = 16;
break;
default:
printf("Error in SIB1");
}
uint8_t var = 0;
if(start_frame == 1)
{
var =1;
}
if(start_frame>=16)
{
tmp = 1;
}
uint8_t born_inf = 0 + start_frame*tmp;
uint8_t born_sup = 16 + start_frame*tmp;
if((subframe == 4) && (frame%2 == var) && (born_inf<= frame % rep_val) && (frame % rep_val < born_sup ))
{
LOG_D(PHY,"[%3d][%2d] Generating SIB1\n",frame,subframe);
int G = get_G_SIB1_NB_IoT(frame_parms,operation_mode);
if( frame % rep_val == var )
{
dlsch_encoding_NB_IoT(sib1_pdu,
sib1_struct,
8, ///// number_of_subframes_required
G); //// this vallue is fixed, should take into account in future the case of stand-alone & guard-band
dlsch_scrambling_Gen_NB_IoT(frame_parms,
sib1_struct,
8*G,
frame,
subframe*2,
sib1_struct->rnti,
release_v13_5_0,
1);
}
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
opr_mode, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib1_struct,
G, // number of bits per subframe
((frame%16)/2),
4,
RB_IoT_ID);
done =1;
frame_parms->flag_free_sf =1;
}
return(done);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t release_v13_5_0)
{
int done=0;
if( SIB23->active == 1 )
{
//LOG_I(PHY,"[Frame: %d][Subframe: %d]sent SIB23\n",frame,subframe);
uint8_t *SIB23_pdu = SIB23->harq_process->pdu;
uint32_t rep = SIB23->resource_assignment;
uint8_t eutra_control_region = 3;
uint32_t counter_rep = SIB23->counter_repetition_number;
uint32_t pointer_to_sf = SIB23->pointer_to_subframe; /// to identify wich encoded subframe to transmit
int G = get_G_NB_IoT(frame_parms);
uint8_t Nsf = SIB23->resource_assignment; //value 2 or 8
if(counter_rep == rep)
{
dlsch_encoding_NB_IoT(SIB23_pdu,
SIB23,
Nsf, ///// number_of_subframes_required
G); //// this vallue is fixed, should take into account in future the case of stand-alone & guard-band
dlsch_scrambling_Gen_NB_IoT(frame_parms,
SIB23,
Nsf*G,
frame,
subframe*2,
SIB23->rnti,
release_v13_5_0,
1);
}
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutra_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
SIB23,
G, // number of bits per subframe
pointer_to_sf,
subframe,
RB_IoT_ID);
SIB23->counter_repetition_number--;
SIB23->pointer_to_subframe++;
frame_parms->flag_free_sf =1;
if(SIB23->counter_repetition_number == 0)
{
SIB23->active = 0;
}
done =1;
}
return(done);
}
////////////////////////////////////////////////////////////////////////
int generate_NDLSCH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_eNB_NDLSCH_t *RAR,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t release_v13_5_0)
{
int done = 0;
if( RAR->active == 1 )
{
uint8_t *RAR_pdu = RAR->harq_process->pdu;
if(RAR->active_msg2 == 1 && RAR_pdu!=NULL)
{
uint8_t one_byte = RAR_pdu[2]>>3;
uint8_t subcarrier_spacing = one_byte & 0x01;
eNB->ulsch_NB_IoT[0]->harq_process->subcarrier_spacing = subcarrier_spacing;
}
// make different between RAR data and NPDSCH data // add a flag in NPDSCH to switch between RA and normal data transmission
uint32_t rep = RAR->repetition_number;
uint8_t eutra_control_region = 3;
uint32_t counter_rep = RAR->counter_repetition_number;
uint32_t counter_sf_rep = RAR->counter_current_sf_repetition; /// for identifiying when to trigger new scrambling
uint32_t pointer_to_sf = RAR->pointer_to_subframe; /// to identify wich encoded subframe to transmit
int G = get_G_NB_IoT(frame_parms);
uint8_t Nsf = RAR->number_of_subframes_for_resource_assignment;
//LOG_I(PHY,"[Frame: %d][Subframe: %d]sent RAR, rep : %d, counter_rep:%d, Num_res:%d\n",frame,subframe,rep,counter_rep,Nsf);
if( (counter_rep == rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_encoding_NB_IoT(RAR_pdu,
RAR,
Nsf, ///// number_of_subframes_required
G); //// this vallue is fixed, should take into account in future the case of stand-alone & guard-band
dlsch_scrambling_Gen_NB_IoT(frame_parms,
RAR,
Nsf*G,
frame,
subframe*2,
RAR->rnti,
release_v13_5_0,
0);
}
if( (counter_rep != rep) && (counter_sf_rep == 0) && (pointer_to_sf == 0) )
{
dlsch_scrambling_Gen_NB_IoT(frame_parms,
RAR,
Nsf*G,
frame,
subframe*2,
RAR->rnti,
release_v13_5_0,
0);
}
if( rep > 4)
{
RAR->counter_current_sf_repetition++;
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutra_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
RAR,
G, // number of bits per subframe
pointer_to_sf,
subframe,
RB_IoT_ID);
if(RAR->counter_current_sf_repetition == 4)
{
RAR->pointer_to_subframe++;
RAR->counter_current_sf_repetition =0;
if (Nsf == RAR->pointer_to_subframe && (RAR->counter_repetition_number > 4))
{
RAR->counter_repetition_number = RAR->counter_repetition_number-4;
RAR->pointer_to_subframe =0;
RAR->counter_current_sf_repetition =0;
} else {
RAR->active = 0;
RAR->active_msg2 = 0;
done =1;
}
}
} else {
RAR->counter_current_sf_repetition++;
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutra_control_region, //should be replace by start_symbole // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
RAR,
G, // number of bits per subframe
pointer_to_sf,
subframe,
RB_IoT_ID);
if(RAR->counter_current_sf_repetition == rep)
{
RAR->pointer_to_subframe++;
RAR->counter_current_sf_repetition =0;
if (Nsf == RAR->pointer_to_subframe)
{
RAR->active = 0;
RAR->active_msg2 = 0;
done =1;
}
}
}
}
return(done);
}
/////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
int generate_NPDCCH_NB_IoT(NB_IoT_eNB_NPDCCH_t *DCI_1, // add _1 to solve compliation error
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID)
{
int done=0;
for(int i=0; i<2; i++)
{
uint8_t ncce_index = 0; /// = DCI->ncce_index[i];
uint8_t agr_level = 2; /// = DCI->aggregation_level[i];
if( DCI_1->active[i] == 1)
{
//LOG_I(PHY,"[Frame: %d][Subframe: %d]sent DCI\n",frame,subframe);
uint8_t *DCI_pdu = DCI_1->pdu[i];
uint32_t rep = DCI_1->dci_repetitions[i]; /// repetition number
uint8_t eutra_control_region = 3;
uint8_t num_bits_of_DCI =DCI_1->A[i]; //DCI->dci_bits_length; /// value to be passed through nfapi when filling the PHY structures
uint32_t counter_rep = DCI_1->counter_repetition_number[i]; ////// Buffer for repetitions
int G = get_G_NB_IoT(frame_parms);
//////////// uint8_t Nsf = DCI->number_of_subframes_for_resource_assignment;
if( counter_rep == rep)
{
dci_encoding_NB_IoT(DCI_pdu, // Array of two DCI pdus, even if one DCI is to transmit , the number of DCI is indicated in dci_number
DCI_1, ////uint8_t *e[2], // *e should be e[2][G]
num_bits_of_DCI, //////A = number of bits of the DCI
G,
ncce_index,
agr_level);
npdcch_scrambling_NB_IoT(frame_parms,
DCI_1, // Input data
G, // Total number of bits to transmit in one subframe(case of DCI = G)
subframe*2, //XXX we pass the subframe // Slot number (0..19)
ncce_index,
agr_level);
}
if( ((counter_rep %4)== 0) && (counter_rep != rep) )
{
npdcch_scrambling_NB_IoT(frame_parms,
DCI_1, // Input data
G, // Total number of bits to transmit in one subframe(case of DCI = G)
subframe*2, //XXX we pass the subframe // Slot number (0..19)
ncce_index,
agr_level);
}
dci_modulation_NB_IoT(txdataF,
amp,
frame_parms,
eutra_control_region, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
DCI_1,
0, // npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
agr_level,
ncce_index,
subframe,
RB_IoT_ID);
DCI_1->counter_repetition_number[i]--;
if(DCI_1->counter_repetition_number[i] == 0)
{
//printf("DCI REP done\n");
DCI_1->active[i] = 0;
done =1;
}
}
}
return(done);
}
////////////////////////////////////////////////// backup ///////////////////////////
//////////////////////////////////////////////////// SIB23 ////////////////////////////////////////////////////////////////////////
/* if( (subframe >0) && (subframe !=5) && (With_NSSS == 0) && (frame%2==1) && (frame%64<16) ) ////if((subframe != 0) && (subframe != 4) && (subframe != 9) )
{
if( subframe == 1 )
{
dlsch_encoding_NB_IoT(sib23_pdu,
sib23,
8, ///// number_of_subframes_required
236); //////////// G*2
dlsch_scrambling_Gen_NB_IoT(fp, // is called only in subframe 4
sib23,
1888, ////// total_bits
frame,
subframe*2,
eNB->ndlsch_SIB23->rnti);
}
if( subframe < 5 )
{
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib23,
236, // number of bits per subframe
(subframe-1), ///npdsch_data_subframe, data per subframe//subframe index of the data table of npdsch channel (G*Nsf) ((frame%32)/2),values are between 0..Nsf
subframe,
RB_IoT_ID);
} else {
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib23,
236, // number of bits per subframe
(subframe-2),///npdsch_data_subframe, data per subframe//subframe index of the data table of npdsch channel (G*Nsf) ((frame%32)/2),values are between 0..Nsf
subframe,
RB_IoT_ID);
}
}
*/

View File

@@ -0,0 +1,502 @@
/*
* 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.0 (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/LTE_TRANSPORT/dci_NB_IoT.c
* \brief Implements PDCCH physical channel TX/RX procedures (36.211) and DCI encoding/decoding (36.212/36.213). Current LTE compliance V8.6 2009-03.
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
//#include "PHY/defs.h"
//#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/CODING/defs_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h" // /LTE_TRANSPORT/defs_NB_IoT.h
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
//#include "PHY/extern.h"
//////////#include "PHY/extern_NB_IoT.h"
//#include "SCHED/defs.h"
/////////////////////////////#include "SCHED/defs_nb_iot.h"
//#include "SIMULATION/TOOLS/defs.h" // for taus
//#include "PHY/sse_intrin.h"
//#include "assertions.h"
//#include "T.h"
/////////////////////////////////////////////////////////////////////
//static uint8_t d[2][3*(MAX_DCI_SIZE_BITS_NB_IoT + 16) + 96];
//static uint8_t w[2][3*3*(MAX_DCI_SIZE_BITS_NB_IoT+16)];
void dci_encoding_NB_IoT(uint8_t *a, // Array of two DCI pdus, even if one DCI is to transmit , the number of DCI is indicated in dci_number
NB_IoT_eNB_NPDCCH_t *dlcch, ////uint8_t *e[2], // *e should be e[2][G]
uint8_t A,
uint16_t G,
uint8_t ncce_index,
uint8_t agr_level) // Aggregation level
{
uint8_t D = (A + 16);
uint32_t RCC;
uint8_t occupation_size=1;
if(agr_level == 2 && ncce_index == 0)
{
occupation_size=1;
}else{
occupation_size=2;
}
memset((void *)dlcch->npdcch_d[ncce_index],LTE_NULL_NB_IoT,96);
ccode_encode_NB_IoT(A,2,a,dlcch->npdcch_d[ncce_index]+96,dlcch->rnti[ncce_index]); // CRC attachement & Tail-biting convolutional coding
RCC = sub_block_interleaving_cc_NB_IoT(D,dlcch->npdcch_d[ncce_index]+96,dlcch->npdcch_w[ncce_index]); // Interleaving
lte_rate_matching_cc_NB_IoT(RCC,(G/occupation_size),dlcch->npdcch_w[ncce_index],dlcch->npdcch_e[ncce_index]); // Rate Matching
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///The scrambling sequence shall be initialised at the start of the search space and after every 4th NPDCCH subframes.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void npdcch_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NPDCCH_t *dlcch, // Input data
int G, // Total number of bits to transmit in one subframe(case of DCI = G)
uint8_t Ns, //XXX we pass the subframe // Slot number (0..19)
uint8_t ncce_index,
uint8_t agr_level) // Aggregation level
{
int i;
uint32_t x1, x2, s=0;
uint8_t reset;
uint8_t occupation_size=1;
reset = 1;
if(agr_level == 2 && ncce_index == 0)
{
occupation_size=1;
}else{
occupation_size=2;
}
x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell; // This is c_init in 36.211 Sec 10.2.3.1
for (i=0; i<G/occupation_size; i++) {
if ((i&0x1f)==0) {
s = lte_gold_generic_NB_IoT(&x1, &x2, reset);
reset = 0;
}
dlcch->npdcch_e[ncce_index][i] = (dlcch->npdcch_e[ncce_index][i]&1) ^ ((s>>(i&0x1f))&1);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
uint8_t pilot_shift,
int16_t amp,
unsigned short id_offset,
uint8_t ncce_index,
uint8_t agr_level,
uint32_t *re_allocated)
{
MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)? SISO:ALAMOUTI;
uint32_t tti_offset,aa;
uint8_t re;
int16_t gain_lin_QPSK;
uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re = 0;
last_re = 12;
if(ncce_index == 0 && agr_level == 2)
{
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || (re%6 != ((id_offset + 3*pilot_shift) % 6) ) ) // if re is not a pilot
{
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
// fill in the rest of the ALAMOUTI precoding
if ( pilots != 1 || (re+1)%3 != id_offset) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
} else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
re++; // skip pilots
*re_allocated = *re_allocated + 1;
}
re++; // adjacent carriers are taken care of by precoding
*re_allocated = *re_allocated + 1; // incremented variable but never used
}
}
}
} else if(agr_level == 1) {
for (re=(first_re + ncce_index*6); re<(6 + ncce_index*6); re++) { // re varies between 0 and 6 or 6 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || (re%6 != ((id_offset + 3*pilot_shift) % 6) ) ) // if re is not a pilot
{
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
// fill in the rest of the ALAMOUTI precoding
if ( pilots != 1 || (re+1)%3 != id_offset) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
} else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
re++; // skip pilots
*re_allocated = *re_allocated + 1;
}
re++; // adjacent carriers are taken care of by precoding
*re_allocated = *re_allocated + 1; // incremented variable but never used
}
}
}
} else {
printf("Error in allocate RE of DCI NB_IoT");
}
return(0);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int dci_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_NPDCCH_t *dlcch,
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
uint8_t agr_level,
uint8_t ncce_index,
unsigned int subframe,
unsigned short NB_IoT_RB_ID) /// NB_IoT_RB_ID should be initialized in the LTE_DL_FRAME_PARMS
{
uint32_t jj = 0;
uint32_t re_allocated,symbol_offset;
uint16_t l;
uint8_t id_offset,pilot_shift,pilots = 0;
unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID;
re_allocated = 0;
id_offset = 0;
pilot_shift = 0;
// testing if the total number of RBs is even or odd
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd
RB_IoT_ID = NB_IoT_RB_ID;
// step 5, 6, 7 // modulation and mapping (slot 1, symbols 0..3)
for (l=control_region_size; l<14; l++) { // loop on OFDM symbols
if((l>=4 && l<=7) || (l>=11 && l<=13))
{
pilots = 1;
if(l==4 || l==6 || l==11 || l==13)
{
pilot_shift = 1;
}
} else {
pilots = 0;
}
id_offset = frame_parms->Nid_cell % 6; // Cell_ID_NB_IoT % 6
if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
symbol_offset = (14*subframe*frame_parms->ofdm_symbol_size) + frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
if(agr_level == 2)
{
dci_allocate_REs_in_RB_NB_IoT(frame_parms,
txdataF,
&jj,
symbol_offset,
&dlcch->npdcch_e[0],
pilots,
pilot_shift,
amp,
id_offset,
ncce_index,
agr_level,
&re_allocated);
} else {
dci_allocate_REs_in_RB_NB_IoT(frame_parms,
txdataF,
&jj,
symbol_offset,
&dlcch->npdcch_e[ncce_index],
pilots,
pilot_shift,
amp,
id_offset,
ncce_index,
agr_level,
&re_allocated);
}
}
return (re_allocated);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
uint8_t Num_dci,
DCI_ALLOC_NB_IoT_t *dci_alloc,
int16_t amp,
NB_IoT_DL_FRAME_PARMS *fp,
int32_t **txdataF,
uint32_t subframe,
uint8_t npdcch_start_symbol)
{
int i, G;
//temporary variable
uint16_t rnti[2];
uint8_t L = 0;
/* PARAMETERS may not needed
**e_ptr : store the encoding result, and as a input to modulation
*num_pdcch_symbols : to calculate the resource allocation for pdcch
*L = aggregation level (there is 2 (at most) in NB-IoT) (Note this is not the real value but the index)
*lprime,kprime,kprime_mod12,mprime,nsymb,symbol_offset,tti_offset,re_offset : used in the REG allocation
*gain_lin_QPSK,yseq0[Msymb],yseq1[Msymb],*y[2] : used in the modulation
*mi = used in interleaving
*e = used to store the taus sequence (taus sequence is used to generate the first sequence for DCI) Turbo coding
*wbar used in the interleaving and also REG allocation
*/
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization???
// Value of aggregation level (FAPI/NFAPI specs v.9.0 pag 221 value 1,2)
/*
* in NB-IoT we can have at most 2 aggregation level since we have only 2 NCCE (Narrowband control channel element)
* if only 1 DCI transmitted:
* - Aggregation level could be 1 or 2
* if 2 DCI transmitted:
* - Aggregation level should be 1
*
*/
//First take all the DCI pdu and their corrispondent rnti
for(i = 0; i<Num_dci;i++)
{
npdcch->pdu[i][0]=dci_alloc[i].dci_pdu;
rnti[i]=dci_alloc[i].rnti;
L = dci_alloc[i].L;
}
if(Num_dci == 2 && L == 1)
LOG_E(PHY,"generate_dci_top_NB_IoT: Aggregation level not compatible with Num_dci\n" );
//Second, evaluate the G variable based of the npdcch_start_sysmbol
/*
* TS 36.213 ch 16.6.1
* npdcch_start_symbol indicate the starting OFDM symbol for NPDCCH in the first slot of a subframe k ad is determined as follow:
* - if eutracontrolregionsize is present (defined for in-band operating mode (mode 0,1 for FAPI specs))
* npdcch_start_symbol = eutracontrolregionsize (value 1,2,3) [units in number of OFDM symbol]
* -otherwise
* npdcch_start_symbol = 0
*
*XXX npdcch_start symbol should be the same for every DCI once is decided since depends on the parameters
*(the setting of this npdcch_start_symbol parameter should be done in the MAC)
*Depending on npdcch_start_symbol then we define different values for G
*
*/
switch(npdcch_start_symbol) //mail Bcom matthieu
{
case 0:
G = 304;
break;
case 1:
G = 240;
break;
case 2:
G = 224;
break;
case 3:
G =200;
break;
default:
LOG_E (PHY,"npdcch_start_symbol has unwanted value\n");
break;
}
//NB-IoT encoding
// dci_encoding_NB_IoT(
// a,
// 4, // total length (in byte) of a [assume max 2 pdus of ??]
// G,
// npdcch->e,
// rnti,
// Num_dci,
// L
// );
//NB-IoT scrambling
// npdcch_scrambling_NB_IoT(
// fp,
// npdcch->e,
// G,
// subframe,
// Num_dci,
// L
// );
//NB-IoT Modulation
// dci_modulation_NB_IoT(
// txdataF,
// amp,
// fp,
// npdcch_start_symbol,
// npdcch->e,
// G,
// Num_dci,
// L
// );
return 0;
}

View File

@@ -3,7 +3,9 @@
* 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
*

View File

@@ -0,0 +1,563 @@
/*
* 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.0 (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/LTE_TRANSPORT/dci_tools.c
* \brief PHY Support routines (eNB/UE) for filling PDSCH/PUSCH/DLSCH/ULSCH data structures based on DCI PDUs generated by eNB MAC scheduler.
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
//#include "PHY/defs.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "openair1/PHY/extern_NB_IoT.h"
//#include "PHY/LTE_TRANSPORT/extern_NB_IoT.h"
//#include "SCHED/defs_NB_IoT.h"
/*
#ifdef DEBUG_DCI_TOOLS
#include "PHY/vars_NB_IoT.h"
#endif
*/
//#include "assertions.h"
//#include "dlsch_tbs_full.h"
#include "PHY/NBIoT_TRANSPORT/dlsch_tbs_full_NB_IoT.h"
//#define DEBUG_HARQ
//#include "LAYER2/MAC/extern_NB_IoT.h"
//#include "LAYER2/MAC/defs_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h"
//#define DEBUG_DCI
void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt, uint8_t npdcch_start_symbol)
{
//put the pdu
memcpy(&DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_pdu[0],pdu,dci_size_bytes);
//configure the dci alloc
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_length = dci_size_bits;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].L = aggregation;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].rnti = rnti;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].format = dci_fmt;
DCI_pdu->npdcch_start_symbol = npdcch_start_symbol;
DCI_pdu->Num_dci++;
LOG_D(MAC,"add ue specific dci format %d for rnti %x \n",dci_fmt,rnti);
}
//map the Isf (DCI param) to the number of subframes (Nsf)
int resource_to_subframe[8] = {1,2,3,4,5,6,8,10};
int Scheddly_less_128[8] = {0,4,8,12,16,32,64,128};
int Scheddly_bigger_128[8] = {0,16,32,64,128,256,512,1024};
int Irep_to_Nrep[16] = {1,2,4,8,16,32,64,128,192,256,384,512,768,1024,1536,2048};
int Idelay_to_K0(uint8_t Sched_delay, int Rmax)
{
int k0=0;
if(Rmax <128)
{
k0 = Scheddly_less_128[Sched_delay];
}else if(Rmax >=128)
{
k0 = Scheddly_bigger_128[Sched_delay];
}
return k0;
}
int DCIrep_to_real_rep(uint8_t DCI_rep, int Rmax)
{
int R=0;
if(Rmax == 1)
{
if(DCI_rep == 0)
R = 1;
}else if (Rmax == 2)
{
if(DCI_rep == 0)
R = 1;
else if(DCI_rep == 1)
R = 2;
}else if (Rmax == 4)
{
if(DCI_rep == 0)
R = 1;
else if(DCI_rep == 1)
R = 2;
else if(DCI_rep == 2)
R = 4;
}else if (Rmax >= 8)
{
if(DCI_rep == 0)
R = Rmax/8;
else if(DCI_rep == 1)
R = Rmax/4;
else if(DCI_rep == 2)
R = Rmax/2;
else if(DCI_rep == 3)
R = Rmax;
}
return R;
}
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
NB_IoT_eNB_NPDCCH_t *ndlcch,
uint8_t aggregation,
uint8_t npdcch_start_symbol,
uint8_t ncce_index)
{
int tmp = 0;
int i = 0;
uint8_t *DCI_flip = NULL;
ncce_index = 0;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
/// Subcarrier indication, 6 bits
uint8_t scind;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
/// New Data Indicator, 1 bits
uint8_t ndi;
/// Scheduling Delay, 2 bits
uint8_t Scheddly;
/// Repetition Number, 3 bits
uint8_t RepNum;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv;
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep;
type = DCI_Content->DCIN0.type;
scind = DCI_Content->DCIN0.scind;
ResAssign = DCI_Content->DCIN0.ResAssign;
mcs = DCI_Content->DCIN0.mcs;
ndi = DCI_Content->DCIN0.ndi;
Scheddly = DCI_Content->DCIN0.Scheddly;
RepNum = DCI_Content->DCIN0.RepNum;
rv = DCI_Content->DCIN0.rv;
DCIRep = DCI_Content->DCIN0.DCIRep;
/*Now configure the npdcch structure*/
// ndlcch->ncce_index = NCCE_index;
// ndlcch->aggregation_level = aggregation;
ndlcch->A[ncce_index] = sizeof_DCIN0_t; // number of bits in DCI
ndlcch->rnti[ncce_index] = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlcch->active[ncce_index] = 1; //will be activated by the corresponding NDSLCH pdu
ndlcch->dci_repetitions[ncce_index] = DCIrep_to_real_rep(DCIRep,16); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
printf("dci_repetitions: %d, A = %d\n",ndlcch->dci_repetitions[ncce_index],ndlcch->A[ncce_index]);
DCI_flip = (uint8_t*)malloc(3*sizeof(uint8_t));
for(i=0; i<3; ++i){
DCI_flip[i] = 0x0;
}
DCI_flip[0] = (type << 7) | (scind << 1) | (ResAssign>>2);
DCI_flip[1] = (uint8_t)(ResAssign << 6) | (Scheddly << 4) | mcs;
DCI_flip[2] = (rv << 7) | (RepNum << 4) | (ndi << 3) |(DCIRep <<1);
ndlcch->pdu[ncce_index] = DCI_flip;
printf("DCI N0 content:");
for (tmp =0;tmp<3;tmp++)
printf("%d ",DCI_flip[tmp]);
printf("\n");
/*
* TS 36.213 ch 16.4.1.5
* ITBS is always set equivalent to IMCS for data
* ISF = ResAssign
*/
ndlcch->counter_repetition_number[ncce_index] = DCIrep_to_real_rep(DCIRep,16); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
LOG_I(PHY,"DCI packing for N0 done \n");
}
int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
NB_IoT_eNB_NPDCCH_t *ndlcch,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation, //////????? maybe add the ncce index ??????????
uint8_t npdcch_start_symbol,
uint8_t ncce_index)
{
// NB_IoT_eNB_NPDCCH_t *ndlcch = ;
int tmp = 0;
int i = 0;
uint8_t *DCI_flip = NULL;
//N1 parameters
//uint8_t ncce_index = 0;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type = 0;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator = 0;
// Scheduling Delay, 3 bits
uint8_t Sched_delay = 0;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign = 0;//Isf
// Modulation and Coding Scheme, 4 bits
uint8_t mcs = 0;
// Repetition Number, 4 bits
uint8_t RepNum = 0;
// DCI subframe repetition Number, 2 bits
uint8_t DCIRep = 0;
// New Data Indicator,1 bits
uint8_t ndi = 0;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes = 0;
//N2 parameters
//Direct indication information, 8 bits
uint8_t directIndInf= 0;
// Reserved information bits, 6 bits
uint8_t resInfoBits =0;
// printf("Generate eNB DCI, format %d, rnti %x (pdu %p)\n",dci_format,rnti,dci_pdu);
switch (dci_format) {
// Impossible to have a DCI N0, we have condition before
case DCIFormatN0:
return(-1);
break;
case DCIFormatN1_RAR: // This is DLSCH allocation for control traffic (no NDI and no ACK/NACK resource for RAR DCI)
/*Packed DCI here-------------------------------------------*/
type = DCI_Content->DCIN1_RAR.type;
orderIndicator = DCI_Content->DCIN1_RAR.orderIndicator;
Sched_delay = DCI_Content->DCIN1_RAR.Scheddly;
ResAssign = DCI_Content->DCIN1_RAR.ResAssign;
mcs = DCI_Content->DCIN1_RAR.mcs;
RepNum = DCI_Content->DCIN1_RAR.RepNum;
ndi = DCI_Content->DCIN1_RAR.ndi;
HARQackRes = DCI_Content->DCIN1_RAR.HARQackRes;
DCIRep = DCI_Content->DCIN1_RAR.DCIRep;
/*Now configure the npdcch structure*/
// ndlcch->ncce_index = NCCE_index;
// ndlcch->aggregation_level = aggregation;
ndlcch->A[ncce_index] = sizeof_DCIN1_RAR_t; // number of bits in DCI
//ndlcch->subframe_tx[subframe] = 1; // check if it's OK
ndlcch->rnti[ncce_index] = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlcch->active[ncce_index] = 1; //will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping.
ndlcch->scheduling_delay[ncce_index] = Idelay_to_K0(Sched_delay,4);
ndlcch->resource_assignment[ncce_index] = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlcch->repetition_number[ncce_index] = Irep_to_Nrep[RepNum]; // repetition number for NPDSCH
ndlcch->dci_repetitions[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//printf("dci_repetitions: %d, A = %d\n",ndlcch->dci_repetitions[ncce_index],ndlcch->A[ncce_index]);
ndlcch->modulation[ncce_index] = 2; //QPSK
//// ////////////////////////////////////////////////if(ndlcch->round == 0) //this should be set from initialization (init-lte)
//ndlcch->status[ncce_index] = ACTIVE_NB_IoT;
ndlcch->mcs[ncce_index] = mcs;
DCI_flip = (uint8_t*)malloc(3*sizeof(uint8_t));
for(i=0; i<3; ++i){
DCI_flip[i] = 0x0;
}
DCI_flip[0] = (type << 7) | (orderIndicator << 6) | (Sched_delay<<2) | ResAssign ;
DCI_flip[1] = (mcs << 4) | RepNum;
DCI_flip[2] = (ndi << 7) | (HARQackRes << 3) | (DCIRep <<1);
ndlcch->pdu[ncce_index] = DCI_flip;
printf("DCI N1 RAR PDU content:");
for (tmp =0;tmp<3;tmp++)
printf("%d ",DCI_flip[tmp]);
printf("\n");
/*
* TS 36.213 ch 16.4.1.5
* ITBS is always set equivalent to IMCS for data
* ISF = ResAssign
*/
ndlcch->TBS[ncce_index] = TBStable_NB_IoT[mcs][ResAssign];
//ndlcch->subframe[ncce_index] = subframe;
ndlcch->counter_repetition_number[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data
//ndlsch->error_treshold
//ndlsch->G??
//ndlsc->nsoft?? //set in new_eNB_dlsch (initialization)
//ndlsch-> sqrt_rho_a?? set in dlsch_modulation
//ndlsch-> sqrt_rho_b??? set in dlsch_modulation
LOG_I(PHY,"DCI packing for N1RAR done \n");
//set in new_eNB_dlsch (initialization)
/*
* Mlimit
* nsoft
* round
*/
break;
case DCIFormatN1: // for user data
type = DCI_Content->DCIN1.type;
orderIndicator = DCI_Content->DCIN1.orderIndicator;
Sched_delay = DCI_Content->DCIN1.Scheddly;
ResAssign = DCI_Content->DCIN1.ResAssign;
mcs = DCI_Content->DCIN1.mcs;
RepNum = DCI_Content->DCIN1.RepNum;
ndi = DCI_Content->DCIN1.ndi;
HARQackRes = DCI_Content->DCIN1.HARQackRes;
DCIRep = DCI_Content->DCIN1.DCIRep;
//add_dci_NB_IoT(eNB->DCI_pdu,DLSCH_DCI_NB_IoT,rnti,sizeof(DCIN1_t),aggregation,sizeof_DCIN1_t,DCIFormatN1,npdcch_start_symbol);
/*Now configure the npdcch structure*/
ndlcch->A[ncce_index] = sizeof_DCIN1_t; // number of bits in DCI
// ndlcch->ncce_index = NCCE_index;
// ndlcch->aggregation_level = aggregation;
//ndlcch->subframe_tx[subframe] = 1; // check if it's OK
ndlcch->rnti[ncce_index] = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlcch->active[ncce_index] = 1;//will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping.
ndlcch->scheduling_delay[ncce_index] = Idelay_to_K0(Sched_delay,4);
ndlcch->resource_assignment[ncce_index] = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlcch->repetition_number[ncce_index] = Irep_to_Nrep[RepNum]; // repetition number for NPDSCH
ndlcch->dci_repetitions[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
ndlcch->modulation[ncce_index] = 2; //QPSK
//if(ndlcch->round == 0){ //this should be set from initialization (init-lte)
//ndlcch->status[ncce_index] = ACTIVE_NB_IoT;
ndlcch->mcs[ncce_index] = mcs;
ndlcch->TBS[ncce_index] = TBStable_NB_IoT[mcs][ResAssign]; // this table should be rewritten for nb-iot
//ndlcch->pdu[ncce_index] = DLSCH_DCI_NB_IoT;
DCI_flip = (uint8_t*)malloc(3*sizeof(uint8_t));
for(i=0; i<3; ++i){
DCI_flip[i] = 0x0;
}
DCI_flip[0] = (type << 7) | (orderIndicator << 6) | (Sched_delay<<2) | ResAssign ;
DCI_flip[1] = (mcs << 4) | RepNum;
DCI_flip[2] = (ndi << 7) | (HARQackRes << 3) | (DCIRep <<1);
//DCI_flip[0] = 129;
//DCI_flip[0] = DCI_tmp[2]*2;
//DCI_flip[1] = DCI_tmp[1]*2;
//DCI_flip[2] = DCI_tmp[0]*2;
//DCI_flip[2] = 4;
ndlcch->pdu[ncce_index] = DCI_flip;
printf("DCI N1 PDU content:");
for (tmp =0;tmp<3;tmp++)
printf("%d ",DCI_flip[tmp]);
printf("\n");
ndlcch->counter_repetition_number[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//}
//ndlcch->frame[ncce_index] = frame;
//ndlcch->subframe[ncce_index] = subframe;
break;
case DCIFormatN2_Ind: //MP: for the moment is not implemented
type = DCI_Content->DCIN2_Ind.type;
directIndInf = DCI_Content->DCIN2_Ind.directIndInf;
resInfoBits = DCI_Content->DCIN2_Ind.resInfoBits;
//add_dci_NB_IoT(eNB->DCI_pdu,DLSCH_DCI_NB_IoT,rnti,sizeof(DCIN2_Ind_t),aggregation,sizeof_DCIN2_Ind_t,DCIFormatN2_Ind,npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
break;
case DCIFormatN2_Pag: //MP: for the moment is not implemented
type = DCI_Content->DCIN2_Pag.type;
ResAssign = DCI_Content->DCIN2_Pag.ResAssign;
mcs = DCI_Content->DCIN2_Pag.mcs;
RepNum = DCI_Content->DCIN2_Pag.RepNum;
DCIRep = DCI_Content->DCIN2_Pag.DCIRep;
//add_dci_NB_IoT(eNB->DCI_pdu,DLSCH_DCI_NB_IoT,rnti,sizeof(DCIN2_Pag_t),aggregation,sizeof_DCIN2_Pag_t,DCIFormatN2_Pag,npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
break;
default:
LOG_E(PHY,"Unknown DCI format\n");
return(-1);
break;
}
// compute DL power control parameters
//free(DLSCH_DCI_NB_IoT);
return(0);
}
uint8_t subframe2harq_pid_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe)
{
//MAC_xface_NB_IoT *mac_xface_NB_IoT; //test_xface
/*
#ifdef DEBUG_DCI
if (frame_parms->frame_type == TDD)
printf("dci_tools.c: subframe2_harq_pid, subframe %d for TDD configuration %d\n",subframe,frame_parms->tdd_config);
else
printf("dci_tools.c: subframe2_harq_pid, subframe %d for FDD \n",subframe);
#endif
*/
uint8_t ret = 255;
if (frame_parms->frame_type == FDD) {
ret = (((frame<<1)+subframe)&7);
} else {
switch (frame_parms->tdd_config) {
case 1:
if ((subframe==2) ||
(subframe==3) ||
(subframe==7) ||
(subframe==8))
switch (subframe) {
case 2:
case 3:
ret = (subframe-2);
break;
case 7:
case 8:
ret = (subframe-5);
break;
default:
LOG_E(PHY,"subframe2_harq_pid_NB_IoT, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
ret = (255);
break;
}
break;
case 2:
if ((subframe!=2) && (subframe!=7)) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
//mac_xface_NB_IoT->macphy_exit("subframe2_harq_pid_NB_IoT, Illegal subframe");
ret = (255);
}
ret = (subframe/7);
break;
case 3:
if ((subframe<2) || (subframe>4)) {
LOG_E(PHY,"subframe2_harq_pid_NB_IoT, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
ret = (255);
}
ret = (subframe-2);
break;
case 4:
if ((subframe<2) || (subframe>3)) {
LOG_E(PHY,"subframe2_harq_pid_NB_IoT, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
ret = (255);
}
ret = (subframe-2);
break;
case 5:
if (subframe!=2) {
LOG_E(PHY,"subframe2_harq_pid_NB_IoT, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
ret = (255);
}
ret = (subframe-2);
break;
default:
LOG_E(PHY,"subframe2_harq_pid_NB_IoT, Unsupported TDD mode %d\n",frame_parms->tdd_config);
ret = (255);
}
}
if (ret == 255) {
LOG_E(PHY, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", ret, frame, subframe);
//mac_xface_NB_IoT->macphy_exit("invalid harq_pid");
}
return ret;
}

View File

@@ -15,11 +15,11 @@
#define __LTE_TRANSPORT_DEFS_NB_IOT__H__
////#include "PHY/defs.h"
//#include "PHY/defs_nb_iot.h"
#include "PHY/LTE_TRANSPORT/dci_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/dci_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "openair2/COMMON/platform_types.h"
//#include "dci.h"
#include "PHY/LTE_TRANSPORT/uci_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/uci_NB_IoT.h"
//#include "dci.h"
//#include "uci.h"
//#ifndef STANDALONE_COMPILE
@@ -41,7 +41,13 @@
//// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
//
#define MAX_NUM_DLSCH_SEGMENTS_NB_IoT 16
#define MAX_NUM_ULSCH_SEGMENTS_NB_IoT MAX_NUM_DLSCH_SEGMENTS_NB_IoT
#define MAX_NUM_BITS_IN_DL_PER_SF_NB_IoT 284 // case one NB-IoT antenna && one LTE antenna
//#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS
//#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
//#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
//
@@ -71,11 +77,17 @@
//
//// for NB-IoT
#define MAX_NUM_CHANNEL_BITS_NB_IoT 3360 //14 symbols * 12 sub-carriers * 10 SF * 2bits/RE // to check during real tests
#define MAX_DL_SIZE_BITS_NB_IoT 680 // in release 13 // in release 14 = 2048 // ??? **** not sure
#define MAX_NUM_DL_CHANNEL_BITS_NB_IoT 2840 //284* 10 SF // case In-band operation mode witn 1 NB-IoT antenna && 1 LTE antenna //
#define MAX_TBS_DL_SIZE_BITS_NB_IoT 680 // in release 13 // in release 14 = 2048 // ??? **** not sure
////#define MAX_NUM_CHANNEL_BITS_NB_IOT 3*680 /// ??? ****not sure
//
//// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
//
//typedef struct { // LTE_DL_eNB_HARQ_t
// /// Status Flag indicating for this DLSCH (idle,active,disabled)
// SCH_status_t status;
@@ -135,6 +147,7 @@
// uint8_t first_layer;
//} NB_IoT_DL_eNB_HARQ_t;
typedef enum {
SCH_IDLE_NB_IoT,
@@ -161,15 +174,16 @@ typedef struct {
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[MAX_NUM_CHANNEL_BITS_NB_IoT];
uint8_t e[MAX_NUM_DL_CHANNEL_BITS_NB_IoT];
/// data after scrambling
uint8_t s_e[MAX_NUM_CHANNEL_BITS_NB_IoT];
uint8_t s_e[MAX_NUM_DL_CHANNEL_BITS_NB_IoT];
//length of the table e
uint16_t length_e; // new parameter
/// Tail-biting convolutional coding outputs
uint8_t d[96+(3*(24+MAX_DL_SIZE_BITS_NB_IoT))]; // new parameter
uint8_t d[96+(3*(24+MAX_TBS_DL_SIZE_BITS_NB_IoT))]; // new parameter
/// Sub-block interleaver outputs
uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IoT+24)]; // new parameter
uint8_t w[3*3*(MAX_TBS_DL_SIZE_BITS_NB_IoT+24)]; // new parameter
/// Status Flag indicating for this DLSCH (idle,active,disabled)
//SCH_status_t status;
@@ -197,6 +211,7 @@ typedef struct {
} NB_IoT_DL_eNB_HARQ_t;
typedef struct { // LTE_eNB_DLSCH_t
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
uint32_t *txdataF[8];
@@ -217,7 +232,7 @@ typedef struct { // LTE_eNB_DLSCH_t
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// Pointers to 8 HARQ processes for the DLSCH
NB_IoT_DL_eNB_HARQ_t harq_process;
NB_IoT_DL_eNB_HARQ_t harq_processes[8];
/// circular list of free harq PIDs (the oldest come first)
/// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
int harq_pid_freelist[10];
@@ -245,6 +260,7 @@ typedef struct { // LTE_eNB_DLSCH_t
} NB_IoT_eNB_DLSCH_t;
typedef struct {
/// HARQ process id
uint8_t harq_id;
@@ -434,7 +450,7 @@ typedef struct {
/// HARQ-ACKs
harq_status_NB_IoT_t harq_ack;
/// Pointers to up to 8 HARQ processes
NB_IoT_DL_UE_HARQ_t *harq_process;
NB_IoT_DL_UE_HARQ_t *harq_processes[8];
/// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
@@ -467,26 +483,6 @@ typedef enum
typedef struct {
rnti_t rnti;
//array containing the pdus of DCI
uint8_t *a[2];
//Array containing encoded DCI data
uint8_t *e[2];
//UE specific parameters
uint16_t npdcch_NumRepetitions;
uint16_t repetition_number;
//indicate the corresponding subframe within the repetition (set to 0 when a new NPDCCH pdu is received)
uint16_t repetition_idx;
// uint16_t npdcch_Offset_USS;
// uint16_t npdcch_StartSF_USS;
}NB_IoT_eNB_NPDCCH_t;
typedef struct{
@@ -526,6 +522,8 @@ typedef struct {
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDCCH transmission
/// see FAPI/NFAPI specs Table 4-45
uint8_t npdcch_start_symbol;
uint8_t Num_ue_spec_dci;
uint8_t Num_common_dci;
uint8_t Num_dci;
DCI_ALLOC_NB_IoT_t dci_alloc[2] ;
@@ -533,33 +531,45 @@ typedef struct {
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
uint32_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Active flag when msg2 is transmitted
uint8_t active_msg2;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
///in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required///
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_processes[8];
NB_IoT_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits
// NB_IoT_DL_eNB_SIB1_t harq_process_sib1;
SCH_status_NB_IoT_t status;
///////////////////////////////////
uint32_t rnti_type;
uint32_t resource_assignment; // for NDLSCH // this value point to --> number of subframes needed
uint32_t repetition_number;
uint32_t modulation;
uint32_t number_of_subframes_for_resource_assignment; // for NDLSCH //table 16.4.1.3-1 // TS 36.213
uint32_t counter_repetition_number;
uint32_t counter_current_sf_repetition;
uint32_t pointer_to_subframe;
///////////////////////////////////
uint32_t repetition_number_SIB1; //4 8 16
uint32_t resource_assignment_SIB1; // always 8
/// Number of soft channel bits
uint32_t G;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
///NB-IoT
/// may use in the npdsch_procedures
uint16_t scrambling_sequence_intialization;
@@ -571,7 +581,10 @@ typedef struct {
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
/// see FAPI/NFAPI specs Table 4-47
uint8_t npdsch_start_symbol;
/*SIB1-NB related parameters*/
///SIB1-NB related parameters//
///flag for indicate if the current frame is the start of a new SIB1-NB repetition within the SIB1-NB period (0 = FALSE, 1 = TRUE)
uint8_t sib1_rep_start;
///the number of the frame within the 16 continuous frame in which sib1-NB is transmitted (1-8 = 1st, 2nd ecc..) (0 = not foresees a transmission)
@@ -580,6 +593,9 @@ typedef struct {
//(used inside the ndlsch procedure for distinguish the different type of data to manage also in term of repetitions and transmission over more subframes
ndlsch_flag_t ndlsch_type;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
} NB_IoT_eNB_NDLSCH_t;
typedef struct {
@@ -605,6 +621,12 @@ typedef struct {
uint16_t first_rb;
/// Current Number of RBs
uint16_t nb_rb;
uint8_t new_data_indication;
/// Determined the subcarrier spacing for NPUSCH (15 kHz or 3.75 KHz)
uint8_t subcarrier_spacing; /////////////////////////TODO: to be set using msg2 PDU content
/// Determined the subcarrier allocation for the NPUSCH.(15, 3.75 KHz)
uint8_t subcarrier_indication;
/// Determined the number of resource unit for the NPUSCH
@@ -613,6 +635,10 @@ typedef struct {
uint8_t scheduling_delay;
/// The number of the repetition number for NPUSCH Transport block
uint8_t repetition_number;
////////// counter for repetitions ///////////////////////
uint8_t rep_tmp;
/// Determined the repetition number value 0-3
uint8_t dci_subframe_repetitions;
/// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK)
@@ -648,6 +674,12 @@ typedef struct {
int8_t o_w[(MAX_CQI_BITS_NB_IoT+8)*3];
/// coded CQI bits
int8_t o_d[96+((MAX_CQI_BITS_NB_IoT+8)*3)];
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t w[MAX_NUM_ULSCH_SEGMENTS_NB_IoT][3*(6144+64)];
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t *d[MAX_NUM_ULSCH_SEGMENTS_NB_IoT];
///
uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
@@ -666,6 +698,12 @@ typedef struct {
uint8_t srs_active;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_ULSCH_SEGMENTS_NB_IoT];
/// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS_NB_IoT];
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// Index of current HARQ round for this ULSCH
@@ -704,11 +742,23 @@ typedef struct {
uint16_t I_sc;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// First Allocated RB - previous scheduling
/// This is needed for PHICH generation which
/// is done after a new scheduling
uint16_t previous_first_rb;
/// Subframe cba scheduling indicator (i.e. CBA Transmission opportunity indicator)
uint8_t subframe_cba_scheduling_flag;
} NB_IoT_UL_eNB_HARQ_t;
typedef struct {
/// Pointers to the HARQ processes for the NULSCH
NB_IoT_UL_eNB_HARQ_t *harq_processes[8];
NB_IoT_UL_eNB_HARQ_t *harq_process;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
@@ -719,7 +769,9 @@ typedef struct {
/// Flag to indicate that eNB should decode UE Msg3
uint8_t Msg3_flag;
/// Subframe for Msg3
uint8_t Msg3_subframe;
uint32_t Msg3_subframe;
/// Frame for Msg3
uint32_t Msg3_frame;
/// RNTI attributed to this ULSCH
@@ -734,12 +786,21 @@ typedef struct {
uint8_t scrambling_re_intialization_batch_index;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
///
uint16_t scrambling_sequence_intialization;
///
uint16_t sf_index;
//////// nfapi param //////////////////////////////////////////
uint16_t C_init;
//////// nfapi param //////////////////////////////////////////////////
uint16_t SF_idx;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
//////////////////////////////////////////////////////////////////
/// Flag to trigger the storage of values
uint8_t flag_vars;
uint16_t counter_sf;
uint16_t counter_repetitions;
// uint16_t sf_number;
// uint16_t rep_number;
///////////// kept from LTE ///////////////////////////////////////////////////
@@ -784,4 +845,58 @@ typedef struct {
} NB_IoT_eNB_NPBCH_t;
#define NPDCCH_A 23
#define MAX_BITS_IN_SF 284 // maximum number of bits over one subframe
typedef struct {
//the 2 LSB of the hsfn (the MSB are indicated by the SIB1-NB)
rnti_t rnti[2];
////////////////////////////////////////////////////////
/// Active flag for baseband transmitter processing
uint8_t A[2]; // DCI length in bits
uint8_t active[2];
uint8_t modulation[2];
uint32_t length[2];
uint32_t ncce_index[2];
uint32_t aggregation_level[2];
uint32_t rnti_type[2];
uint32_t dci_format[2];
uint32_t scheduling_delay[2];
uint32_t resource_assignment[2];
// uint32_t repetition_number[2];
uint32_t mcs[2];
uint32_t TBS[2];
uint32_t new_data_indicator[2];
uint32_t harq_ack_resource[2];
uint32_t npdcch_order_indication[2];
uint32_t dci_subframe_repetition_number[2];
////////////////////////////////////////////////////////
//UE specific parameters
uint16_t dci_repetitions[2];
uint16_t npdcch_NumRepetitions[2];
uint16_t repetition_number[2];
//indicate the corresponding subframe within the repetition (set to 0 when a new NPDCCH pdu is received)
uint16_t repetition_idx[2];
//////////////////////////////////////
uint32_t counter_repetition_number[2];
// uint32_t counter_current_sf_repetition[2];
// uint32_t pointer_to_subframe[2];
//////////////////////////////////////
uint16_t h_sfn_lsb;
uint8_t npdcch_d[2][96+(3*(16+NPDCCH_A))];
uint8_t npdcch_w[2][3*3*(16+NPDCCH_A)];
uint8_t npdcch_e[2][MAX_BITS_IN_SF];
///pdu of the npbch message
uint8_t *pdu[2];
} NB_IoT_eNB_NPDCCH_t;
#endif

View File

@@ -0,0 +1,315 @@
/*
* 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.0 (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/LTE_TRANSPORT/dlsch_coding_NB_IoT.c
* \brief Top-level routines for implementing Tail-biting convolutional coding for transport channels (NPDSCH) for NB_IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include <string.h>
//#include "PHY/impl_defs_lte.h"
//#include "openair2/COMMON/openair_defs.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
//#include "PHY/extern_NB_IoT.h"
#include "PHY/CODING/defs_NB_IoT.h"
//#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/NBIoT_TRANSPORT/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
//#include "SCHED/defs_NB_IoT.h"
//#include "defs_nb_iot.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
#include "PHY/TOOLS/time_meas_NB_IoT.h"
unsigned char ccodelte_table2_NB_IoT[128];
unsigned short glte2_NB_IoT[] = { 0133, 0171, 0165 };
void free_eNB_dlsch_NB_IoT(NB_IoT_eNB_NDLSCH_t *dlsch)
{
if (dlsch) {
/*
#ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch %p\n",dlsch);
#endif*/
if (dlsch->harq_process) {
if (dlsch->harq_process->b) {
free16(dlsch->harq_process->b,300);
dlsch->harq_process->b = NULL;
}
if (dlsch->harq_process->d) {
free16(dlsch->harq_process->d,96+(3*(24+MAX_TBS_DL_SIZE_BITS_NB_IoT)));
// dlsch->harq_process->d = NULL;
}
free16(dlsch->harq_process,sizeof(NB_IoT_DL_eNB_HARQ_t));
dlsch->harq_process = NULL;
}
free16(dlsch,sizeof(NB_IoT_eNB_NDLSCH_t));
dlsch = NULL;
}
}
void free_eNB_dlcch_NB_IoT(NB_IoT_eNB_NPDCCH_t *dlcch)
{
if (dlcch) {
free16(dlcch,sizeof(NB_IoT_eNB_NPDCCH_t));
dlcch = NULL;
}
}
void ccode_encode_npdsch_NB_IoT (int32_t numbits,
uint8_t *inPtr,
uint8_t *outPtr,
uint32_t crc)
{
uint32_t state;
uint8_t c, out, first_bit;
int8_t shiftbit = 0;
/* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */
state = 0;
first_bit = 2;
c = ((uint8_t*)&crc)[0];
// Perform Tail-biting
// get bits from last byte of input (or crc)
for (shiftbit = 0 ; shiftbit <(8-first_bit) ; shiftbit++) {
if ((c&(1<<(7-first_bit-shiftbit))) != 0)
state |= (1<<shiftbit);
}
state = state & 0x3f; // true initial state of Tail-biting CCode
state<<=1; // because of loop structure in CCode
while (numbits > 0) { // Tail-biting is applied to input bits , input 34 bits , output 102 bits
c = *inPtr++;
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodelte_table2_NB_IoT[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1;
}
}
}
///////////////////////////////////////////////////////////////////////////////
int dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_NDLSCH_t *dlsch, //NB_IoT_eNB_NDLSCH_t
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G) // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
{
uint32_t crc = 1;
//unsigned char harq_pid = dlsch->current_harq_pid; // to check during implementation if harq_pid is required in the NB_IoT_eNB_DLSCH_t structure in defs_NB_IoT.h
//uint8_t option1,option2,option3,option4;
unsigned int A=0;
A = dlsch->harq_process->TBS / 8;
uint8_t RCC;
uint8_t npbch_a[A];
uint8_t npbch_a_crc[A+3];
bzero(npbch_a,A);
bzero(npbch_a_crc,A+3);
dlsch->harq_process->length_e = G*Nsf; // G*Nsf (number_of_subframes) = total number of bits to transmit G=236
for (int i=0; i<A; i++)
{
npbch_a[i] = a[i];
}
int32_t numbits = (A*8)+24;
crc = crc24a_NB_IoT(npbch_a,A*8)>>8;
for (int j=0; j<A; j++)
{
npbch_a_crc[j] = npbch_a[j];
}
npbch_a_crc[A] = ((uint8_t*)&crc)[2];
npbch_a_crc[A+1] = ((uint8_t*)&crc)[1];
npbch_a_crc[A+2] = ((uint8_t*)&crc)[0];
dlsch->harq_process->B = numbits; // The length of table b in bits
//memcpy(dlsch->b,a,numbits/8); // comment if option 2
memset(dlsch->harq_process->d,LTE_NULL_NB_IoT,96);
ccode_encode_npdsch_NB_IoT(numbits,npbch_a_crc,dlsch->harq_process->d+96,crc);
RCC = sub_block_interleaving_cc_NB_IoT(numbits,dlsch->harq_process->d+96,dlsch->harq_process->w); // step 2 interleaving
lte_rate_matching_cc_NB_IoT(RCC,dlsch->harq_process->length_e,dlsch->harq_process->w,dlsch->harq_process->e); // step 3 Rate Matching
return(0);
}
///////////////////////////////////////////////////////////////////////////
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(uint8_t type, LTE_DL_FRAME_PARMS* frame_parms)
{
NB_IoT_eNB_NDLSCH_t *dlsch;
unsigned char exit_flag = 0,r;
dlsch = (NB_IoT_eNB_NDLSCH_t *)malloc16(sizeof(NB_IoT_eNB_NDLSCH_t));
if (dlsch) {
bzero(dlsch,sizeof(NB_IoT_eNB_NDLSCH_t));
dlsch->harq_process = (NB_IoT_DL_eNB_HARQ_t *)malloc16(sizeof(NB_IoT_DL_eNB_HARQ_t));
if (dlsch->harq_process) {
bzero(dlsch->harq_process,sizeof(NB_IoT_DL_eNB_HARQ_t));
// dlsch->harq_processes[i]->first_tx=1;
dlsch->harq_process->b = (unsigned char*)malloc(300); // to set a new one that replace 300 , MAX_DLSCH_PAYLOAD_BYTES/bw_scaling
if (dlsch->harq_process->b) {
bzero(dlsch->harq_process->b,300);
} else {
printf("Can't get b\n");
exit_flag=1;
}
if (dlsch->harq_process->d) {
bzero((void *)dlsch->harq_process->d,96+(3*(24+MAX_TBS_DL_SIZE_BITS_NB_IoT)));
} else {
printf("Can't get d\n");
exit_flag=2;
}
// }
} else {
exit_flag=3;
}
if (exit_flag==0) {
dlsch->harq_process->round=0;
// for (r=0; r<(96+(3*(24+MAX_TBS_DL_SIZE_BITS_NB_IoT))); r++) {
//
// if (dlsch->harq_process->d)
// dlsch->harq_process->d[0]= LTE_NULL_NB_IoT;
// }
return(dlsch);
}
}
/// LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
// exit_flag, sizeof(NB_IoT_eNB_NDLSCH_t));
free_eNB_dlsch_NB_IoT(dlsch);
return(NULL);
}
///////////////////////////////////////////////////////////////////////////
NB_IoT_eNB_NPDCCH_t *new_eNB_dlcch_NB_IoT(LTE_DL_FRAME_PARMS* frame_parms)
{
NB_IoT_eNB_NPDCCH_t *dlcch;
dlcch = (NB_IoT_eNB_NPDCCH_t *)malloc16(sizeof(NB_IoT_eNB_NPDCCH_t));
if (dlcch) {
bzero(dlcch,sizeof(NB_IoT_eNB_NPDCCH_t));
return(dlcch);
}
/// LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
// exit_flag, sizeof(NB_IoT_eNB_NDLSCH_t));
free_eNB_dlcch_NB_IoT(dlcch);
return(NULL);
}
/*************************************************************************
Functions to initialize the code tables
*************************************************************************/
/* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */
void ccodelte_init2_NB_IoT(void)
{
unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) {
ccodelte_table2_NB_IoT[i] = 0;
/* Compute 3 output bits */
for (j = 0; j < 3; j++) {
sum = 0;
for (k = 0; k < 7; k++)
if ((i & glte2_NB_IoT[j]) & (1 << k))
sum++;
/* Write the sum modulo 2 in bit j */
ccodelte_table2_NB_IoT[i] |= (sum & 1) << j;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
/*
* 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.0 (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/LTE_TRANSPORT/dlsch_modulation_NB_IoT.c
* \brief Top-level routines for generating the NPDSCH physical channel for NB_IoT,
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include <math.h>
//#include "PHY/defs.h"
//#include "PHY/defs_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h"
//#include "PHY/impl_defs_lte.h"
//#include "PHY/CODING/defs_nb_iot.h"
//#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/NBIoT_TRANSPORT/defs_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/proto_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_top_NB_IoT.h"
//#include "defs.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
int allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
unsigned short id_offset,
uint8_t pilot_shift,
uint32_t *re_allocated) // not used variable ??!!
{
MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)? SISO:ALAMOUTI;
uint32_t tti_offset,aa;
uint8_t re;
int16_t gain_lin_QPSK;
uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re = 0;
last_re = 12;
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || (re%6 != ((id_offset + 3*pilot_shift) % 6) ) ) // if re is not a pilot
{
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
// fill in the rest of the ALAMOUTI precoding
if ( pilots != 1 || (re+1)%3 != id_offset) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
} else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
re++; // skip pilots
*re_allocated = *re_allocated + 1;
}
re++; // adjacent carriers are taken care of by precoding
*re_allocated = *re_allocated + 1; // incremented variable but never used
}
}
}
return(0);
}
int dlsch_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_NDLSCH_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned int subframe,
unsigned short NB_IoT_RB_ID)
{
//uint8_t harq_pid = dlsch0->current_harq_pid;
//NB_IoT_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid];
uint32_t jj = 0;
uint32_t re_allocated,symbol_offset;
uint16_t l;
uint8_t id_offset,pilot_shift,pilots = 0;
unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID;
re_allocated = 0;
id_offset = 0;
pilot_shift = 0;
// testing if the total number of RBs is even or odd
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd
RB_IoT_ID = NB_IoT_RB_ID;
// step 5, 6, 7 // modulation and mapping (slot 1, symbols 0..3)
for (l=control_region_size; l<14; l++) { // loop on OFDM symbols
if((l>=4 && l<=7) || (l>=11 && l<=13))
{
pilots = 1;
if(l==4 || l==6 || l==11 || l==13)
{
pilot_shift = 1;
}
} else {
pilots = 0;
}
id_offset = frame_parms->Nid_cell % 6; // Cell_ID_NB_IoT % 6
if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID % (int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
symbol_offset = (14*subframe*frame_parms->ofdm_symbol_size) + frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
allocate_REs_in_RB_NB_IoT(frame_parms,
txdataF,
&jj,
symbol_offset,
&dlsch0->harq_process->s_e[G*npdsch_data_subframe],
pilots,
amp,
id_offset,
pilot_shift,
&re_allocated);
}
// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
return (re_allocated);
}

View File

@@ -0,0 +1,97 @@
/*
* 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.0 (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/LTE_TRANSPORT/dlsch_scrambling_NB_IoT.c
* \brief Routines for the scrambling procedure of the NPDSCH physical channel for NB_IoT, TS 36-211, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
//#define DEBUG_SCRAMBLING 1
//#include "PHY/defs.h"
//#include "PHY/defs_NB_IoT.h"
//#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
//#include "defs.h"
//#include "extern_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
#include "PHY/NBIoT_TRANSPORT/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "openair1/PHY/extern_NB_IoT.h"
void dlsch_scrambling_Gen_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NDLSCH_t *dlsch,
int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns,
uint32_t rnti,
uint8_t release_v13_5_0,
uint8_t SIB)
{
int i,j,k=0;
uint32_t x1,x2, s=0;
uint8_t *e = dlsch->harq_process->e; //uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
if(release_v13_5_0 == 1 && SIB == 1) /// for SIBs from release 13.5.0 and above
{
x2 = (rnti<<15) + (frame_parms->Nid_cell + 1) * ( (Nf % 61) + 1 ) ;
} else {
x2 = (rnti<<14) + ((Nf%2)<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell;
}
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
for (i=0; i<(1+(tot_bits>>5)); i++) {
for (j=0; j<32; j++,k++) {
dlsch->harq_process->s_e[k] = (e[k]&1) ^ ((s>>j)&1);
}
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
}
}
void init_unscrambling_lut_NB_IoT() {
uint32_t s;
int i=0,j;
for (s=0;s<=65535;s++) {
for (j=0;j<16;j++) {
unscrambling_lut_NB_IoT[i++] = (int16_t)((((s>>j)&1)<<1)-1);
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.0 (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
*/
#ifndef __DLSCH_TBS_FULL_NB_IOT_H__
#define __DLSCH_TBS_FULL_NB_IOT_H__
/** \brief "Transport block size table"
* (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0)
*/
// NB-IoT------------------
// TBS table for the case not containing SIB1-NB, Table 16.4.1.5.1-1 in TS 36.213 v14.2
unsigned int TBStable_NB_IoT[14][8] ={ //[ITBS][ISF]
{16,32,56,88,120.152,208,256},
{24,56,88,144,176,208,256,344},
{32,72,144,176,208,256,328,424},
{40,104,176,208,256,328,440,568},
{56,120,208,256,328,408,552,680},
{72,144,244,328,424,504,680,872},
{88,176,256,392,504,600,808,1032},
{104,224,328,472,584,680,968,1224},
{120,256,392,536,680,808,1096,1352},
{136,296,456,616,776,936,1256,1544},
{144,328,504,680,872,1032,1384,1736},
{176,376,584,776,1000,1192,1608,2024},
{208,440,680,904,1128,1352,1800,2280},
{224,488,744,1128,1256,1544,2024,2536}
};
//TBS table for the case containing S1B1-NB, Table 16.4.1.5.2-1 in TS 36.213 v14.2 (Itbs = 12 ~ 15 is reserved field
//mapping ITBS to SIB1-NB
unsigned int TBStable_NB_IoT_SIB1[16] = {208,208,208,328,328,328,440,440,440,680,680,680,0,0,0,0};
#endif

View File

@@ -0,0 +1,69 @@
/*
* 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.0 (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
*/
#ifndef __PHY_LTE_TRANSPORT_EXTERN_NB_IOT__H__
#define __PHY_LTE_TRANSPORT_EXTERN_NB_IOT__H__
extern unsigned int TBStable_NB_IoT[14][8];
extern unsigned int TBStable_NB_IoT_SIB1[16];
extern unsigned char cs_ri_normal_NB_IoT[4];
extern unsigned char cs_ri_extended_NB_IoT[4];
extern unsigned char cs_ack_normal_NB_IoT[4];
extern unsigned char cs_ack_extended_NB_IoT[4];
extern int8_t wACK_RX_NB_IoT[5][4];
extern int G_tab[18];
extern short conjugate[8],conjugate2[8];
extern short *ul_ref_sigs_rx_NB_IoT[30][4]; // NB-IoT: format 1 pilots
extern short *ul_ref_sigs_f2_rx_NB_IoT[16]; // NB-IoT: format 2 pilots
//extern unsigned short dftsizes[33];
extern int16_t e_phi_re_m6[120];
extern int16_t e_phi_im_m6[120];
extern int16_t e_phi_re_m5[120];
extern int16_t e_phi_im_m5[120];
extern int16_t e_phi_re_m4[120];
extern int16_t e_phi_im_m4[120];
extern int16_t e_phi_re_m3[120];
extern int16_t e_phi_im_m3[120];
extern int16_t e_phi_re_m2[120];
extern int16_t e_phi_im_m2[120];
extern int16_t e_phi_re_m1[120];
extern int16_t e_phi_im_m1[120];
extern int16_t e_phi_re_0[120];
extern int16_t e_phi_im_0[120];
extern int16_t e_phi_re_p1[120];
extern int16_t e_phi_im_p1[120];
extern int16_t e_phi_re_p2[120];
extern int16_t e_phi_im_p2[120];
extern int16_t e_phi_re_p3[120];
extern int16_t e_phi_im_p3[120];
extern int16_t e_phi_re_p4[120];
extern int16_t e_phi_im_p4[120];
extern int16_t e_phi_re_p5[120];
extern int16_t e_phi_im_p5[120];
#endif

View File

@@ -0,0 +1,120 @@
/*
* 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.0 (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
*/
int16_t s_n11_re[336] = {23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, -1, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039};
int16_t s_n11_im[336] = {23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, 0, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852};
int16_t s_n10_re[336] = {-23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, -1, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962};
int16_t s_n10_im[336] = {23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786};
int16_t s_n9_re[336] = {-23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, -1, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808};
int16_t s_n9_im[336] = {-23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, 0, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413};
int16_t s_n8_re[336] = {23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, -1, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608};
int16_t s_n8_im[336] = {-23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728};
int16_t s_n7_re[336] = {23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, -1, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607};
int16_t s_n7_im[336] = {23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728};
int16_t s_n6_re[336] = {-23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, -1, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807};
int16_t s_n6_im[336] = {23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413};
int16_t s_n5_re[336] = {-23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, -1, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961};
int16_t s_n5_im[336] = {-23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786};
int16_t s_n4_re[336] = {23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038};
int16_t s_n4_im[336] = {-23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852};
int16_t s_n3_re[336] = {23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009};
int16_t s_n3_im[336] = {23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622};
int16_t s_n2_re[336] = {-23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, -1, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845};
int16_t s_n2_im[336] = {23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106};
int16_t s_n1_re[336] = {-23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519};
int16_t s_n1_im[336] = {-23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319};
int16_t s_n0_re[336] = {23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004};
int16_t s_n0_im[336] = {-23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, 0, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279};
int16_t s_n_12_re[4032] = {23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004,
-23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, -1, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519,
-23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, -1, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845,
23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, -1, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009,
23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038,
-23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, -1, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961,
-23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, -1, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807,
23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, -1, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607,
23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, -1, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608,
-23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, -1, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808,
-23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, -1, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962,
23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, -1, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039};
int16_t s_n_12_im[4032] = {-23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, 0, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279, 0, 24278, -32610, 19519, 6392, -28106, 31356, -14010, -12540, 30851, -28898, 7961, 18204, -32413, 25329, -1608, -23170, 32727, -20788, -4808, 27244, -31786, 15446, 11038, -30273, 29621, -9512, -16846, 32137, -26319, 3211, 22004, -32767, 22004, 3211, -26319, 32137, -16846, -9512, 29621, -30273, 11038, 15446, -31786, 27244, -4808, -20788, 32727, -23170, -1608, 25329, -32413, 18204, 7961, -28898, 30851, -12540, -14010, 31356, -28106, 6392, 19519, -32610, 24278, -1, -24279, 32609, -19520, -6393, 28105, -31357, 14009, 12539, -30852, 28897, -7962, -18205, 32412, -25330, 1607, 23169, -32728, 20787, 4807, -27245, 31785, -15447, -11039, 30272, -29622, 9511, 16845, -32138, 26318, -3212, -22005, 32767, -22005, -3212, 26318, -32138, 16845, 9511, -29622, 30272, -11039, -15447, 31785, -27245, 4807, 20787, -32728, 23169, 1607, -25330, 32412, -18205, -7962, 28897, -30852, 12539, 14009, -31357, 28105, -6393, -19520, 32609, -24279,
-23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, -1, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319, 0, 26318, -31357, 11038, 18204, -32728, 20787, 7961, -30273, 28105, -3212, -24279, 32137, -14010, -15447, 32412, -23170, -4808, 28897, -29622, 6392, 22004, -32610, 16845, 12539, -31786, 25329, 1607, -27245, 30851, -9512, -19520, 32767, -19520, -9512, 30851, -27245, 1607, 25329, -31786, 12539, 16845, -32610, 22004, 6392, -29622, 28897, -4808, -23170, 32412, -15447, -14010, 32137, -24279, -3212, 28105, -30273, 7961, 20787, -32728, 18204, 11038, -31357, 26318, 0, -26319, 31356, -11039, -18205, 32727, -20788, -7962, 30272, -28106, 3211, 24278, -32138, 14009, 15446, -32413, 23169, 4807, -28898, 29621, -6393, -22005, 32609, -16846, -12540, 31785, -25330, -1608, 27244, -30852, 9511, 19519, -32767, 19519, 9511, -30852, 27244, -1608, -25330, 31785, -12540, -16846, 32609, -22005, -6393, 29621, -28898, 4807, 23169, -32413, 15446, 14009, -32138, 24278, 3211, -28106, 30272, -7962, -20788, 32727, -18205, -11039, 31356, -26319,
23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, -1, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106, 0, 28105, -28898, 1607, 27244, -29622, 3211, 26318, -30273, 4807, 25329, -30852, 6392, 24278, -31357, 7961, 23169, -31786, 9511, 22004, -32138, 11038, 20787, -32413, 12539, 19519, -32610, 14009, 18204, -32728, 15446, 16845, -32767, 16845, 15446, -32728, 18204, 14009, -32610, 19519, 12539, -32413, 20787, 11038, -32138, 22004, 9511, -31786, 23169, 7961, -31357, 24278, 6392, -30852, 25329, 4807, -30273, 26318, 3211, -29622, 27244, 1607, -28898, 28105, 0, -28106, 28897, -1608, -27245, 29621, -3212, -26319, 30272, -4808, -25330, 30851, -6393, -24279, 31356, -7962, -23170, 31785, -9512, -22005, 32137, -11039, -20788, 32412, -12540, -19520, 32609, -14010, -18205, 32727, -15447, -16846, 32767, -16846, -15447, 32727, -18205, -14010, 32609, -19520, -12540, 32412, -20788, -11039, 32137, -22005, -9512, 31785, -23170, -7962, 31356, -24279, -6393, 30851, -25330, -4808, 30272, -26319, -3212, 29621, -27245, -1608, 28897, -28106,
23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, -1, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622, 0, 29621, -25330, -7962, 32137, -19520, -15447, 32727, -12540, -22005, 31356, -4808, -27245, 28105, 3211, -30852, 23169, 11038, -32610, 16845, 18204, -32413, 9511, 24278, -30273, 1607, 28897, -26319, -6393, 31785, -20788, -14010, 32767, -14010, -20788, 31785, -6393, -26319, 28897, 1607, -30273, 24278, 9511, -32413, 18204, 16845, -32610, 11038, 23169, -30852, 3211, 28105, -27245, -4808, 31356, -22005, -12540, 32727, -15447, -19520, 32137, -7962, -25330, 29621, 0, -29622, 25329, 7961, -32138, 19519, 15446, -32728, 12539, 22004, -31357, 4807, 27244, -28106, -3212, 30851, -23170, -11039, 32609, -16846, -18205, 32412, -9512, -24279, 30272, -1608, -28898, 26318, 6392, -31786, 20787, 14009, -32767, 14009, 20787, -31786, 6392, 26318, -28898, -1608, 30272, -24279, -9512, 32412, -18205, -16846, 32609, -11039, -23170, 30851, -3212, -28106, 27244, 4807, -31357, 22004, 12539, -32728, 15446, 19519, -32138, 7961, 25329, -29622,
-23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, 0, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852, 0, 30851, -20788, -16846, 32137, -4808, -28898, 24278, 12539, -32728, 9511, 26318, -27245, -7962, 32609, -14010, -23170, 29621, 3211, -31786, 18204, 19519, -31357, 1607, 30272, -22005, -15447, 32412, -6393, -28106, 25329, 11038, -32767, 11038, 25329, -28106, -6393, 32412, -15447, -22005, 30272, 1607, -31357, 19519, 18204, -31786, 3211, 29621, -23170, -14010, 32609, -7962, -27245, 26318, 9511, -32728, 12539, 24278, -28898, -4808, 32137, -16846, -20788, 30851, -1, -30852, 20787, 16845, -32138, 4807, 28897, -24279, -12540, 32727, -9512, -26319, 27244, 7961, -32610, 14009, 23169, -29622, -3212, 31785, -18205, -19520, 31356, -1608, -30273, 22004, 15446, -32413, 6392, 28105, -25330, -11039, 32767, -11039, -25330, 28105, 6392, -32413, 15446, 22004, -30273, -1608, 31356, -19520, -18205, 31785, -3212, -29622, 23169, 14009, -32610, 7961, 27244, -26319, -9512, 32727, -12540, -24279, 28897, 4807, -32138, 16845, 20787, -30852,
-23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, -1, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786, 0, 31785, -15447, -24279, 27244, 11038, -32610, 4807, 30272, -19520, -20788, 29621, 6392, -32728, 9511, 28105, -23170, -16846, 31356, 1607, -32138, 14009, 25329, -26319, -12540, 32412, -3212, -30852, 18204, 22004, -28898, -7962, 32767, -7962, -28898, 22004, 18204, -30852, -3212, 32412, -12540, -26319, 25329, 14009, -32138, 1607, 31356, -16846, -23170, 28105, 9511, -32728, 6392, 29621, -20788, -19520, 30272, 4807, -32610, 11038, 27244, -24279, -15447, 31785, 0, -31786, 15446, 24278, -27245, -11039, 32609, -4808, -30273, 19519, 20787, -29622, -6393, 32727, -9512, -28106, 23169, 16845, -31357, -1608, 32137, -14010, -25330, 26318, 12539, -32413, 3211, 30851, -18205, -22005, 28897, 7961, -32767, 7961, 28897, -22005, -18205, 30851, 3211, -32413, 12539, 26318, -25330, -14010, 32137, -1608, -31357, 16845, 23169, -28106, -9512, 32727, -6393, -29622, 20787, 19519, -30273, -4808, 32609, -11039, -27245, 24278, 15446, -31786,
23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, -1, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413, 0, 32412, -9512, -29622, 18204, 24278, -25330, -16846, 30272, 7961, -32610, 1607, 32137, -11039, -28898, 19519, 23169, -26319, -15447, 30851, 6392, -32728, 3211, 31785, -12540, -28106, 20787, 22004, -27245, -14010, 31356, 4807, -32767, 4807, 31356, -14010, -27245, 22004, 20787, -28106, -12540, 31785, 3211, -32728, 6392, 30851, -15447, -26319, 23169, 19519, -28898, -11039, 32137, 1607, -32610, 7961, 30272, -16846, -25330, 24278, 18204, -29622, -9512, 32412, 0, -32413, 9511, 29621, -18205, -24279, 25329, 16845, -30273, -7962, 32609, -1608, -32138, 11038, 28897, -19520, -23170, 26318, 15446, -30852, -6393, 32727, -3212, -31786, 12539, 28105, -20788, -22005, 27244, 14009, -31357, -4808, 32767, -4808, -31357, 14009, 27244, -22005, -20788, 28105, 12539, -31786, -3212, 32727, -6393, -30852, 15446, 26318, -23170, -19520, 28897, 11038, -32138, -1608, 32609, -7962, -30273, 16845, 25329, -24279, -18205, 29621, 9511, -32413,
23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, -1, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728, 0, 32727, -3212, -32413, 6392, 31785, -9512, -30852, 12539, 29621, -15447, -28106, 18204, 26318, -20788, -24279, 23169, 22004, -25330, -19520, 27244, 16845, -28898, -14010, 30272, 11038, -31357, -7962, 32137, 4807, -32610, -1608, 32767, -1608, -32610, 4807, 32137, -7962, -31357, 11038, 30272, -14010, -28898, 16845, 27244, -19520, -25330, 22004, 23169, -24279, -20788, 26318, 18204, -28106, -15447, 29621, 12539, -30852, -9512, 31785, 6392, -32413, -3212, 32727, 0, -32728, 3211, 32412, -6393, -31786, 9511, 30851, -12540, -29622, 15446, 28105, -18205, -26319, 20787, 24278, -23170, -22005, 25329, 19519, -27245, -16846, 28897, 14009, -30273, -11039, 31356, 7961, -32138, -4808, 32609, 1607, -32767, 1607, 32609, -4808, -32138, 7961, 31356, -11039, -30273, 14009, 28897, -16846, -27245, 19519, 25329, -22005, -23170, 24278, 20787, -26319, -18205, 28105, 15446, -29622, -12540, 30851, 9511, -31786, -6393, 32412, 3211, -32728,
-23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, -1, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728, 0, 32727, 3211, -32413, -6393, 31785, 9511, -30852, -12540, 29621, 15446, -28106, -18205, 26318, 20787, -24279, -23170, 22004, 25329, -19520, -27245, 16845, 28897, -14010, -30273, 11038, 31356, -7962, -32138, 4807, 32609, -1608, -32767, -1608, 32609, 4807, -32138, -7962, 31356, 11038, -30273, -14010, 28897, 16845, -27245, -19520, 25329, 22004, -23170, -24279, 20787, 26318, -18205, -28106, 15446, 29621, -12540, -30852, 9511, 31785, -6393, -32413, 3211, 32727, 0, -32728, -3212, 32412, 6392, -31786, -9512, 30851, 12539, -29622, -15447, 28105, 18204, -26319, -20788, 24278, 23169, -22005, -25330, 19519, 27244, -16846, -28898, 14009, 30272, -11039, -31357, 7961, 32137, -4808, -32610, 1607, 32767, 1607, -32610, -4808, 32137, 7961, -31357, -11039, 30272, 14009, -28898, -16846, 27244, 19519, -25330, -22005, 23169, 24278, -20788, -26319, 18204, 28105, -15447, -29622, 12539, 30851, -9512, -31786, 6392, 32412, -3212, -32728,
-23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, 0, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413, 0, 32412, 9511, -29622, -18205, 24278, 25329, -16846, -30273, 7961, 32609, 1607, -32138, -11039, 28897, 19519, -23170, -26319, 15446, 30851, -6393, -32728, -3212, 31785, 12539, -28106, -20788, 22004, 27244, -14010, -31357, 4807, 32767, 4807, -31357, -14010, 27244, 22004, -20788, -28106, 12539, 31785, -3212, -32728, -6393, 30851, 15446, -26319, -23170, 19519, 28897, -11039, -32138, 1607, 32609, 7961, -30273, -16846, 25329, 24278, -18205, -29622, 9511, 32412, -1, -32413, -9512, 29621, 18204, -24279, -25330, 16845, 30272, -7962, -32610, -1608, 32137, 11038, -28898, -19520, 23169, 26318, -15447, -30852, 6392, 32727, 3211, -31786, -12540, 28105, 20787, -22005, -27245, 14009, 31356, -4808, -32767, -4808, 31356, 14009, -27245, -22005, 20787, 28105, -12540, -31786, 3211, 32727, 6392, -30852, -15447, 26318, 23169, -19520, -28898, 11038, 32137, -1608, -32610, -7962, 30272, 16845, -25330, -24279, 18204, 29621, -9512, -32413,
23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, -1, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786, 0, 31785, 15446, -24279, -27245, 11038, 32609, 4807, -30273, -19520, 20787, 29621, -6393, -32728, -9512, 28105, 23169, -16846, -31357, 1607, 32137, 14009, -25330, -26319, 12539, 32412, 3211, -30852, -18205, 22004, 28897, -7962, -32767, -7962, 28897, 22004, -18205, -30852, 3211, 32412, 12539, -26319, -25330, 14009, 32137, 1607, -31357, -16846, 23169, 28105, -9512, -32728, -6393, 29621, 20787, -19520, -30273, 4807, 32609, 11038, -27245, -24279, 15446, 31785, 0, -31786, -15447, 24278, 27244, -11039, -32610, -4808, 30272, 19519, -20788, -29622, 6392, 32727, 9511, -28106, -23170, 16845, 31356, -1608, -32138, -14010, 25329, 26318, -12540, -32413, -3212, 30851, 18204, -22005, -28898, 7961, 32767, 7961, -28898, -22005, 18204, 30851, -3212, -32413, -12540, 26318, 25329, -14010, -32138, -1608, 31356, 16845, -23170, -28106, 9511, 32727, 6392, -29622, -20788, 19519, 30272, -4808, -32610, -11039, 27244, 24278, -15447, -31786,
23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, 0, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852, 0, 30851, 20787, -16846, -32138, -4808, 28897, 24278, -12540, -32728, -9512, 26318, 27244, -7962, -32610, -14010, 23169, 29621, -3212, -31786, -18205, 19519, 31356, 1607, -30273, -22005, 15446, 32412, 6392, -28106, -25330, 11038, 32767, 11038, -25330, -28106, 6392, 32412, 15446, -22005, -30273, 1607, 31356, 19519, -18205, -31786, -3212, 29621, 23169, -14010, -32610, -7962, 27244, 26318, -9512, -32728, -12540, 24278, 28897, -4808, -32138, -16846, 20787, 30851, -1, -30852, -20788, 16845, 32137, 4807, -28898, -24279, 12539, 32727, 9511, -26319, -27245, 7961, 32609, 14009, -23170, -29622, 3211, 31785, 18204, -19520, -31357, -1608, 30272, 22004, -15447, -32413, -6393, 28105, 25329, -11039, -32767, -11039, 25329, 28105, -6393, -32413, -15447, 22004, 30272, -1608, -31357, -19520, 18204, 31785, 3211, -29622, -23170, 14009, 32609, 7961, -27245, -26319, 9511, 32727, 12539, -24279, -28898, 4807, 32137, 16845, -20788, -30852};

View File

@@ -0,0 +1,173 @@
/*
* 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.0 (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/LTE_TRANSPORT/group_hopping.c
* \brief Top-level routines for group hopping for DMRS from 36.211 R14, Section 10.1.4.1.3
* \author Vincent Savaux
* \date 2017
* \version 0.1
* \company b<>com
* \email: vincent.savaux@b<>com.com
* \note
* \warning
*/
#include "PHY/defs_L1_NB_IoT.h"
#include <math.h>
//#define DEBUG_GROUPHOP 1
void generate_grouphop_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms)
{
uint8_t ns;
uint8_t reset=1;
uint32_t x1, x2, s=0;
uint16_t Nseq_RU[4] = {16,12,14,30}; // Table 10.1.4.1.3-1
// This is from Section 10.1.4.1.3
uint32_t fss_npusch_nn = frame_parms->Nid_cell + frame_parms->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupAssignmentNPUSCH;
uint32_t fss_npusch;
int k;
if (frame_parms->npusch_config_common.ul_ReferenceSignalsNPUSCH.groupHoppingEnabled){
for (k=0;k<4;k++){ // all four possible sucarrier configurations
fss_npusch = fss_npusch_nn % Nseq_RU[k];
x2 = (uint32_t) floor(frame_parms->Nid_cell/Nseq_RU[k]);
// x2 = frame_parms->Nid_cell/30;
#ifdef DEBUG_GROUPHOP
printf("[PHY] GroupHop:");
#endif
for (ns=0; ns<20; ns++) { // slot number
// if (k==0){ // 1 subcarrier --> initialize at the beginning of the sequence
if ((ns&3) == 0) {
s = lte_gold_generic_NB_IoT(&x1,&x2,reset);
reset = 0;
}
// }else{ // 3, 6, 12 subcarriers --> initialize at every even slot number
// if ((ns%2) == 0) {
// s = lte_gold_generic_NB_IoT(&x1,&x2,reset);
// reset = 1;
// }
// }
frame_parms->npusch_config_common.ul_ReferenceSignalsNPUSCH.grouphop[ns][k] = (((uint8_t*)&s)[ns&3]%Nseq_RU[k]+fss_npusch)%Nseq_RU[k];
#ifdef DEBUG_GROUPHOP
printf("%d.",frame_parms->npusch_config_common.ul_ReferenceSignalsNPUSCH.grouphop[ns]);
#endif
}
}
}else{
for (ns=0; ns<20; ns++) {
for (k=0;k<4;k++){
frame_parms->npusch_config_common.ul_ReferenceSignalsNPUSCH.grouphop[ns][k] = frame_parms->Nid_cell % Nseq_RU[k];
}
}
}
#ifdef DEBUG_GROUPHOP
printf("\n");
#endif
}
// void generate_seqhop(LTE_DL_FRAME_PARMS *frame_parms)
// {
// uint8_t ns,reset=1;
// uint32_t x1, x2, s=0;
// // This is from Section 5.5.1.3
// uint32_t fss_pusch = frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
// x2 = (32*(frame_parms->Nid_cell/30) + fss_pusch)%30;
// s = lte_gold_generic(&x1,&x2,reset);
// #ifdef DEBUG_GROUPHOP
// printf("[PHY] SeqHop:");
// #endif
// for (ns=0; ns<20; ns++) {
// if ((frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == 0) &&
// (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled == 1))
// frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[ns] = (s>>(ns&0x1f))&1;
// else
// frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[ns] = 0;
// #ifdef DEBUG_GROUPHOP
// printf("%d.",frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[ns]);
// #endif
// }
// #ifdef DEBUG_GROUPHOP
// printf("\n");
// #endif
// }
// void generate_nPRS(LTE_DL_FRAME_PARMS *frame_parms)
// {
// uint16_t n=0;
// uint8_t reset=1;
// uint32_t x1, x2, s=0;
// // This is from Section 5.5.1.3
// uint8_t Nsymb_UL = (frame_parms->Ncp_UL == NORMAL) ? 7 : 6;
// uint16_t next = 0;
// uint8_t ns=0;
// uint32_t fss_pucch = (frame_parms->Nid_cell) % 30;
// uint32_t fss_pusch = (fss_pucch + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH) % 30;
// x2 = (32*(uint32_t)(frame_parms->Nid_cell/30)) + fss_pusch;
// #ifdef DEBUG_GROUPHOP
// printf("[PHY] nPRS:");
// #endif
// for (n=0; n<(20*Nsymb_UL); n++) { //loop over total number of bytes to generate
// if ((n&3) == 0) {
// s = lte_gold_generic(&x1,&x2,reset);
// reset = 0;
// // printf("n %d : s (%d,%d,%d,%d)\n",n,((uint8_t*)&s)[0],((uint8_t*)&s)[1],((uint8_t*)&s)[2],((uint8_t*)&s)[3]);
// }
// if (n == next) {
// frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[ns] = ((uint8_t*)&s)[next&3];
// #ifdef DEBUG_GROUPHOP
// printf("%d.",frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[ns]);
// #endif
// ns++;
// next+=Nsymb_UL;
// }
// }
// #ifdef DEBUG_GROUPHOP
// printf("\n");
// #endif
// }
void init_ul_hopping_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms)
{
////////////////////////////////////////generate_grouphop(frame_parms);
// generate_seqhop(frame_parms);
// generate_nPRS(frame_parms);
}

View File

@@ -0,0 +1,252 @@
/*
* 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.0 (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/LTE_TRANSPORT/lte_mcs_NB_IoT.c
* \brief Some support routines for subcarrier start into UL RB for ULSCH
* \author M. KANJ
* \date 2017
* \version 0.1
* \company b<>com
* \email:
* \note
* \warning
*/
//#include "PHY/defs.h"
//#include "PHY/extern.h"
#include "PHY/NBIoT_TRANSPORT/proto_NB_IoT.h"
uint8_t tab_ack_15khz[16]= {0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3};
uint8_t tab_ack_3_75khz[16]= {38,39,40,41,42,43,44,45,38,39,40,41,42,43,44,45};
uint8_t tab_I_ru_N_ru_UL[8]= {1,2,3,4,5,6,8,10};
uint8_t tab_I_rep_N_rep_UL[8]={1,2,4,8,16,32,64,128};
///
uint8_t tab_ack_sc_format1[16]={0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3};
uint8_t tab_ack_sc_format2[16]={38,39,40,41,42,43,44,45,38,39,40,41,42,43,44,45};
/*
// Section 16.5.1.1 in 36.213
uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc)
{
if (0<=I_sc && I_sc<=11)
{
return I_sc;
} else if (12<=I_sc && I_sc<=15) {
return 3*(I_sc-12);
} else if (16<=I_sc && I_sc<=17) {
return 6*(I_sc-16);
} else if (I_sc==18){
return 0;
} else if (I_sc>18 || I_sc<0){
return -1; /// error msg is needed for this case
} else {
return -1; /// error msg is needed for this case
}
}
*/
uint16_t get_UL_N_rep_NB_IoT(uint8_t I_rep)
{
return tab_I_rep_N_rep_UL[I_rep];
}
uint16_t get_UL_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3)
{
if(flag_msg3 ==1) // msg3
{
if(I_mcs == 0)
{
return 4;
} else if(I_mcs == 1) {
return 3;
} else if(I_mcs == 2) {
return 1;
} else {
//printf("error in I_mcs value from nfapi");
return 0;
}
} else { // other NPUSCH
return tab_I_ru_N_ru_UL[I_ru];
}
}
uint16_t get_UL_sc_ACK_NB_IoT(uint8_t subcarrier_spacing,uint16_t harq_ack_resource)
{
if(subcarrier_spacing == 1) /// 15KHz
{
return tab_ack_sc_format1[harq_ack_resource];
} else { // 3.75 KHz
return tab_ack_sc_format2[harq_ack_resource];
}
}
uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, uint8_t npush_format)
{
if(npush_format == 0) // format 1
{
if(subcarrier_spacing == 1) ////////// 15 KHz
{
if (0<=I_sc && I_sc<12)
{
return I_sc;
} else if (12<=I_sc && I_sc<16) {
return 3*(I_sc-12);
} else if (16<=I_sc && I_sc<18) {
return 6*(I_sc-16);
} else if (I_sc==18){
return 0;
} else {
return -1;
printf("Error in passed nfapi parameters (I_sc)");
}
} else { //////////// 3.75 KHz
return I_sc; /// values 0-47
}
} else { /////////////////////////////////////// format 2
if(subcarrier_spacing == 1) ////////// 15 KHz
{
return(tab_ack_15khz[I_sc]);
} else { //////////// 3.75 KHz
return(tab_ack_3_75khz[I_sc]);
}
}
}
///////////////////////////////////////////////
uint8_t get_numb_UL_sc_NB_IoT(uint8_t subcarrier_spacing, uint8_t I_sc, uint8_t npush_format)
{
if(npush_format == 0) // format 1
{
if(subcarrier_spacing == 1) // 15 KHz
{
if(I_sc >= 0 && I_sc < 12)
{
return 1;
} else if (I_sc >= 12 && I_sc < 16) {
return 3;
} else if (I_sc >= 16 && I_sc < 18) {
return 6;
} else if (I_sc == 18) {
return 12;
} else {
return 0;
}
} else {
return 1;
}
} else {
return 1;
}
}
////////////////////////////////////////////////////
uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrier_indcation, uint8_t UL_format)
{
uint8_t subcarrier_number = get_numb_UL_sc_NB_IoT(subcarrier_spacing, subcarrier_indcation, UL_format);
if(UL_format == 0) // format 1
{
if(subcarrier_spacing == 1) // 15 KHz
{
if (subcarrier_number == 1 )
{
return 16;
} else if (subcarrier_number == 3) {
return 8;
} else if (subcarrier_number == 6) {
return 4;
} else {
return 2;
}
} else { // 3.75 KHz
return 16;
}
} else { // format 2
return 4;
}
}

View File

@@ -0,0 +1,266 @@
/*
* 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.0 (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/LTE_TRANSPORT/lte_mcs_NB_IoT.c
* \brief Some support routines for MCS computations
* \author M. KANJ
* \date 2017
* \version 0.1
* \company b<>com
* \email:
* \note
* \warning
*/
//#include "PHY/defs.h"
//#include "PHY/extern.h"
#include "PHY/NBIoT_TRANSPORT/proto_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/extern_NB_IoT.h"
uint8_t get_Qm_UL_NB_IoT(unsigned char I_mcs, uint8_t N_sc_RU, uint8_t I_sc, uint8_t Msg3_flag)
{
if (Msg3_flag == 1) /////////////////////////// case of Msg3
{
if(I_mcs > 0)
{
return 2;
} else if (I_mcs == 0 && I_sc <12) {
return 1;
} else { ////// I_mcs == 0 && I_sc >11
return 2;
}
} else { /////////////////////// case of other NPUSCH config
if(N_sc_RU == 1)
{
if(I_mcs <2)
{
return 1;
} else {
return 2;
}
} else { /////////////// N_sc_RU > 1
return 2;
}
}
}
int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms)
{
uint16_t num_ctrl_symbols = frame_parms->control_region_size; // eutra_control_region_size values are 0,1,2
uint8_t nb_antennas_tx_LTE = frame_parms->nb_antennas_tx;
uint8_t nb_antennas_tx_NB_IoT = frame_parms->nb_antennas_tx_NB_IoT;
int G_value=0;
switch (nb_antennas_tx_NB_IoT + (2*nb_antennas_tx_LTE)) {
case 10:
G_value = G_tab[(1*3)-num_ctrl_symbols-1];
break;
case 6:
G_value = G_tab[(2*3)-num_ctrl_symbols-1];
break;
case 4 :
G_value = G_tab[(3*3)-num_ctrl_symbols-1];
break;
case 9 :
G_value = G_tab[(4*3)-num_ctrl_symbols-1];
break;
case 5:
G_value = G_tab[(5*3)-num_ctrl_symbols-1];
break;
case 3 :
G_value = G_tab[(6*3)-num_ctrl_symbols-1];
break;
default:
printf("Error getting G");
}
return(G_value);
}
int get_G_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, uint8_t operation_mode_info)
{
uint16_t num_ctrl_symbols = 0; // eutra_control_region_size values are 0,1,2
if(operation_mode_info<2) /// operation_mode_info, in-band (two value 0,1), stand-alone(3), guard band (2)
{
num_ctrl_symbols = 2;
}
uint8_t nb_antennas_tx_LTE = frame_parms->nb_antennas_tx;
uint8_t nb_antennas_tx_NB_IoT = frame_parms->nb_antennas_tx_NB_IoT;
int G_value=0;
switch (nb_antennas_tx_NB_IoT + (2*nb_antennas_tx_LTE)) {
case 10:
G_value = G_tab[(1*3)-num_ctrl_symbols-1];
break;
case 6:
G_value = G_tab[(2*3)-num_ctrl_symbols-1];
break;
case 4 :
G_value = G_tab[(3*3)-num_ctrl_symbols-1];
break;
case 9 :
G_value = G_tab[(4*3)-num_ctrl_symbols-1];
break;
case 5:
G_value = G_tab[(5*3)-num_ctrl_symbols-1];
break;
case 3 :
G_value = G_tab[(6*3)-num_ctrl_symbols-1];
break;
default:
printf("Error getting G");
}
return(G_value);
}
int get_rep_num_SIB1_NB_IoT(uint8_t scheduling_info_sib1)
{
int value=0;
if(scheduling_info_sib1 >11)
{
printf("value not allowed for schedulinginfo for sib1");
} else {
switch(scheduling_info_sib1 % 3)
{
case 0:
value =4;
break;
case 1:
value =8;
break;
case 2:
value =16;
break;
}
}
return(value);
}
int get_start_frame_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint8_t repetition)
{
int value=0;
uint16_t cell_id = frame_parms->Nid_cell ;
if(repetition == 4)
{
switch(cell_id %4)
{
case 0:
value =0;
break;
case 1:
value =16;
break;
case 2:
value =32;
break;
case 3:
value =48;
break;
}
} else if(repetition == 8) {
switch(cell_id %2)
{
case 0:
value =0;
break;
case 1:
value =16;
break;
}
} else if(repetition == 16) {
switch(cell_id %2)
{
case 0:
value =0;
break;
case 1:
value =1;
break;
}
} else {
printf("Error in getting the starting frame of SIB1 ");
}
return(value);
}

View File

@@ -0,0 +1,365 @@
/* 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.0 (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/LTE_TRANSPORT/npbch_NB_IoT.c
* \Fucntions for the generation of broadcast channel (NPBCH) for NB_IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ, V. Savaux
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com , vincent.savaux@b-com.com
* \note
* \warning
*/
//#include "PHY/defs.h"
//#include "PHY/defs_NB_IoT.h"
//#include "PHY/CODING/extern.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
//#include "extern_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h"
//#include "PHY/sse_intrin.h"
#include "PHY/NBIoT_TRANSPORT/defs_NB_IoT.h"
#include "PHY/CODING/defs_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_top_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
//#ifdef PHY_ABSTRACTION
//#include "SIMULATION/TOOLS/defs.h"
//#endif
//#ifdef OPENAIR2
//#include "PHY_INTERFACE/defs.h"
//#endif
#define NPBCH_A 34 // 34 for NB-IoT and 24 for LTE
int scrambling_npbch_REs_rel_13_5_0(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
int l,
uint32_t symbol_offset,
uint8_t pilots,
unsigned short id_offset,
uint8_t *reset,
uint32_t *x1,
uint32_t *x2,
uint32_t *s,
uint8_t *flag_32)
{
uint32_t tti_offset,aa;
uint8_t re;
uint8_t first_re,last_re;
uint8_t c_even,c_odd;
int16_t theta_re,theta_im;
int16_t data_re[frame_parms->nb_antennas_tx],data_im[frame_parms->nb_antennas_tx];
uint32_t mem_jj=0;
first_re = 0;
last_re = 12;
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
if ((*jj)%32 == 0 && *flag_32 == 0){
*s = lte_gold_generic_NB_IoT(x1, x2, *reset);
*reset = 0;
mem_jj = *jj;
}
c_even = (*s>>*jj)&1;
c_odd = (*s>>(*jj+1))&1;
if (c_even == c_odd){
if(c_even){
theta_re = 0;
theta_im = -32767;
}else{
theta_re = 32767;
theta_im = 0;
}
}else{
if(c_even){
theta_re = 0;
theta_im = 32767;
}else{
theta_re = -32767;
theta_im = 0;
}
}
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || re%3 != id_offset) // if re is not a pilot
{
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
data_re[aa] = ((int16_t*)&txdataF[aa][tti_offset])[0];
data_im[aa] = ((int16_t*)&txdataF[aa][tti_offset])[1];
}
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] = (int16_t) (((int32_t) data_re[aa] * (int32_t) theta_re -
(int32_t) data_im[aa] * (int32_t) theta_im)>>15); //I //b_i
((int16_t*)&txdataF[aa][tti_offset])[1] = (int16_t) (((int32_t) data_im[aa] * (int32_t) theta_re +
(int32_t) data_re[aa] * (int32_t) theta_im)>>15); //Q //b_{i+1}
}
*jj = *jj + 2;
}
if (mem_jj == *jj) // avoid to shift lte_gold_generic_NB_IoT 2 times
{*flag_32 = 1;
}else
{*flag_32 = 0;
}
}
return(0);
}
int allocate_npbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
unsigned short id_offset,
uint32_t *re_allocated) // not used variable ??!!
{
MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)?SISO:ALAMOUTI;
uint32_t tti_offset,aa;
uint8_t re;
int16_t gain_lin_QPSK;
uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
first_re = 0;
last_re = 12;
for (re=first_re; re<last_re; re++) { // re varies between 0 and 12 sub-carriers
tti_offset = symbol_offset + re; // symbol_offset = 512 * L , re_offset = 512 - 3*12 , re
if (pilots != 1 || re%3 != id_offset) // if re is not a pilot
{
// diff_re = re%3 - id_offset;
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15_NB_IoT)>>15);
// fill in the rest of the ALAMOUTI precoding
if ( pilots != 1 || (re+1)%3 != id_offset) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
} else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
re++; // skip pilots
*re_allocated = *re_allocated + 1;
}
re++; // adjacent carriers are taken care of by precoding
*re_allocated = *re_allocated + 1; // incremented variable but never used
}
}
}
return(0);
}
/**********************************************************
**********************************************************/
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID,
uint8_t release_v13_5_0)
{
int i, l;
int id_offset;
uint32_t npbch_D,npbch_E;
uint8_t npbch_a[5]; // 34/8 =4.25 => 4 bytes and 2 bits
uint8_t RCC;
unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start, RB_IoT_ID;
uint32_t pilots;
uint32_t jj=0;
uint32_t re_allocated=0;
uint32_t symbol_offset;
uint16_t amask=0;
///////////////////////////// for release 13.5.0 and above ////////////////////////
uint32_t ii=0;
uint8_t reset=1,flag_32=0;
uint32_t x1_v13_5_0, x2_v13_5_0 =0, s_v13_5_0 =0;
x2_v13_5_0 = (((frame_parms->Nid_cell+1) * (frame_mod64%8 + 1) * (frame_mod64%8 + 1) * (frame_mod64%8 + 1)) <<9) + frame_parms->Nid_cell;
//////////////////////////////////////////////////////////////////////////////////
frame_parms->flag_free_sf =1;
npbch_D = 16 + NPBCH_A;
npbch_E = 1600;
if (frame_mod64==0) {
bzero(npbch_a,5); // initializing input data stream , filling with zeros
bzero(eNB_npbch->npbch_e,npbch_E); // filling with "0" the table pbch_e[1600]
memset(eNB_npbch->npbch_d,LTE_NULL_NB_IoT,96); // filling with "2" the first 96 elements of table pbch_d[216]
for (i=0; i<5; i++) // set input bits stream
{
npbch_a[i] = npbch_pdu[i]; // in LTE 24 bits with 3 bytes, but in NB_IoT 34 bits will require 4 bytes+2 bits !! to verify
}
if (frame_parms->mode1_flag == 1) // setting CRC mask depending on the number of used eNB antennas
amask = 0x0000;
else {
switch (frame_parms->nb_antennas_tx) { // *****???? better replacing nb_antennas_tx_eNB by nb_antennas_tx_eNB_NB_IoT
case 1:
amask = 0x0000;
break;
case 2:
amask = 0xffff;
break;
}
}
ccode_encode_NB_IoT(NPBCH_A,2,npbch_a,eNB_npbch->npbch_d+96,amask); // step 1 CRC Attachment
RCC = sub_block_interleaving_cc_NB_IoT(npbch_D,eNB_npbch->npbch_d+96,eNB_npbch->npbch_w); // step 2 Channel Coding
lte_rate_matching_cc_NB_IoT(RCC,npbch_E,eNB_npbch->npbch_w,eNB_npbch->npbch_e); // step 3 Rate Matching
npbch_scrambling(frame_parms, // step 4 Scrambling
eNB_npbch->npbch_e,
npbch_E);
}
// testing if the total number of RBs is even or odd
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd
RB_IoT_ID = NB_IoT_RB_ID;
// step 5, 6, 7 // modulation and mapping (slot 1, symbols 0..3)
for (l=3; l<14; l++) { // loop on OFDM symbols
if((l>=4 && l<=8) || (l>=11 && l<=13))
{
pilots =1;
} else {
pilots=0;
}
id_offset = frame_parms->Nid_cell % 3; // Cell_ID_NB_IoT % 3
if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
symbol_offset = frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
allocate_npbch_REs_in_RB(frame_parms,
txdataF,
&jj,
symbol_offset,
&eNB_npbch->npbch_e[(frame_mod64/8)*(npbch_E>>3)],
pilots,
amp,
id_offset,
&re_allocated);
if(release_v13_5_0 == 1)
{
scrambling_npbch_REs_rel_13_5_0(frame_parms,
txdataF,
&ii,
l,
symbol_offset,
pilots,
id_offset,
&reset,
&x1_v13_5_0,
&x2_v13_5_0,
&s_v13_5_0,
&flag_32);
}
}
return(0);
}
/**********************************************************
**********************************************************/
void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length) // 1600
{
int i;
uint8_t reset;
uint32_t x1, x2, s=0;
reset = 1;
x2 = frame_parms->Nid_cell;
for (i=0; i<length; i++) {
if ((i&0x1f)==0) {
s = lte_gold_generic_NB_IoT(&x1, &x2, reset);
reset = 0;
}
npbch_e[i] = (npbch_e[i]&1) ^ ((s>>(i&0x1f))&1);
}
}

View File

@@ -0,0 +1,493 @@
/*
* 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.0 (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/LTE_TRANSPORT/nprach_eNb_NB_IoT.c
* function for NPRACH signal detection and Timing Advance estimation
* \author V. Savaux
* \date 2018
* \version 0.1
* \company b<>com
* \email: vincent.savaux@b-com.com
* \note
* \warning
*/
//#include "PHY/sse_intrin.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/TOOLS/tools_defs.h" // to take into account the dft functions
#include "tables_nprach_NB_IoT.h"
#include "first_sc_NB_IoT.h"
//#include "PHY/extern.h"
//#include "prach.h"
//#include "PHY/LTE_TRANSPORT/if4_tools.h"
//#include "SCHED/defs.h"
//#include "SCHED/extern.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
int filter_xx[40] = {-2161, 453, 489, 570, 688, 838, 1014, 1209, 1420, 1639,
1862, 2082, 2295, 2495, 2677, 2837, 2969, 3072, 3142, 3178,
3178, 3142, 3072, 2969, 2837, 2677, 2495, 2295, 2082, 1862,
1639, 1420, 1209, 1014, 838, 688, 570, 489, 453, -2161}; // this is a low-pass filter
int16_t buffer_nprach[153600];
int16_t filtered_buffer[153600];
int16_t signal_compensed_re[153600];
int16_t signal_compensed_im[153600];
int16_t output_buffer[4800];
uint8_t NPRACH_detection_NB_IoT(int16_t *input_buffer,uint32_t input_length){
uint8_t cp_type = 0; // 0: short ; 1: extended
uint32_t nb_signal_samples,nb_noise_samples,n1,n2;
uint64_t energy_signal=0,energy_noise=0;
uint32_t n;
if(cp_type){
}else{
nb_signal_samples = (uint32_t)(((uint64_t) 62670*input_length)/100000);
nb_noise_samples = input_length - nb_signal_samples;
}
n1 = nb_signal_samples;
n2 = nb_noise_samples;
// printf("n samples = %i %i\n",FRAME_LENGTH_COMPLEX_SAMPLESx,nb_signal_samples);
for(n=0;n<nb_signal_samples;n++){
energy_signal += (((uint64_t)input_buffer[2*n]*input_buffer[2*n] + (uint64_t)input_buffer[2*n+1]*input_buffer[2*n+1])/n1);
//energy_signal += (uint64_t)(((uint64_t)input_buffer[2*n]*input_buffer[2*n] + (uint64_t)input_buffer[2*n+1]*input_buffer[2*n+1])/10);
}
for(n=nb_signal_samples;n<input_length;n++){
energy_noise += (((uint64_t)input_buffer[2*n]*input_buffer[2*n] + (uint64_t)input_buffer[2*n+1]*input_buffer[2*n+1])/n2);
//energy_noise += (uint64_t)(((uint64_t)input_buffer[2*n]*input_buffer[2*n] + (uint64_t)input_buffer[2*n+1]*input_buffer[2*n+1])/10);
}
//printf("energies = %ld %ld\n",energy_signal,energy_noise);
if ((uint64_t)(((uint64_t) energy_signal))<(uint64_t)energy_noise>>6){
return 1;
}else{
return 0;
}
}
/*uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB *eNB,
int16_t *Rx_sub_sampled_buffer,
uint16_t sub_sampling_rate,
uint16_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
uint32_t estimated_TA_coarse,
uint8_t coarse){
uint16_t length_seq_NPRACH,length_CP,length_symbol; // in number of samples, per NPRACH preamble: 4 sequences ; length of CP in number of samples
uint16_t length_CP_0 = 2048;//eNB->frame_parms.prach_config_common.nprach_CP_Length; //NB-IoT: 0: short, 1: long
uint32_t fs=30720000; //NB-IoT: sampling frequency of Rx_buffer, must be defined somewhere
uint32_t fs_sub_sampled;
uint16_t length_correl_window,base_length;
int64_t *vec_correlation;
int64_t max_correlation = 0;
//int16_t **matrix_received_signal_re, **matrix_received_signal_im;
uint16_t offset_estimation, offset_start; // offset due to first coarse estimation
// double *** mat_to_phase_estimation_re, *** mat_to_phase_estimation_im;
int64_t average_mat_to_phase_re, average_mat_to_phase_im;
float estimated_phase, estimated_CFO, CFO_correction, CFO_correction_k;
// int16_t *vec_CFO_compensation_re, *vec_CFO_compensation_im;
// int16_t *vec_received_signal_re, *vec_received_signal_im;
int16_t *signal_CFO_compensed_re, *signal_CFO_compensed_im;
int32_t **sub_sequence_reference_re, **sub_sequence_reference_im;
int32_t *sequence_reference_re, *sequence_reference_im;
uint32_t TA_sample_estimated = 0;
int32_t A;//,B;
int n,k,m,o;
int32_t pow_n1 = 1;
uint32_t index_av_ph1, index_av_ph2;
if (coarse){ // coarse = 1: first estimation at 240 kHz
length_seq_NPRACH = (length_CP_0+5*8192)/128;
length_CP = length_CP_0/128;
length_symbol = 64;
offset_start = 0;
length_correl_window = 80; //20512/sub_sampling_rate; // corresponds to the max TA, i.e. 667.66 micro s //FRAME_LENGTH_COMPLEX_SUB_SAMPLES - 4*length_seq_NPRACH+1;
fs_sub_sampled = (uint32_t)fs/128;
}else{
length_seq_NPRACH = (length_CP_0+5*8192)/16;
length_CP = length_CP_0/16;
length_symbol = 8192/16;
offset_estimation = 8 * estimated_TA_coarse;
base_length = 32;
// we arbitrarily define the length of correl window as base_length samples.
// Check if offset_estimation is close to zero or 1282 (max lentgh of delays)
if (offset_estimation-base_length/2 <0){
offset_start = 0;
length_correl_window = offset_estimation + base_length/2;
}
if (offset_estimation+base_length/2 >1281){
offset_start = offset_estimation-base_length/2;
length_correl_window = base_length;// 512 - (1282-offset_estimation);
}
if ((offset_estimation-base_length/2 >=0) && (offset_estimation+base_length/2 <=1281)){
offset_start = offset_estimation-base_length/2;
length_correl_window = base_length;
}
err
fs_sub_sampled = (uint32_t)fs/16;
}
//fs_sub_sampled = (uint32_t)fs/sub_sampling_rate;
// Method: MMSE (sub-optimal) CFO estimation -> CFO compensation -> ML (sub-optimal) TA estimation /============================================================/
//matrix_received_signal_re = (int16_t **)malloc(4*sizeof(int16_t *));
//matrix_received_signal_im = (int16_t **)malloc(4*sizeof(int16_t *));
// for (k=0;k<4;k++){ // # sequence
// matrix_received_signal_re[k] = (int16_t *)malloc((length_seq_NPRACH-length_CP)*sizeof(int16_t)); // avoid CP in this process
// matrix_received_signal_im[k] = (int16_t *)malloc((length_seq_NPRACH-length_CP)*sizeof(int16_t)); // avoid CP in this process
// }
signal_CFO_compensed_re = (int16_t *)malloc(4*length_seq_NPRACH*sizeof(int16_t)); /////to do : exact size of tables
signal_CFO_compensed_im = (int16_t *)malloc(4*length_seq_NPRACH*sizeof(int16_t));
sub_sequence_reference_re = (int32_t **)malloc(4*sizeof(int32_t *));
sub_sequence_reference_im = (int32_t **)malloc(4*sizeof(int32_t *));
for (k=0;k<4;k++){
sub_sequence_reference_re[k] = (int32_t *)calloc(length_symbol,sizeof(int32_t));
sub_sequence_reference_im[k] = (int32_t *)calloc(length_symbol,sizeof(int32_t));
}
sequence_reference_re = (int32_t *)malloc(4*length_seq_NPRACH*sizeof(int32_t));
sequence_reference_im = (int32_t *)malloc(4*length_seq_NPRACH*sizeof(int32_t));
vec_correlation = (int64_t *)calloc(length_correl_window,sizeof(int64_t));
for (n=0;n<length_correl_window;n++){ // loops over samples %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// MMSE (sub-optimal) CFO estimation /============================================================/
average_mat_to_phase_re = 0;
average_mat_to_phase_im = 0;
for (k=0;k<4;k++){ // # sequence
for (o=0;o<4;o++){ // # symbol in sequence
for (m=0;m<length_symbol;m++){ ///// creation of two variables for tab indexes "n+offset_start+k*length_seq_NPRACH+length_CP+o*length_symbol+m"
index_av_ph1 = (n+offset_start+k*length_seq_NPRACH+length_CP+o*length_symbol+m)<<1;
index_av_ph2 = index_av_ph1 + (length_symbol<<1);
average_mat_to_phase_re = average_mat_to_phase_re
- (int64_t)(Rx_sub_sampled_buffer[index_av_ph1]
* Rx_sub_sampled_buffer[index_av_ph2])
- (int64_t)(Rx_sub_sampled_buffer[index_av_ph1+1]
* Rx_sub_sampled_buffer[index_av_ph2+1]);
average_mat_to_phase_im = average_mat_to_phase_im
- (int64_t)(Rx_sub_sampled_buffer[index_av_ph1+1]
* Rx_sub_sampled_buffer[index_av_ph2])
+ (int64_t)(Rx_sub_sampled_buffer[index_av_ph1]
* Rx_sub_sampled_buffer[index_av_ph2+1]);
}
}
}
average_mat_to_phase_re = average_mat_to_phase_re/(16*length_symbol);
average_mat_to_phase_im = average_mat_to_phase_im/(16*length_symbol);
estimated_phase = atan2f(average_mat_to_phase_im,average_mat_to_phase_re);
estimated_CFO = ((float)fs*estimated_phase)/(8192*2*(float)M_PI);
CFO_correction = 2*(float)M_PI*estimated_CFO/fs_sub_sampled;
// CFO compensation /============================================================/
for (k=0;k<4*length_seq_NPRACH;k++){ ///// creation of two variables for tab indexes /// replace "2*(float)M_PI*estimated_CFO*k/fs_sub_sampled" and "2*(n+offset_start+k)"
CFO_correction_k = (float)k*CFO_correction;
signal_CFO_compensed_re[k] = (int16_t)((Rx_sub_sampled_buffer[(n+offset_start+k)<<1] * (int32_t)(cosf(CFO_correction_k)*32767)
- Rx_sub_sampled_buffer[((n+offset_start+k)<<1)+1] * (int32_t)(sinf(CFO_correction_k)*32767))>>15);
signal_CFO_compensed_im[k] = (int16_t)((Rx_sub_sampled_buffer[(n+offset_start+k)<<1] * (int32_t)(sinf(CFO_correction_k)*32767)
+ Rx_sub_sampled_buffer[((n+offset_start+k)<<1)+1] * (int32_t)(cosf(CFO_correction_k)*32767))>>15);
}
// sub-optimal ML TA estimation /============================================================/
for (k=0;k<4;k++){ // loop over the 4 sequences of a preamble
pow_n1 = 1;
for (o=0;o<5;o++){ // loop over the symbols of a sequence
for (m=0;m<length_symbol;m++){
// mon_variable=k*length_seq_NPRACH + o*length_symbol + length_CP + m ///////////////////////////////////////////////////////////////////////////////////////////////
sub_sequence_reference_re[k][m] = sub_sequence_reference_re[k][m] + pow_n1 * signal_CFO_compensed_re[k*length_seq_NPRACH + o*length_symbol + length_CP + m] / 5; // average over the 5 symbols of a group
sub_sequence_reference_im[k][m] = sub_sequence_reference_im[k][m] + pow_n1 * signal_CFO_compensed_im [k*length_seq_NPRACH + o*length_symbol + length_CP + m]/ 5; // average over the 5 symbols of a group
}
pow_n1 = -pow_n1;
}
}
pow_n1 = 1;
for (k=0;k<4;k++){ // loop over the 4 sequences of a preamble
pow_n1 = 1;
for (o=0;o<5;o++){ // loop over the symbols of a sequence // mon_variable=k*length_seq_NPRACH+o*length_symbol +length_CP +m///////////////////////////////////////////////
for (m=0;m<length_symbol;m++){
sequence_reference_re[k*length_seq_NPRACH+o*length_symbol +length_CP +m] = pow_n1 * sub_sequence_reference_re[k][m];
sequence_reference_im[k*length_seq_NPRACH+o*length_symbol +length_CP +m] = pow_n1 * sub_sequence_reference_im[k][m];
}
pow_n1 = -pow_n1;
}
}
for (k=0;k<4;k++){ // loop over the 4 sequences of a preamble
for (m=0;m<length_CP;m++){
sequence_reference_re[k*length_seq_NPRACH+m] = -sub_sequence_reference_re[k][length_symbol-length_CP+m];
sequence_reference_im[k*length_seq_NPRACH+m] = -sub_sequence_reference_im[k][length_symbol-length_CP+m];
}
}
// for (m=0;m<length_seq_NPRACH;m++){
// vec_correlation[n] = vec_correlation[n] + (double)signal_CFO_compensed_re[m] * sequence_reference_re[m] + (double)signal_CFO_compensed_im[m] * sequence_reference_im[m];
// printf("seq=%i\n",sequence_reference_re[m]);
// }
for (m=0;m<4*length_seq_NPRACH;m++){
A = (int64_t)((signal_CFO_compensed_re[m] * sequence_reference_re[m]
+ signal_CFO_compensed_im[m] * sequence_reference_im[m]));
//B = -(int32_t)(((int64_t)signal_CFO_compensed_re[m] * (int64_t)sequence_reference_im[m]
// - (int64_t)signal_CFO_compensed_im[m] * (int64_t)sequence_reference_re[m])>>32);
vec_correlation[n] = vec_correlation[n] + A;//(int32_t)(((int64_t)A*(int64_t)A + 2*(int64_t)B*(int64_t)B)>>32);
}
for (k=0;k<4;k++){ // re-initialize sub_sequence_reference matrices ////////////////////////////////////////////
for (m=0;m<length_symbol;m++){
sub_sequence_reference_re[k][m] = 0;
sub_sequence_reference_im[k][m] = 0;
}
}
}
for (n=0;n<length_correl_window;n++){
//printf("\ncorr=%li \n",vec_correlation[n]);
if(vec_correlation[n]>=max_correlation){
max_correlation = vec_correlation[n];
TA_sample_estimated = offset_start+ n;
}
}
free(vec_correlation);
for (k=0;k<4;k++){ // # sequence
//free(matrix_received_signal_re[k]);
err//free(matrix_received_signal_im[k]);
free(sub_sequence_reference_re[k]);
free(sub_sequence_reference_im[k]);
}
//free(matrix_received_signal_re);
//free(matrix_received_signal_im);
free(signal_CFO_compensed_re);
free(signal_CFO_compensed_im);
free(sub_sequence_reference_re);
free(sub_sequence_reference_im);
return TA_sample_estimated;
} */
uint16_t subcarrier_estimation(int16_t *input_buffer){
uint16_t estimated_sc=0;
int16_t *s_n_re, *s_n_im;
uint16_t k,m,n;
int64_t max_correl_sc_m = 0;
int64_t max_correl_sc_k = 0;
int64_t max_correl_sc_glob = 0;
int n_start_offset = 1920; // start at t=8 ms
for (k=0;k<12;k++){
s_n_re = &s_n_12_re[k*336];
s_n_im = &s_n_12_im[k*336];
for (m=0;m<20;m++){
for (n=0;n<336;n++){
max_correl_sc_m = max_correl_sc_m +
(int16_t)(((int32_t)input_buffer[(m<<1)+((n+n_start_offset)<<1)]*(int32_t)s_n_re[n] )>>15)
+ (int16_t)(((int32_t)input_buffer[(m<<1)+((n+n_start_offset)<<1)+1]*(int32_t)s_n_im[n])>>15);
}
if (max_correl_sc_m>max_correl_sc_k){
max_correl_sc_k = max_correl_sc_m;
}
max_correl_sc_m = 0;
}
//printf("correl = %li\n",max_correl_sc_k);
if (max_correl_sc_k>max_correl_sc_glob){
max_correl_sc_glob = max_correl_sc_k;
estimated_sc = k;
}
max_correl_sc_k = 0;
}
return estimated_sc;
}
int16_t* sub_sampling_NB_IoT(int16_t *input_buffer, uint32_t length_input, uint32_t *length_ouput, uint16_t sub_sampling_rate){ // void function ////// adding flag for switching between output_buffers
int k;
uint32_t L;
//int16_t *output_buffer;
int16_t *p_output_buffer;
L = (uint32_t)(length_input / sub_sampling_rate);
*length_ouput = L; ///// to remove
for (k=0;k<L;k++){
output_buffer[k<<1] = input_buffer[sub_sampling_rate*(k<<1)];
output_buffer[(k<<1)+1] = input_buffer[sub_sampling_rate*(k<<1)+1];
}
// for (k=0;k<2*L;k++){
// printf("%i\n",output_buffer[k]);
// }
p_output_buffer=output_buffer;
return p_output_buffer;
}
void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t FRAME_LENGTH_COMPLEX_SAMPLESx){
int n;
//int k;
//float f_s_RB22 = 1807.5;
//float f_s = 7680;
//int16_t *signal_compensed_re, *signal_compensed_im;
int16_t *cos_x, *sin_x;
cos_x = cos_x_rb22;
sin_x = sin_x_rb22;
for (n=0;n<FRAME_LENGTH_COMPLEX_SAMPLESx;n++){
signal_compensed_re[n] = (int16_t)((input_buffer[n<<1] * (int32_t)(cos_x[n])
+ input_buffer[(n<<1)+1] * (int32_t)(sin_x[n]))>>15);
signal_compensed_im[n] = (int16_t)((- input_buffer[n<<1] * (int32_t)(sin_x[n])
+ input_buffer[(n<<1)+1] * (int32_t)(cos_x[n]))>>15);
filtered_buffer[n<<1] = signal_compensed_re[n];
filtered_buffer[(n<<1)+1] = signal_compensed_im[n];
}
/*for (n=0;n<FRAME_LENGTH_COMPLEX_SAMPLESx-10;n++){
if (n<20){
for (k=-n;k<20;k++){
filtered_buffer[n<<1] = filtered_buffer[n<<1] + (int16_t)(((int32_t)filter_xx[20+k]*(int32_t)signal_compensed_re[n+k])>>15);
filtered_buffer[(n<<1)+1] = filtered_buffer[(n<<1)+1] + (int16_t)(((int32_t)filter_xx[20+k]*(int32_t)signal_compensed_im[n+k])>>15);
}
}else{
for (k=-20;k<20;k++){
filtered_buffer[n<<1] = filtered_buffer[n<<1] + (int16_t)(((int32_t)filter_xx[20+k]*(int32_t)signal_compensed_re[n+k])>>15);
filtered_buffer[(n<<1)+1] = filtered_buffer[(n<<1)+1] + (int16_t)(((int32_t)filter_xx[20+k]*(int32_t)signal_compensed_im[n+k])>>15);
}
}
}*/
}
uint32_t process_nprach_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int frame, uint8_t subframe, uint16_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance){
//uint32_t estimated_TA_coarse=0;
//uint32_t estimated_TA;
int16_t *Rx_sub_sampled_buffer_128; // *Rx_sub_sampled_buffer_16;
uint16_t sub_sampling_rate; //NB-IoT: to be defined somewhere
uint32_t FRAME_LENGTH_COMPLEX_SAMPLESx; // NB-IoT: length of input buffer, to be defined somewhere
uint32_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES; // Length of buffer after sub-sampling
uint32_t *length_ouput; // Length of buffer after sub-sampling
// uint8_t coarse=1; // flag that indicate the level of TA estimation
int16_t *Rx_buffer;
//int16_t *filtered_buffer;
//int n;
//// 1. Coarse TA estimation using sub sampling rate = 128, i.e. fs = 240 kHz
FRAME_LENGTH_COMPLEX_SAMPLESx = 10*eNB->frame_parms.samples_per_tti;
Rx_buffer = (int16_t*)&eNB->common_vars.rxdata[0][0][0]; // get the whole frame
memcpy(&buffer_nprach[0],&Rx_buffer[0],307200);
//filtered_buffer = (int16_t *)calloc(2*FRAME_LENGTH_COMPLEX_SAMPLESx,sizeof(int16_t)); // calcule du taille exacte du tableau 76800
memset(filtered_buffer,0,307200);
filtering_signal(buffer_nprach,filtered_buffer,FRAME_LENGTH_COMPLEX_SAMPLESx);
// Sub-sampling stage /============================================================/
sub_sampling_rate = FRAME_LENGTH_COMPLEX_SAMPLESx/2400; // gives the sub-sampling rate leading to f=240 kHz
length_ouput = &FRAME_LENGTH_COMPLEX_SUB_SAMPLES;
Rx_sub_sampled_buffer_128 = sub_sampling_NB_IoT(filtered_buffer,FRAME_LENGTH_COMPLEX_SAMPLESx,length_ouput, sub_sampling_rate);
// Detection and TA estimation stage /============================================================/
if (NPRACH_detection_NB_IoT(Rx_sub_sampled_buffer_128,*length_ouput)){
/* estimated_TA_coarse = TA_estimation_NB_IoT(eNB,
Rx_sub_sampled_buffer_128,
sub_sampling_rate,
FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
estimated_TA_coarse,
coarse);
// 2. Fine TA estimation using sub sampling rate = 16, i.e. fs = 1.92 MHz
// Sub-sampling stage /============================================================/
//// sub_sampling_rate = FRAME_LENGTH_COMPLEX_SAMPLESx/(2400*8);
Rx_sub_sampled_buffer_16 = sub_sampling_NB_IoT(filtered_buffer,FRAME_LENGTH_COMPLEX_SAMPLESx,length_ouput, sub_sampling_rate);
// Fine TA estimation stage /============================================================/
// start1 = clock();
coarse = 0;
estimated_TA = TA_estimation_NB_IoT(eNB,
Rx_sub_sampled_buffer_16,
sub_sampling_rate,
FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
estimated_TA_coarse,
coarse); //
// Needs to be stored in a variable in PHY_VARS_eNB_NB_IoT structure
//for (n=0;n<FRAME_LENGTH_COMPLEX_SAMPLESx;n++){
//printf(" buf%i= %i",n,Rx_sub_sampled_buffer_128[2*n]);
// fprintf(f," %i %i ",Rx_buffer[2*n],Rx_buffer[2*n+1]);
//fprintf(f,"%i \n",Rx_buffer[2*n+1]);
//}*/
printf("\ndetection !!! at frame %i \n",frame);
//eNB->preamble_index_NB_IoT = subcarrier_estimation(Rx_sub_sampled_buffer_128); // c'est un uint16_t
*preamble_index = subcarrier_estimation(Rx_sub_sampled_buffer_128);
*timing_advance = 0;
*rnti = 1 + frame/4;
printf("estimated subaccier = %i\n",*preamble_index);
return 1;//estimated_TA;
}else{
return 0;
}
// }
return 0;
}

View File

@@ -0,0 +1,187 @@
/* 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.0 (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/LTE_TRANSPORT/npss_NB_IoT.c
* \Generation of Narrowband Primary Synchronisation Signal(NPSS) for NB-IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
///////////////#include "PHY/defs_nb_iot.h"
#include "PHY/phy_extern.h"
#include <math.h>
//#include "PHY/impl_defs_lte_NB_IoT.h"
//#include "PHY/impl_defs_top_NB_IoT.h"
//or #include "PHY/defs_nb_iot.h"
#include "PHY/LTE_REFSIG/primary_synch_NB_IoT.h"
int generate_npss_NB_IoT(int32_t **txdataF,
short amp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
unsigned short slot_offset,
unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
{
unsigned short c,aa,a,s;
unsigned short slot_id;
short *primary_sync;
unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT
unsigned short bandwidth_even_odd;
frame_parms->flag_free_sf =1;
slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5)
primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h
// Signal amplitude
a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
// Testing if the total number of RBs is even or odd (i.e. Identification of the bandwidth: 1.4, 3, 5, 10, ... MHz)
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 for even, 1 for odd
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols
{
for (c=0; c<12; c++) { // loop on NB-IoT carriers
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
(a * primary_sync[2*c + (2*12*s)]) >> 15;
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
(a * primary_sync[2*c + (2*12*s) + 1]) >> 15;
}
}
}
return(0);
}
// int generate_npss_NB_IoT(int32_t **txdataF,
// short amp,
// LTE_DL_FRAME_PARMS *frame_parms,
// unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
// unsigned short slot_offset,
// unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
// {
// unsigned short c,aa,a,s;
// unsigned short slot_id;
// short *primary_sync;
// unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT
// unsigned short bandwidth_even_odd;
// unsigned short UL_RB_ID_NB_IoT; // index of the NB-IoT RB
// unsigned char poffset=0, pilot=0; // poffset: base frequency offset of pilots; pilot: LTE pilot flag
// UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID; // index of RB dedicated to NB-IoT
// slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5)
// primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h
// // Signal amplitude
// a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
// // Testing if the total number of RBs is even or odd (i.e. Identification of the bandwidth: 1.4, 3, 5, 10, ... MHz)
// bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 for even, 1 for odd
// for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
// if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
// { // RB in first half (below DC)
// // NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
// NB_IoT_start = UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset;
// } else { // RB in the second half (above DC): DC is taken into account
// // NB_IoT_start = 1+ (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
// NB_IoT_start = 1 + bandwidth_even_odd*6 + 6*(2*UL_RB_ID_NB_IoT - (frame_parms->N_RB_DL+bandwidth_even_odd));
// }
// // For the In-band or Stand-alone case the REs of NPSS signal have the same positions
// for (s=0; s<11; s++ ) // loop on OFDM symbols
// {
// // CRS (LTE pilot) position within subframe in time
// // Note that pilot position takes into account symbol_offset value
// if (frame_parms->mode1_flag==1){ // SISO mode
// if (s==1 || s==4 || s==8){
// pilot = 1;
// if (s==1 || s==8){
// poffset = 3;
// }
// }
// }
// if (pilot == 0){
// for (c=0; c<12; c++) { // loop on NB-IoT carriers
// ((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
// (a * primary_sync[2*c + (2*12*s)]) >> 15;
// ((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
// (a * primary_sync[2*c + (2*12*s) + 1]) >> 15;
// }
// }
// else{
// for (c=0; c<12; c++) { // loop on NB-IoT carriers
// if ((c!=(frame_parms->nushift+poffset)) &&
// (c!=((frame_parms->nushift+poffset+6)%12)))
// {
// ((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
// (a * primary_sync[2*c + (2*12*s)]) >> 15;
// ((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
// (a * primary_sync[2*c + (2*12*s) + 1]) >> 15;
// }
// }
// }
// pilot = 0;
// poffset = 0;
// }
// }
// return(0);
// }
/* (for LTE)
int generate_pss_emul(PHY_VARS_eNB_NB_IoT *phy_vars_eNb,uint8_t sect_id)
{
msg("[PHY] EMUL eNB generate_pss_emul eNB %d, sect_id %d\n",phy_vars_eNb->Mod_id,sect_id);
eNB_transport_info[phy_vars_eNb->Mod_id][phy_vars_eNb->CC_id].cntl.pss=sect_id;
return(0);
}
*/

View File

@@ -0,0 +1,295 @@
/* 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.0 (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/LTE_TRANSPORT/nsss_NB_IoT.c
* \Generation of Narrowband Secondary Synchronisation Signal(NSSS) for NB-IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
//#include <math.h>
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
//#include "PHY/defs_NB_IoT.h" // not can be replaced by impl_defs_lte_NB_IoT & impl_defs_top_NB_IoT if "msg" function is not used
//#include "defs.h"
//#include "PHY/extern_NB_IoT.h"
#include "PHY/phy_extern.h"
//#include "PHY/impl_defs_lte_NB_IoT.h"
//#include "PHY/impl_defs_top_NB_IoT.h"
#include "nsss_NB_IoT.h"
int generate_sss_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint16_t symbol_offset, // symbol_offset = 3 for NB-IoT
uint16_t slot_offset,
unsigned short frame_number, // new attribute (Get value from higher layer), it does not exist for LTE
unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
{
uint8_t aa,Nid2,f,q,s,c,u;
int16_t *d;
uint16_t n_f,Nid_NB_IoT;
unsigned short a;
uint16_t slot_id; // slot_id = 17 in NB_IoT
unsigned short bandwidth_even_odd;
unsigned short NB_IoT_start;
frame_parms->flag_free_sf =1;
n_f = frame_number;
Nid_NB_IoT = frame_parms->Nid_cell; // supposing Cell_Id of LTE = Cell_Id of NB-IoT // if different , NB_IOT_DL_FRAME_PARMS should be includes as attribute
f = (n_f/2) % 4; // f = 0, 1, 2, 3
q = Nid_NB_IoT/126; // q = 0, 1, 2, 3
u = (Nid_NB_IoT % 126);
Nid2 = q*4 + f; // Nid2 = 0..15
switch (Nid2) {
case 0:
d = d0f0;
break;
case 1:
d = d0f1;
break;
case 2:
d = d0f2;
break;
case 3:
d = d0f3;
break;
case 4:
d = d1f0;
break;
case 5:
d = d1f1;
break;
case 6:
d = d1f2;
break;
case 7:
d = d1f3;
break;
case 8:
d = d2f0;
break;
case 9:
d = d2f1;
break;
case 10:
d = d2f2;
break;
case 11:
d = d2f3;
case 12:
d = d3f0;
break;
case 13:
d = d3f1;
break;
case 14:
d = d3f2;
break;
case 15:
d = d3f3;
break;
default:
msg("[NSSS] ERROR\n");
return(-1);
}
slot_id = slot_offset;
// Signal amplitude
a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
// Testing if the total number of RBs is even or odd (i.e. Identification of the bandwidth: 1.4, 3, 5, 10, ... MHz)
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols
{
for (c=0; c<12; c++) { // loop on NB-IoT carriers
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
(a * d[(2*u*132) + (2*c) + (2*s*12) ]) >> 15;
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
(a * d[(2*u*132) + (2*c) + (2*s*12) + 1]) >> 15;
}
}
}
return(0);
}
int rx_nsss_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int32_t *tot_metric)
{
uint8_t Nid2,q_est,u_est;
NB_IoT_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int l,k,m;
int toto=0;
int16_t *d, *nsss_sf;
int32_t nsss_ext[2][132]; // up to 2 rx antennas ?
int32_t metric; // correlation metric
// we suppose we are in NSSS subframe, after DFT
// this could be changed in further version
for (l=0;l<11;l++){
toto = nsss_extract_NB_IoT(ue,frame_parms,nsss_ext,l);
}
// now do the Cell ID estimation based on the precomputed sequences in PHY/LTE_TRANSPORT/nsss_NB_IoT.h
*tot_metric = -99999999;
nsss_sf = (int16_t*)&nsss_ext[0][0];
for (Nid2=0;Nid2<16;Nid2++){
switch (Nid2) {
case 0:
d = d0f0;
break;
case 1:
d = d0f1;
break;
case 2:
d = d0f2;
break;
case 3:
d = d0f3;
break;
case 4:
d = d1f0;
break;
case 5:
d = d1f1;
break;
case 6:
d = d1f2;
break;
case 7:
d = d1f3;
break;
case 8:
d = d2f0;
break;
case 9:
d = d2f1;
break;
case 10:
d = d2f2;
break;
case 11:
d = d2f3;
case 12:
d = d3f0;
break;
case 13:
d = d3f1;
break;
case 14:
d = d3f2;
break;
case 15:
d = d3f3;
break;
default:
msg("[NSSS] ERROR\n");
return(-1);
}
for (k=0;k<126;k++){ // corresponds to u in standard
metric = 0;
for (m=0;m<132;m++){ // 132 resource elements in NSSS subframe
metric += (int32_t)d[(k*126+m)<<1] * (int32_t)nsss_sf[(k*126+m)<<1] +
(int32_t)d[((k*126+m)<<1)+1] * (int32_t)nsss_sf[((k*126+m)<<1)+1]; // real part of correlation
}
if (metric > *tot_metric){
q_est = Nid2/4;
u_est = k;
ue->frame_parms.Nid_cell = q_est*126 + u_est;
}
}
}
return(0);
}
int nsss_extract_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **nsss_ext,
int l)
{
uint8_t i,aarx;
unsigned short UL_RB_ID_NB_IoT; // index of RB dedicated to NB-IoT
int32_t *nsss_rxF,*nsssF_ext;
int32_t **rxdataF;
int first_symbol_offset = 3; // NSSS starts at third symbol in subframe
UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF; // Note that
nsssF_ext = &nsss_ext[aarx][l*12];
if (UL_RB_ID_NB_IoT <= (frame_parms->N_RB_DL>>1)) { // NB-IoT RB is in the first half
nsss_rxF = &rxdataF[aarx][(UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset + ((l+first_symbol_offset)*(frame_parms->ofdm_symbol_size)))];
}// For second half of RBs skip DC carrier
else{ // NB-IoT RB is in the second half
nsss_rxF = &rxdataF[aarx][(1 + 6*(2*UL_RB_ID_NB_IoT - frame_parms->N_RB_DL) + ((l+first_symbol_offset)*(frame_parms->ofdm_symbol_size)))];
//dl_ch0++;
}
for (i=0; i<12; i++) {
nsssF_ext[i]=nsss_rxF[i];
}
}
return(0);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,133 @@
clear all
% nsss_gen / matlab
% Copyright 2016 b<>com. All rights reserved.
% description: generation of NSSS subframe
% Reference: 3GPP TS36.211 release 13
% author: Vincent Savaux, b<>com, Rennes, France
% email: vincent.savaux@b-com.com
% Input : \
% Output : matrix NSSS_frame
% Parameters
% frame_number = 100;
% cellID = 200;
% % % Mapping results to estimated u-3
SNR_start = -10;
SNR_end = 2;
vec_SNR = SNR_start : 2 : SNR_end;
N_loop = 40;
Proba_fail = zeros(1,length(vec_SNR));
mat_bn = zeros(4,128); % mat_bn contains the 4 possible Hadamard sequences defined in the standard
mat_bn(1,:) = ones(1,128);
mat_bn(2,:) = [1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 ...
1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 ...
-1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 ...
1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 ...
1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1];
mat_bn(3,:) = [1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 ...
-1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 ...
1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 ...
1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 ...
-1 1 1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 ...
-1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1];
mat_bn(4,:) = [1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 ...
-1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 ...
-1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 ...
1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 ...
-1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 ...
1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 ...
1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 -1];
mat_bn = [mat_bn,mat_bn(:,1:4)]; % see the definition of m in stadard
mat_theta_f = zeros(4,132); % mat_bn contains the 4 possible phase sequences defined in the standard
mat_theta_f(1,:) = ones(1,132);
mat_theta_f(2,:) = repmat([1,-j,-1,j],1,33);
mat_theta_f(3,:) = repmat([1,-1],1,66);
mat_theta_f(4,:) = repmat([1,j,-1,-j],1,33);
mat_16_theta = round(kron(mat_theta_f,ones(4,1))); % mat_bn contains the 4x4=16 possible pseudo-random sequences
mat_16_bn = repmat(mat_bn,4,1);
mat_16 = mat_16_theta.*mat_16_bn;
corresponding_values = zeros(16,2); % first column for q, second for theta_f
corresponding_values(:,1) = repmat([0;1;2;3],4,1); % mapping column to q
corresponding_values(:,2) = kron([0;1;2;3],ones(4,1)); % mapping column to theta_f
for k = 1 : length(vec_SNR) % loop on the SNR
N_fail = 0;
for loop = 1 : N_loop
SNR = vec_SNR(k);
frame_number = 2*randi([0,3],1);
cellID = randi([0,503],1);
% function NSSS_subframe = nsss_gen(frame_number,cellID)
theta_f = 33/132*mod(frame_number/2,4); % as defined in stadard
u = mod(cellID,126) + 3; % root of ZC sequence, defined in standard
q = floor(cellID/126);
size_RB = 12; % number of sub-carrier per RB
N_ZC = 131;
L_sub_frame = 14; % number of OFDM symbols per subframe
j = 1i;
vec_n = 0:N_ZC;
vec_n1 = mod(vec_n,131);
vec_bq = mat_bn(q+1,:);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Creation of the signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ZC sequence in frequency domain
ZC_sequence = exp(-j*pi*u*vec_n1.*(vec_n1+1)/N_ZC);
had_sequence = exp(-j*2*pi*theta_f*vec_n);
vec_bq_had = vec_bq.*had_sequence;
P_noise = 10^(-SNR/10); % SNR in dB to noise power
noise = sqrt(P_noise/2)*randn(1,132)+sqrt(P_noise/2)*j*randn(1,132);
vec_d = vec_bq.*had_sequence.*ZC_sequence + noise;
mat_NSSS = flipud(reshape(vec_d,size_RB,L_sub_frame-3));
NSSS_subframe = [zeros(size_RB,3),mat_NSSS];
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Exhaustive cell ID research
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sequence_r = repmat(vec_d,16,1).*conj(mat_16); % this remove the phase component
vec_u = 3 : 128;
mat_u = repmat(vec_u.',1,length(vec_n1));
mat_n1 = repmat(vec_n1,126,1);
sequence_ZC = exp(-j*pi*mat_u.*mat_n1.*(mat_n1+1)/N_ZC);
matrix_max_correl = zeros(126,16); % this will be filled by the maximum of correlation value
for s_ = 1 : 16
seq_ref = sequence_r(s_,:);
for u_ = 1 : 126
correl = xcorr(seq_ref,sequence_ZC(u_,:));
[val_max,ind_max] = max(abs(correl));
matrix_max_correl(u_,s_) = val_max;
end
end
max_correl = max(max(matrix_max_correl)); % get the max of all correlation values
index_max = find(matrix_max_correl==max_correl);
estim_u_ = mod(index_max,126)-1;
index_column = (index_max-mod(index_max,126))/126+1;
estim_q_ = corresponding_values(index_column);
estim_cell_ID = q*126 + estim_u_;
if cellID ~= estim_cell_ID
N_fail = N_fail + 1;
end
end
Proba_fail(k) = N_fail/N_loop;
end
plot(vec_SNR,Proba_fail)

View File

@@ -0,0 +1,217 @@
/***********************************************************************
**********************************************************************/
/*! \file PHY/LTE_TRANSPORT/pilots_NB_IoT.c
* \Generation of Reference signal (RS) for NB-IoT, TS 36-211, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB_NB_IoT,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 0..9
unsigned short RB_ID, // RB reserved for NB-IoT
unsigned short With_NSSS) // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
{
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB_NB_IoT->frame_parms;
uint16_t subframe = Ntti;
uint32_t tti_offset,slot_offset,Nsymb,samples_per_symbol; // tti,
uint8_t first_pilot,second_pilot;
unsigned short RB_IoT_ID = RB_ID;
Nsymb = 14;
first_pilot = 5; // first pilot position
second_pilot = 6; // second pilot position
slot_offset = (Ntti*2)%20;
if(subframe !=5 && ((With_NSSS*subframe)!= 9) ) // condition to avoid NPSS and NSSS signals
{
tti_offset = subframe*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0
samples_per_symbol = frame_parms->ofdm_symbol_size; // ex. 512
//Generate Pilots for slot 0 and 1
//antenna 0 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,
&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits
amp,
slot_offset,
0,
0,
RB_IoT_ID);
//antenna 0 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
amp,
slot_offset,
1,
0,
RB_IoT_ID);
//antenna 0 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
1+slot_offset,
0,
0,
RB_IoT_ID);
//antenna 0 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
1+slot_offset,
1,
0,
RB_IoT_ID);
if (frame_parms->nb_antennas_tx > 1) { // Pilots generation with two antennas
// antenna 1 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
amp,
slot_offset,
0,
1,
RB_IoT_ID);
// antenna 1 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
amp,
slot_offset,
1,
1,
RB_IoT_ID);
//antenna 1 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
1+slot_offset,
0,
1,
RB_IoT_ID);
// antenna 1 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB_NB_IoT,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
1+slot_offset,
1,
1,
RB_IoT_ID);
}
}
}
//////////////////////////////////////////////////////
/*
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
unsigned short RB_IoT_ID, // RB reserved for NB-IoT
unsigned short With_NSSS) // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
{
NB_IoT_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms_NB_IoT;
uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
uint8_t first_pilot,second_pilot;
Nsymb = 14;
first_pilot = 5; // first pilot position
second_pilot = 6; // second pilot position
for (tti=0; tti<Ntti; tti++) { // loop on sub-frames
tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb; // begins with 0
samples_per_symbol = frame_parms->ofdm_symbol_size; // ex. 512
slot_offset = (tti*2)%20; // 0, 2, 4, ....... 18
if((slot_offset != 10) && ((With_NSSS*slot_offset) != 18)) { // condition to avoid NPSS and NSSS signals
//Generate Pilots for slot 0 and 1
//antenna 0 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits
amp,
RB_IoT_ID,
slot_offset,
0, //p
0);
//antenna 0 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
1,
0);
//antenna 0 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
0,
0);
//antenna 0 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
1,
0);
if (frame_parms->nb_antennas_tx > 1) { // Pilots generation with two antennas
// antenna 1 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
0,
1);
// antenna 1 symbol 6 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
slot_offset,
1,
1);
//antenna 1 symbol 5 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (first_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
0,
1);
// antenna 1 symbol 6 slot 1
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[1][tti_offset + (7*samples_per_symbol) + (second_pilot*samples_per_symbol)],
amp,
RB_IoT_ID,
1+slot_offset,
1,
1);
}
}
}
}
*/

View File

@@ -0,0 +1,709 @@
/*
* 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/LTE_TRANSPORT/proto.h
* \brief Function prototypes for PHY physical/transport channel processing and generation V8.6 2009-03
* \author R. Knopp, F. Kaltenberger
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __LTE_TRANSPORT_PROTO_NB_IOT__H__
#define __LTE_TRANSPORT_PROTO_NB_IOT__H__
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
//#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
//#include <math.h>
//NPSS
void free_eNB_dlsch_NB_IoT(NB_IoT_eNB_NDLSCH_t *dlsch);
void free_eNB_dlcch_NB_IoT(NB_IoT_eNB_NPDCCH_t *dlcch);
void init_unscrambling_lut_NB_IoT(void);
int generate_npss_NB_IoT(int32_t **txdataF,
short amp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
unsigned short slot_offset,
unsigned short RB_IoT_ID); // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
//NSSS
int generate_sss_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint16_t symbol_offset, // symbol_offset = 3 for NB-IoT
uint16_t slot_offset,
unsigned short frame_number, // new attribute (Get value from higher layer), it does not exist for LTE
unsigned short RB_IoT_ID); // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
//*****************Vincent part for Cell ID estimation from NSSS ******************//
int rx_nsss_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int32_t *tot_metric);
int nsss_extract_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **nsss_ext,
int l);
//NRS
void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB_NB_IoT,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti, // Ntti = 10
unsigned short RB_IoT_ID, // RB reserved for NB-IoT
unsigned short With_NSSS); // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
//NPBCH
int allocate_npbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
unsigned short id_offset,
uint32_t *re_allocated);
// NPDSCH
int allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
unsigned short id_offset,
uint8_t pilot_shift,
uint32_t *re_allocated);
int generate_NDLSCH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_eNB_NDLSCH_t *RAR,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t release_v13_5_0);
int generate_NPDCCH_NB_IoT(NB_IoT_eNB_NPDCCH_t *DCI_1,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID);
int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t release_v13_5_0);
int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID,
uint8_t operation_mode,
uint8_t release_v13_5_0);
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID,
uint8_t release_v13_5_0);
void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length);
void dlsch_scrambling_Gen_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NDLSCH_t *dlsch,
int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns,
uint32_t rnti,
uint8_t release_v13_5_0,
uint8_t SIB);
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(uint8_t length, LTE_DL_FRAME_PARMS* frame_parms);
NB_IoT_eNB_NPDCCH_t *new_eNB_dlcch_NB_IoT(LTE_DL_FRAME_PARMS* frame_parms);
/*void dlsch_scrambling_Gen_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NDLSCH_t *dlsch,
int tot_bits, // total number of bits to transmit
uint16_t Nf, // Nf is the frame number (0..9)
uint8_t Ns,
uint32_t rnti, /// for SIB1 the SI_RNTI should be get from the DL request
uint8_t type);*/
/*
int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
int l,
uint32_t symbol_offset,
uint8_t pilots,
unsigned short id_offset,
uint8_t *reset,
uint32_t *x1,
uint32_t *x2,
uint32_t *s);
*/
// Functions below implement 36-211 and 36-212
/*Function to pack the DCI*/
// newly added function for NB-IoT , does not exist for LTE
void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,
void *pdu,
rnti_t rnti,
unsigned char dci_size_bytes,
unsigned char aggregation,
unsigned char dci_size_bits,
unsigned char dci_fmt,
uint8_t npdcch_start_symbol);
/*Use the UL DCI Information to configure PHY and also Pack the DCI*/
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
NB_IoT_eNB_NPDCCH_t *ndlcch,
uint8_t aggregation,
uint8_t npdcch_start_symbol,
uint8_t ncce_index);
/*Use the DL DCI Information to configure PHY and also Pack the DCI*/
int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
NB_IoT_eNB_NPDCCH_t *ndlcch,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t npdcch_start_symbol,
uint8_t ncce_index);
/*Function for DCI encoding, scrambling, modulation*/
uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
uint8_t Num_dci,
DCI_ALLOC_NB_IoT_t *dci_alloc,
int16_t amp,
NB_IoT_DL_FRAME_PARMS *fp,
int32_t **txdataF,
uint32_t subframe,
uint8_t npdcch_start_symbol);
/*!
\brief Decoding of PUSCH/ACK/RI/ACK from 36-212.
@param phy_vars_eNB Pointer to eNB top-level descriptor
@param proc Pointer to RXTX proc variables
@param UE_id ID of UE transmitting this PUSCH
@param subframe Index of subframe for PUSCH
@param control_only_flag Receive PUSCH with control information only
@param Nbundled Nbundled parameter for ACK/NAK scrambling from 36-212/36-213
@param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
@returns 0 on success
*/
/*unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag);
*/
// NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t abstraction_flag);
int ulsch_decoding_data_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int UE_id,
int harq_pid,
int llr8_flag);
uint8_t subframe2harq_pid_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe);
/** \brief Compute Q (modulation order) based on I_MCS for PUSCH. Implements table 8.6.1-1 from 36.213.
@param I_MCS */
//uint8_t get_Qm_ul_NB_IoT(uint8_t I_MCS);
/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe)
\brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
- CRC computation and addition
- Code block segmentation and sub-block CRC addition
- Channel coding (Turbo coding)
- Rate matching (sub-block interleaving, bit collection, selection and transmission
- Code block concatenation
@param eNB Pointer to eNB PHY context
@param input_buffer Pointer to input buffer for sub-frame
@param frame_parms Pointer to frame descriptor structure
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch Pointer to dlsch to be encoded
@param frame Frame number
@param subframe Subframe number
@param rm_stats Time statistics for rate-matching
@param te_stats Time statistics for turbo-encoding
@param i_stats Time statistics for interleaving
@returns status
*/
int dci_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size,
NB_IoT_eNB_NPDCCH_t *dlcch,
unsigned int npdsch_data_subframe,
uint8_t agr_level,
uint8_t ncce_index,
unsigned int subframe,
unsigned short NB_IoT_RB_ID);
int dci_allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
uint8_t pilot_shift,
int16_t amp,
unsigned short id_offset,
uint8_t ncce_index,
uint8_t agr_level,
uint32_t *re_allocated);
void dci_encoding_NB_IoT(uint8_t *a,
NB_IoT_eNB_NPDCCH_t *dlcch,
uint8_t A,
uint16_t G,
uint8_t ncce_index,
uint8_t agr_level);
void npdcch_scrambling_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
NB_IoT_eNB_NPDCCH_t *dlcch, // Input data
int G, // Total number of bits to transmit in one subframe(case of DCI = G)
uint8_t Ns, //XXX we pass the subframe // Slot number (0..19)
uint8_t ncce_index,
uint8_t agr_level);
int dlsch_modulation_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_eNB_NDLSCH_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned int subframe,
unsigned short NB_IoT_RB_ID);
/*
int dlsch_modulation_rar_NB_IoT(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t control_region_size, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
NB_IoT_DL_eNB_HARQ_t *dlsch0, //NB_IoT_eNB_NDLSCH_t
int G, // number of bits per subframe
unsigned int npdsch_data_subframe, // subframe index of the data table of npdsch channel (G*Nsf) , values are between 0..Nsf
unsigned int subframe,
unsigned short NB_IoT_RB_ID,
uint8_t option);
*/
int32_t dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_NDLSCH_t *dlsch, // NB_IoT_eNB_NDLSCH_t
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G); // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
void get_pilots_position(uint8_t npusch_format,uint8_t subcarrier_spacing,uint8_t *pilot_pos1,uint8_t *pilot_pos2,uint8_t *pilots_slot);
void UL_channel_estimation_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *fp,
uint16_t UL_RB_ID_NB_IoT,
uint16_t Nsc_RU,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint16_t ul_sc_start,
uint8_t Qm,
uint16_t N_SF_per_word,
uint8_t rx_subframe);
void get_llr_per_sf_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *fp,
uint8_t npusch_format,
uint8_t counter_sf,
uint16_t N_SF_per_word,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint16_t ul_sc_start,
uint16_t Nsc_RU);
void descrambling_NPUSCH_data_NB_IoT(LTE_DL_FRAME_PARMS *fp,
int16_t *ulsch_llr,
int16_t *y,
uint8_t Qm,
unsigned int Cmux,
uint32_t rnti_tmp,
uint8_t rx_subframe,
uint32_t rx_frame);
void descrambling_NPUSCH_ack_NB_IoT(LTE_DL_FRAME_PARMS *fp,
int32_t *y_msg5,
int32_t *llr_msg5,
uint32_t rnti_tmp,
uint16_t *counter_ack,
uint8_t rx_subframe,
uint32_t rx_frame);
uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t npusch_format,
unsigned int G,
uint8_t rvdx,
uint8_t Qm,
uint32_t rx_frame,
uint8_t rx_subframe);
void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *fp,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t npusch_format,
uint16_t N_SF_per_word,
uint16_t Nsc_RU,
uint16_t N_UL_slots,
uint8_t Qm,
uint8_t pilots_slot,
uint32_t rnti_tmp,
uint8_t rx_subframe,
uint32_t rx_frame);
void deinterleaving_NPUSCH_data_NB_IoT(NB_IoT_UL_eNB_HARQ_t *ulsch_harq, int16_t *y, unsigned int G);
uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id,
uint16_t UL_RB_ID_NB_IoT, // 22 , to be included in // to be replaced by NB_IoT_start ??
uint8_t subframe,
uint32_t frame);
void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
int32_t **rxdataF_ext,
uint16_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block !!! may be defined twice : in frame_parms and in NB_IoT_UL_eNB_HARQ_t
uint16_t N_sc_RU, // number of subcarriers in UL
uint8_t l,
uint8_t Ns,
LTE_DL_FRAME_PARMS *frame_parms);
void ulsch_channel_level_NB_IoT(int32_t **drs_ch_estimates_ext,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t *avg,
uint16_t nb_rb);
void ulsch_channel_compensation_NB_IoT(int32_t **rxdataF_ext,
int32_t **ul_ch_estimates_ext,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
int32_t **rxdataF_comp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t symbol,
uint8_t Qm,
uint16_t nb_rb,
uint8_t output_shift);
void lte_idft_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH);
void extract_CQI_NB_IoT(void *o,UCI_format_NB_IoT_t uci_format,NB_IoT_eNB_UE_stats *stats,uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode);
//*****************Vincent part for nprach ******************//
uint32_t process_nprach_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int frame, uint8_t subframe,uint16_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance);
uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
int16_t *Rx_sub_sampled_buffer,
uint16_t sub_sampling_rate,
uint16_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
uint32_t estimated_TA_coarse,
uint8_t coarse);
uint8_t NPRACH_detection_NB_IoT(int16_t *input_buffer,uint32_t FRAME_LENGTH_COMPLEX_SAMPLESx);
int16_t* sub_sampling_NB_IoT(int16_t *input_buffer, uint32_t length_input, uint32_t *length_ouput, uint16_t sub_sampling_rate);
void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t FRAME_LENGTH_COMPLEX_SAMPLESx);
//************************************************************//
///////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//uint8_t get_UL_I_TBS_from_MCS_NB_IoT(uint8_t I_mcs, uint8_t N_sc_RU, uint8_t Msg3_flag);
uint8_t get_Qm_UL_NB_IoT(unsigned char I_mcs, uint8_t N_sc_RU, uint8_t I_sc, uint8_t Msg3_flag);
//uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc);
uint16_t get_UL_sc_ACK_NB_IoT(uint8_t subcarrier_spacing,uint16_t harq_ack_resource);
uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, uint8_t npush_format);
uint16_t get_UL_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3);
uint16_t get_UL_N_rep_NB_IoT(uint8_t I_rep);
uint8_t get_numb_UL_sc_NB_IoT(uint8_t subcarrier_spacing, uint8_t I_sc, uint8_t npush_format);
uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrier_indcation, uint8_t UL_format);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
void generate_grouphop_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms);
void init_ul_hopping_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
void rotate_single_carrier_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint8_t eNB_id,
uint8_t symbol, //symbol within subframe
uint8_t counter_msg3, /// to be replaced by the number of received part
uint16_t ul_sc_start,
uint8_t Qm,
uint16_t N_SF_per_word,
uint8_t option);
void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint16_t ul_sc_start,
uint8_t UE_id,
uint8_t symbol);
int32_t ulsch_bpsk_llr_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *ulsch_llr,
uint8_t symbol,
uint16_t ul_sc_start,
uint8_t UE_id,
int16_t **llrp);
int32_t ulsch_qpsk_llr_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *ulsch_llr,
uint8_t symbol,
uint8_t UE_id,
uint16_t ul_sc_start,
uint8_t Nsc_RU,
int16_t *llrp);
void rotate_bpsk_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint16_t ul_sc_start,
uint8_t UE_id,
uint8_t symbol);
//************************************************************//
int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
PDSCH_t type,
unsigned char eNB_id,
unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
uint32_t frame,
uint8_t subframe,
unsigned char symbol,
unsigned char first_symbol_flag,
unsigned char i_mod,
unsigned char harq_pid);
unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
int **dl_ch_estimates,
int **rxdataF_ext,
int **dl_ch_estimates_ext,
unsigned short pmi,
unsigned char *pmi_ext,
unsigned int *rb_alloc,
unsigned char symbol,
unsigned char subframe,
uint32_t frame,
uint32_t high_speed_flag,
NB_IoT_DL_FRAME_PARMS *frame_parms);
void dlsch_channel_level_NB_IoT(int **dl_ch_estimates_ext,
NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t *avg,
uint8_t symbol,
unsigned short nb_rb);
void dlsch_channel_compensation_NB_IoT(int **rxdataF_ext,
int **dl_ch_estimates_ext,
int **dl_ch_mag,
int **dl_ch_magb,
int **rxdataF_comp,
int **rho,
NB_IoT_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
uint8_t first_symbol_flag,
unsigned char mod_order,
unsigned short nb_rb,
unsigned char output_shift,
PHY_MEASUREMENTS_NB_IoT *measurements);
int dlsch_qpsk_llr_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *dlsch_llr,
uint8_t symbol,
uint8_t first_symbol_flag,
uint16_t nb_rb,
int16_t **llr32p,
uint8_t beamforming_mode);
/// Vincent: temporary functions
int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
int32_t **ul_ch_estimates,
uint8_t l, //symbol within slot
uint8_t Ns,
uint8_t counter_msg3,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint16_t ul_sc_start,
uint8_t Qm,
uint16_t N_SF_per_word,
LTE_DL_FRAME_PARMS *frame_parms);
/// Channel estimation for NPUSCH format 2
int ul_chest_tmp_f2_NB_IoT(int32_t **rxdataF_ext,
int32_t **ul_ch_estimates,
uint8_t l, //symbol within slot
uint8_t Ns,
uint8_t counter_msg3,
uint8_t flag,
uint8_t subframerx,
uint8_t Qm,
uint16_t ul_sc_start,
LTE_DL_FRAME_PARMS *frame_parms);
void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
uint8_t l,
uint8_t Qm,
uint8_t counter_msg3,
uint16_t N_SF_per_word,
uint16_t ul_sc_start,
uint8_t flag);
int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext,
int32_t **rxdataF_comp,
int32_t **ul_ch_estimates,
uint8_t l, //symbol within slot
uint8_t Ns,
LTE_DL_FRAME_PARMS *frame_parms);
///
////////////////////////////NB-IoT testing ///////////////////////////////
void clean_eNb_ulsch_NB_IoT(NB_IoT_eNB_NULSCH_t *ulsch);
int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms);
int get_G_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, uint8_t operation_mode_info);
int get_rep_num_SIB1_NB_IoT(uint8_t scheduling_info_sib1);
int get_start_frame_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint8_t repetition);
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
#endif

View File

@@ -0,0 +1,62 @@
/*
* 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.0 (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/LTE_TRANSPORT/sc_rotation_NB_IoT.c
* \brief Some support routines for MCS computations
* \author V. SAVAUX, M. KANJ
* \date 2017
* \version 0.1
* \company b<>com
* \email:
* \note
* \warning
*/
#ifndef __PHY_LTE_TRANSPORT_SC_ROTATION_NB_IOT__H__
#define __PHY_LTE_TRANSPORT_SC_ROTATION_NB_IOT__H__
int16_t e_phi_re_p5[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621};
int16_t e_phi_im_p5[120] = {0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009};
int16_t e_phi_re_m6[120] = {32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621};
int16_t e_phi_im_m6[120] = {0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, 0, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, -1, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010, -1, 21402, 32412, 27683, 9511, -13279, -29622, -32767, -24812, -4808, 17530, 31356, 29955, 14009, 0, -21403, -32413, -27684, -9512, 13278, 29621, 32767, 24811, 4807, -17531, -31357, -29956, -14010};
int16_t e_phi_re_m5[120] = {32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519};
int16_t e_phi_im_m5[120] = {0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319};
int16_t e_phi_re_m4[120] = {32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, 0, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, -1, -32758, 1607, 32678, -3212, -32521, 4807};
int16_t e_phi_im_m4[120] = {0, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, -1, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413};
int16_t e_phi_re_m3[120] = {32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, 0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, -1, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039};
int16_t e_phi_im_m3[120] = {0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, -1, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, -1, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, 0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, -1, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852};
int16_t e_phi_re_m2[120] = {32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, -1, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279};
int16_t e_phi_im_m2[120] = {0, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, -1, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, 0, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005};
int16_t e_phi_re_m1[120] = {32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, 0, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, -1, 7179, -14010, 20159, -25330, 29268, -31786};
int16_t e_phi_im_m1[120] = {0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, 0, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962};
int16_t e_phi_re_0[120] = {32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, 0, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, -1, 7179, -14010, 20159, -25330, 29268, -31786};
int16_t e_phi_im_0[120] = {0, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, 0, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961, -1, -7180, 14009, -20160, 25329, -29269, 31785, -32767, 31970, -29622, 25831, -20788, 14732, -7962, -1, 7179, -14010, 20159, -25330, 29268, -31786, 32767, -31971, 29621, -25832, 20787, -14733, 7961};
int16_t e_phi_re_p1[120] = {32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, -1, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279};
int16_t e_phi_im_p1[120] = {0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, 0, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, -1, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004, 0, -20160, 31785, -29956, 15446, 5601, -24279, 32767, -25832, 7961, 13278, -28898, 32284, -22005, -1, 20159, -31786, 29955, -15447, -5602, 24278, -32767, 25831, -7962, -13279, 28897, -32285, 22004};
int16_t e_phi_re_p2[120] = {32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, 0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, -1, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039};
int16_t e_phi_im_p2[120] = {0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, 0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, 0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, -1, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, 0, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851, 0, -29269, 26318, 5601, -31357, 22594, 11038, -32767, 14732, 19519, -32285, 9511, 23731, -30852, -1, 29268, -26319, -5602, 31356, -22595, -11039, 32767, -14733, -19520, 32284, -9512, -23732, 30851};
int16_t e_phi_re_p3[120] = {32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, 0, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, -1, -32758, 1607, 32678, -3212, -32521, 4807};
int16_t e_phi_im_p3[120] = {0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, -1, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412, 0, -32758, 1607, 32678, -3212, -32521, 4807, 32767, -805, -32728, 2410, 32609, -4012, -32413, 0, 32757, -1608, -32679, 3211, 32520, -4808, -32767, 804, 32727, -2411, -32610, 4011, 32412};
int16_t e_phi_re_p4[120] = {32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519};
int16_t e_phi_im_p4[120] = {0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, -1, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, 0, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318, 0, -29956, -24279, 10278, 32609, 16150, -19520, -32767, -13279, 22004, 31113, 3211, -28511, -26319, -1, 29955, 24278, -10279, -32610, -16151, 19519, 32767, 13278, -22005, -31114, -3212, 28510, 26318};
#endif

File diff suppressed because one or more lines are too long

View File

@@ -321,4 +321,4 @@ HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT;
#define MAX_ACK_PAYLOAD_NB_IoT 18
#define MAX_RI_PAYLOAD_NB_IoT 6
#endif
#endif

View File

@@ -0,0 +1,431 @@
/*
* 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.0 (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/LTE_TRANSPORT/phich.c
* \brief Routines for generation of and computations regarding the uplink control information (UCI) for PUSCH. V8.6 2009-03
* \author R. Knopp, F. Kaltenberger, A. Bhamri
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, ankit.bhamri@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/extern_NB_IoT.h"
#ifdef DEBUG_UCI_TOOLS
#include "PHY/vars_NB_IoT.h"
#endif
void do_diff_cqi_NB_IoT(uint8_t N_RB_DL,
uint8_t *DL_subband_cqi,
uint8_t DL_cqi,
uint32_t diffcqi1)
{
uint8_t nb_sb,i,offset;
// This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb)
switch (N_RB_DL) {
case 6:
nb_sb=1;
break;
case 15:
nb_sb = 4;
break;
case 25:
nb_sb = 7;
break;
case 50:
nb_sb = 9;
break;
case 75:
nb_sb = 10;
break;
case 100:
nb_sb = 13;
break;
default:
nb_sb=0;
break;
}
memset(DL_subband_cqi,0,13);
for (i=0; i<nb_sb; i++) {
offset = (diffcqi1>>(2*i))&3;
if (offset == 3)
DL_subband_cqi[i] = DL_cqi - 1;
else
DL_subband_cqi[i] = DL_cqi + offset;
}
}
void extract_CQI_NB_IoT(void *o,UCI_format_NB_IoT_t uci_format,NB_IoT_eNB_UE_stats *stats, uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode)
{
uint8_t i;
LOG_D(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format);
switch(N_RB_DL) {
case 6:
switch(uci_format) {
case wideband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_1_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_1_5MHz_NB_IoT *)o)->pmi;
break;
case wideband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_1_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_1_5MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_1_5MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_nopmi_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_1_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_1_5MHz_NB_IoT *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1));
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_mcs_CBA_NB_IoT:
if ((*crnti == ((HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT *)o)->crnti) && (*crnti !=0)) {
*access_mode=CBA_ACCESS;
LOG_N(PHY,"[eNB] UCI for CBA : mcs %d crnti %x\n",
((HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT *)o)->crnti);
} else {
LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
*crnti, ((HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT *)o)->crnti);
}
break;
case unknown_cqi:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
break;
}
break;
case 25:
switch(uci_format) {
case wideband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz_NB_IoT *)o)->pmi;
break;
case wideband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_5MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_5MHz_NB_IoT *)o)->pmi;
//this translates the 2-layer PMI into a single layer PMI for the first codeword
//the PMI for the second codeword will be stats->DL_pmi_single^0x1555
stats->DL_pmi_single = 0;
for (i=0;i<7;i++)
stats->DL_pmi_single = stats->DL_pmi_single | (((stats->DL_pmi_dual&(1<i))>>i)*2)<<2*i;
break;
case HLC_subband_cqi_nopmi_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz_NB_IoT *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz_NB_IoT *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_5MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_5MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz_NB_IoT *)o)->diffcqi1));
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz_NB_IoT *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_5MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_mcs_CBA_NB_IoT:
if ((*crnti == ((HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT *)o)->crnti) && (*crnti !=0)) {
*access_mode=CBA_ACCESS;
LOG_N(PHY,"[eNB] UCI for CBA : mcs %d crnti %x\n",
((HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT *)o)->crnti);
} else {
LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
*crnti, ((HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT *)o)->crnti);
}
break;
case unknown_cqi_NB_IoT:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
break;
}
break;
case 50:
switch(uci_format) {
case wideband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_10MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_10MHz_NB_IoT *)o)->pmi;
break;
case wideband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_10MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_10MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_10MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_nopmi_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_10MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_10MHz_NB_IoT *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_10MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_10MHz_NB_IoT *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_10MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_10MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_10MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_10MHz_NB_IoT *)o)->diffcqi1));
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_10MHz_NB_IoT *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_10MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_mcs_CBA_NB_IoT:
if ((*crnti == ((HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT *)o)->crnti) && (*crnti !=0)) {
*access_mode=CBA_ACCESS;
LOG_N(PHY,"[eNB] UCI for CBA : mcs %d crnti %x\n",
((HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT *)o)->crnti);
} else {
LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
*crnti, ((HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT *)o)->crnti);
}
break;
case unknown_cqi_NB_IoT:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
break;
}
break;
case 100:
switch(uci_format) {
case wideband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_20MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_20MHz_NB_IoT *)o)->pmi;
break;
case wideband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_20MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_20MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_20MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_nopmi_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_20MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_20MHz_NB_IoT *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_20MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_20MHz_NB_IoT *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_20MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A_NB_IoT:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_20MHz_NB_IoT *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_20MHz_NB_IoT *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_20MHz_NB_IoT *)o)->diffcqi1));
do_diff_cqi_NB_IoT(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_20MHz_NB_IoT *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_20MHz_NB_IoT *)o)->pmi;
break;
case HLC_subband_cqi_mcs_CBA_NB_IoT:
if ((*crnti == ((HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT *)o)->crnti) && (*crnti !=0)) {
*access_mode=CBA_ACCESS;
LOG_N(PHY,"[eNB] UCI for CBA : mcs %d crnti %x\n",
((HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT *)o)->mcs, ((HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT *)o)->crnti);
} else {
LOG_D(PHY,"[eNB] UCI for CBA : rnti (enb context %x, rx uci %x) invalid, unknown access\n",
*crnti, ((HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT *)o)->crnti);
}
break;
case unknown_cqi_NB_IoT:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
break;
}
break;
default:
LOG_N(PHY,"[eNB][UCI] unknown RB %d\n",N_RB_DL);
break;
}
}

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,37 @@
/*
* 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.0 (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
*/
//#include "dlsch_tbs.h"
//#include "dlsch_tbs_full.h"
//#include "sss.h"
#ifndef __PHY_LTE_TRANSPORT_VARS_NB_IOT__H__
#define __PHY_LTE_TRANSPORT_VARS_NB_IOT__H__
unsigned char cs_ri_normal_NB_IoT[4] = {1,4,7,10};
unsigned char cs_ri_extended_NB_IoT[4] = {0,3,5,8};
unsigned char cs_ack_normal_NB_IoT[4] = {2,3,8,9};
unsigned char cs_ack_extended_NB_IoT[4] = {1,2,6,7};
int G_tab[18] = {200,224,240,208,232,256,220,244,268,216,240,256,224,248,264,236,260,284};
int8_t wACK_RX_NB_IoT[5][4] = {{-1,-1,-1,-1},{-1,1,-1,1},{-1,-1,1,1},{-1,1,1,-1},{1,1,1,1}};
#endif

View File

@@ -0,0 +1,117 @@
/*
* 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.0 (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
*/
#include <stdio.h>
#include "time_meas_NB_IoT.h"
#include <math.h>
#include <unistd.h>
// global var for openair performance profiler
int opp_enabled = 0;
double get_cpu_freq_GHz(void) {
time_stats_t ts = {0};
reset_meas(&ts);
ts.trials++;
ts.in = rdtsc_oai();
sleep(1);
ts.diff = (rdtsc_oai()-ts.in);
cpu_freq_GHz = (double)ts.diff/1000000000;
printf("CPU Freq is %f \n", cpu_freq_GHz);
return cpu_freq_GHz;
}
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
if (opp_enabled) {
//static double cpu_freq_GHz = 3.2;
//if (cpu_freq_GHz == 0.0)
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
if (ts->trials>0) {
//fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->diff_now/(cpu_freq_GHz*1000000.0)),subframe,ts->diff_now);
fprintf(file_name,"%15.3f ms, diff_now %15.3f \n",(ts->diff_now/(cpu_freq_GHz*1000000.0)),(double)ts->diff_now);
}
}
}
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time)
{
if (opp_enabled) {
static int first_time = 0;
static double cpu_freq_GHz = 0.0;
if (cpu_freq_GHz == 0.0)
cpu_freq_GHz = get_cpu_freq_GHz();
if (first_time == 0) {
first_time=1;
if ((total_exec_time == NULL) || (sf_exec_time== NULL))
fprintf(stderr, "%25s %25s %25s %25s %25s %6f\n","Name","Total","Per Trials", "Num Trials","CPU_F_GHz", cpu_freq_GHz);
else
fprintf(stderr, "%25s %25s %25s %20s %15s %6f\n","Name","Total","Average/Frame","Trials", "CPU_F_GHz", cpu_freq_GHz);
}
if (ts->trials>0) {
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
if ((total_exec_time == NULL) || (sf_exec_time== NULL)) {
fprintf(stderr, "%25s: %15.3f ms ; %15.3f us; %15d;\n",
name,
(ts->diff/cpu_freq_GHz/1000000.0),
(ts->diff/ts->trials/cpu_freq_GHz/1000.0),
ts->trials);
} else {
fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n",
name,
(ts->diff/cpu_freq_GHz/1000000.0),
((ts->diff/cpu_freq_GHz/1000000.0)/(total_exec_time->diff/cpu_freq_GHz/1000000.0))*100, // percentage
(ts->diff/ts->trials/cpu_freq_GHz/1000.0),
((ts->diff/ts->trials/cpu_freq_GHz/1000.0)/(sf_exec_time->diff/sf_exec_time->trials/cpu_freq_GHz/1000.0))*100, // percentage
ts->trials);
}
}
}
}
double get_time_meas_us(time_stats_t *ts)
{
static double cpu_freq_GHz = 0.0;
if (cpu_freq_GHz == 0.0)
cpu_freq_GHz = get_cpu_freq_GHz();
if (ts->trials>0)
return (ts->diff/ts->trials/cpu_freq_GHz/1000.0);
return 0;
}

View File

@@ -0,0 +1,158 @@
/*
* 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.0 (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
*/
#ifndef __TIME_MEAS_DEFS_NB_IoT__H__
#define __TIME_MEAS_DEFS_NB_IoT__H__
#include <unistd.h>
#include <math.h>
#include <stdint.h>
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <pthread.h>
#include <linux/kernel.h>
#include <linux/types.h>
// global var to enable openair performance profiler
extern int opp_enabled_NB_IoT;
double cpu_freq_GHz;
#if defined(__x86_64__) || defined(__i386__)
typedef struct {
long long in;
long long diff;
long long diff_now;
long long p_time; /*!< \brief absolute process duration */
long long diff_square; /*!< \brief process duration square */
long long max;
int trials;
int meas_flag;
} time_stats_t_NB_IoT;
#elif defined(__arm__)
typedef struct {
uint32_t in;
uint32_t diff_now;
uint32_t diff;
uint32_t p_time; /*!< \brief absolute process duration */
uint32_t diff_square; /*!< \brief process duration square */
uint32_t max;
int trials;
} time_stats_t_NB_IoT;
#endif
static inline void start_meas_NB_IoT(time_stats_t_NB_IoT *ts) __attribute__((always_inline));
static inline void stop_meas_NB_IoT(time_stats_t_NB_IoT *ts) __attribute__((always_inline));
/*
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name);
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time);
double get_time_meas_us(time_stats_t *ts);
double get_cpu_freq_GHz(void);
*/
#if defined(__i386__)
static inline unsigned long long rdtsc_oai_NB_IoT(void) __attribute__((always_inline));
static inline unsigned long long rdtsc_oai_NB_IoT(void)
{
unsigned long long int x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x;
}
#elif defined(__x86_64__)
static inline unsigned long long rdtsc_oai_NB_IoT(void) __attribute__((always_inline));
static inline unsigned long long rdtsc_oai_NB_IoT(void)
{
unsigned long long a, d;
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return (d<<32) | a;
}
#elif defined(__arm__)
static inline uint32_t rdtsc_oai_NB_IoT(void) __attribute__((always_inline));
static inline uint32_t rdtsc_oai_NB_IoT(void)
{
uint32_t r = 0;
asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(r) );
return r;
}
#endif
static inline void start_meas_NB_IoT(time_stats_t_NB_IoT *ts)
{
if (opp_enabled_NB_IoT) {
if (ts->meas_flag==0) {
ts->trials++;
ts->in = rdtsc_oai_NB_IoT();
ts->meas_flag=1;
}
else {
ts->in = rdtsc_oai_NB_IoT();
}
}
}
static inline void stop_meas_NB_IoT(time_stats_t_NB_IoT *ts)
{
if (opp_enabled_NB_IoT) {
long long out = rdtsc_oai_NB_IoT();
ts->diff_now = (out-ts->in);
ts->diff_now = (out-ts->in);
ts->diff += (out-ts->in);
/// process duration is the difference between two clock points
ts->p_time = (out-ts->in);
ts->diff_square += (out-ts->in)*(out-ts->in);
if ((out-ts->in) > ts->max)
ts->max = out-ts->in;
ts->meas_flag=0;
}
}
static inline void reset_meas_NB_IoT(time_stats_t_NB_IoT *ts) {
ts->trials=0;
ts->diff=0;
ts->diff_now=0;
ts->p_time=0;
ts->diff_square=0;
ts->max=0;
ts->meas_flag=0;
}
static inline void copy_meas_NB_IoT(time_stats_t_NB_IoT *dst_ts,time_stats_t_NB_IoT *src_ts)
{
if (opp_enabled_NB_IoT) {
dst_ts->trials=src_ts->trials;
dst_ts->diff=src_ts->diff;
dst_ts->max=src_ts->max;
}
}
#endif

View File

@@ -118,7 +118,7 @@ static inline void* malloc16_clear( size_t size )
// #define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
// /// suppress compiler warning for unused arguments
// #define UNUSED(x) (void)x;
#define UNUSED(x) (void)x;
#include "PHY/impl_defs_top_NB_IoT.h"
@@ -127,7 +127,9 @@ static inline void* malloc16_clear( size_t size )
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/TOOLS/time_meas.h"
#include "PHY/TOOLS/time_meas_NB_IoT.h"
//#include "PHY/CODING/defs.h"
#include "defs_common.h"
#include "PHY/CODING/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
//#include "PHY/TOOLS/defs.h"
@@ -137,7 +139,7 @@ static inline void* malloc16_clear( size_t size )
////////////////////////////////////////////////////////////////////#ifdef OPENAIR_LTE (check if this is required)
//#include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/defs_NB_IoT.h"
#include <pthread.h>
#include "targets/ARCH/COMMON/common_lib.h"
@@ -164,6 +166,7 @@ enum transmission_access_mode {
SCHEDULED_ACCESS,
CBA_ACCESS};
typedef enum {
eNodeB_3GPP=0, // classical eNodeB function
eNodeB_3GPP_BBU, // eNodeB with NGFI IF5
@@ -173,6 +176,7 @@ typedef enum {
NGFI_RRU_IF4p5 // NGFI_RRU (NGFI remote radio-unit,IF4p5)
} eNB_func_t;
typedef enum {
synch_to_ext_device=0, // synch to RF or Ethernet device
synch_to_other // synch to another source (timer, other CC_id)
@@ -254,6 +258,8 @@ typedef struct {
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
@@ -264,6 +270,9 @@ typedef struct {
int frame_tx;
/// frame to act upon for reception
int frame_rx;
uint16_t HFN;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
@@ -283,6 +292,24 @@ typedef struct {
pthread_mutex_t mutex_l2;
int instance_cnt_l2;
pthread_attr_t attr_l2;
uint32_t frame_msg5;
uint32_t subframe_msg5;
int subframe_real;
uint8_t flag_scrambling;
uint8_t flag_msg3;
uint8_t counter_msg3;
uint32_t frame_msg3;
uint8_t flag_msg4;
uint8_t counter_msg4;
uint32_t frame_msg4;
uint32_t subframe_msg4;
uint8_t counter_msg5;
uint8_t flag_msg5;
uint32_t frame_dscr_msg5;
uint32_t subframe_dscr_msg5;
uint32_t frame_dscr_msg3; //phy_procedures_lte_eNb_NB_IoT.c
uint32_t subframe_dscr_msg3; //phy_procedures_lte_eNb_NB_IoT.c
} eNB_rxtx_proc_NB_IoT_t;
/*
@@ -303,6 +330,8 @@ typedef struct {
/// Context data structure for eNB subframe processing
typedef struct eNB_proc_NB_IoT_t_s {
/// Component Carrier index
uint8_t CC_id;
/// thread index
int thread_index;
/// timestamp received from HW
@@ -341,6 +370,10 @@ typedef struct eNB_proc_NB_IoT_t_s {
int instance_cnt_asynch_rxtx;
/// pthread structure for FH processing thread
pthread_t pthread_FH;
/// pthread structure for eNB single processing thread
pthread_t pthread_single; //NB-IoT
/// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx;
/// flag to indicate first RX acquisition
@@ -448,6 +481,8 @@ typedef struct eNB_proc_NB_IoT_t_s {
typedef struct {
/// index of the current UE RX/TX proc
int proc_id;
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
@@ -482,6 +517,8 @@ typedef struct {
/// Context data structure for eNB subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// Last RX timestamp
openair0_timestamp timestamp_rx;
/// pthread attributes for main UE thread
@@ -514,14 +551,19 @@ typedef struct {
typedef struct PHY_VARS_eNB_NB_IoT_s {
/// Module ID indicator for this instance
module_id_t Mod_id;
uint8_t CC_id;
uint8_t configured;
eNB_proc_NB_IoT_t proc;
int num_RU;
RU_t *RU_list[MAX_NUM_RU_PER_eNB];
/// Ethernet parameters for northbound midhaul interface (L1 to Mac)
eth_params_t eth_params_n;
eth_params_t eth_params_n;
eNB_func_NB_IoT_t node_function;
eNB_timing_NB_IoT_t node_timing;
/// Ethernet parameters for fronthaul interface (upper L1 to Radio head)
eth_params_t eth_params;
eth_params_t *eth_params;
int single_thread_flag;
openair0_rf_map rf_map;
int abstraction_flag;
@@ -533,7 +575,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
// indicator for precoding function (eNB,3GPP_eNB_BBU)
int do_precoding;
IF_Module_NB_IoT_t *if_inst_NB_IoT;
UL_IND_NB_IoT_t UL_INFO_NB_IoT;
UL_IND_NB_IoT_t UL_INFO;
pthread_mutex_t UL_INFO_mutex;
void (*do_prach)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int frame,int subframe);
void (*fep)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
@@ -765,14 +807,20 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
NB_IoT_eNB_NPBCH_t *npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT];
NB_IoT_eNB_NDLSCH_t *ndlsch[NUMBER_OF_UE_MAX_NB_IoT][2];
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1]; //nulsch[0] contains the RAR
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT[NUMBER_OF_UE_MAX_NB_IoT+1]; //nulsch[0] contains the RAR
NB_IoT_eNB_NDLSCH_t *ndlsch_SI,*ndlsch_ra, *ndlsch_SIB1;
NB_IoT_DL_FRAME_PARMS frame_parms_NB_IoT;
// DCI for at most 2 DCI pdus
DCI_PDU_NB_IoT *DCI_pdu;
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB23,*dlsch_ra;
NB_IoT_eNB_NDLSCH_t *ndlsch_RAR;
NB_IoT_eNB_NPDCCH_t *npdcch_DCI;
uint8_t msg3_pdu[6]; //phy_procedures_lte_eNb_NB_IoT.c
volatile uint16_t preamble_index_NB_IoT; //phy_procedures_lte_eNb_NB_IoT.c
} PHY_VARS_eNB_NB_IoT;
@@ -782,6 +830,8 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
typedef struct {
/// \brief Module ID indicator for this instance
uint8_t Mod_id;
/// \brief Component carrier ID for this PHY instance
uint8_t CC_id;
/// \brief Mapping of CC_id antennas to cards
openair0_rf_map rf_map;
//uint8_t local_flag;
@@ -1033,5 +1083,5 @@ typedef struct {
#include "PHY/INIT/defs_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
#include "PHY/NBIoT_TRANSPORT/proto_NB_IoT.h"
#endif // __PHY_DEFS__H__

View File

@@ -3,7 +3,9 @@
* 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
*
@@ -29,6 +31,7 @@
\note
\warning
*/
#ifndef __PHY_DEFS_COMMON_H__
#define __PHY_DEFS_COMMON_H__
@@ -52,12 +55,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <math.h>
#include "common_lib.h"
#include "msc.h"
#include <common/utils/LOG/log.h>
@@ -131,6 +136,56 @@ typedef enum {
two=12
} PHICH_RESOURCE_t;
#endif
////////////////////////////////////////// NB-IoT testing ///////////////////////////////////////////////////////////////
typedef struct{
/// The base sequence of DMRS sequence in a cell for 3 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 12. Value 12 is not used.
uint16_t threeTone_BaseSequence;
/// Define 3 cyclic shifts for the 3-tone case, see TS 36.211 [21, 10.1.4.1.2].
uint16_t threeTone_CyclicShift;
/// The base sequence of DMRS sequence in a cell for 6 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 14. Value 14 is not used.
uint16_t sixTone_BaseSequence;
/// Define 4 cyclic shifts for the 6-tone case, see TS 36.211 [21, 10.1.4.1.2].
uint16_t sixTone_CyclicShift;
/// The base sequence of DMRS sequence in a cell for 12 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 30. Value 30 is not used.
uint16_t twelveTone_BaseSequence;
}DMRS_CONFIGx_t;
/// UL-ReferenceSignalsNPUSCH from 36.331 RRC spec
typedef struct {
/// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]}
uint8_t groupHoppingEnabled;
/// , see TS 36.211 (5.5.1.3). \vr{[0..29]}
uint8_t groupAssignmentNPUSCH;
/// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]}
uint8_t cyclicShift;
/// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
uint8_t nPRS[20];
/// group hopping sequence for DMRS, 36.211, Section 10.1.4.1.3. Second index corresponds to the four possible subcarrier configurations
uint8_t grouphop[20][4];
/// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
uint8_t seqhop[20];
} UL_REFERENCE_SIGNALS_NPUSCHx_t;
/// PUSCH-ConfigCommon from 36.331 RRC spec.
typedef struct {
/// Number of repetitions for ACK/NACK HARQ response to NPDSCH containing Msg4 per NPRACH resource, see TS 36.213 [23, 16.4.2].
uint8_t ack_NACK_NumRepetitions_Msg4[3];
/// SRS SubframeConfiguration. See TS 36.211 [21, table 5.5.3.3-1]. Value sc0 corresponds to value 0, sc1 to value 1 and so on.
uint8_t srs_SubframeConfig;
/// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]}
DMRS_CONFIGx_t dmrs_Config;
/// Ref signals configuration
UL_REFERENCE_SIGNALS_NPUSCHx_t ul_ReferenceSignalsNPUSCH;
} NPUSCH_CONFIG_COMMONx;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// PHICH-Config from 36.331 RRC spec
typedef struct {
/// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1).
@@ -717,6 +772,41 @@ typedef struct {
#endif
/// for fair RR scheduler
uint32_t ue_multiple_max;
////////////////////////// NB-IoT testing //////////////////////////////
uint8_t subcarrier_spacing;
uint16_t control_region_size;
uint8_t nb_antennas_tx_NB_IoT; // to replace with NB_IoT_frame_params
NPUSCH_CONFIG_COMMONx npusch_config_common;
uint8_t RB_ID_NB_IoT; // to be used
uint8_t flag_free_sf; // flag to indicate for NPDSCH and NPDCCH process if the current SF already used
/// Frequency index of CBMIMO1 card
uint8_t freq_idx;
/// RX Frequency for ExpressMIMO/LIME
uint32_t carrier_freq[4];
/// TX Frequency for ExpressMIMO/LIME
uint32_t carrier_freqtx[4];
/// RX gain for ExpressMIMO/LIME
uint32_t rxgain[4];
/// TX gain for ExpressMIMO/LIME
uint32_t txgain[4];
/// RF mode for ExpressMIMO/LIME
uint32_t rfmode[4];
/// RF RX DC Calibration for ExpressMIMO/LIME
uint32_t rxdc[4];
/// RF TX DC Calibration for ExpressMIMO/LIME
uint32_t rflocal[4];
/// RF VCO calibration for ExpressMIMO/LIME
uint32_t rfvcolocal[4];
/// Turns on second TX of CBMIMO1 card
uint8_t dual_tx;
/// flag to indicate SISO transmission
uint8_t mode1_flag;
/////////////////////////////////////////////////////////////////////
} LTE_DL_FRAME_PARMS;
typedef enum {
@@ -1190,3 +1280,4 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
#endif // __PHY_DEFS__H__

View File

@@ -381,6 +381,8 @@ typedef struct RU_t_s{
int num_eNB;
/// list of eNBs using this RU
struct PHY_VARS_eNB_s *eNB_list[NUMBER_OF_eNB_MAX];
/// list of NB-IoT using this RU
struct PHY_VARS_eNB_NB_IoT_s *eNB_nbiot_list[NUMBER_OF_eNB_MAX];
/// Mapping of antenna ports to RF chain index
openair0_rf_map rf_map;
/// IF device descriptor
@@ -423,6 +425,8 @@ typedef struct RU_t_s{
#endif
/// function pointer to eNB entry routine
void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
/// function pointer to NB-IoT entry routine
void (*eNB_nb_iot_top)(struct PHY_VARS_eNB_NB_IoT_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
/// Timing statistics
time_stats_t ofdm_demod_stats;
/// Timing statistics (TX)
@@ -758,6 +762,19 @@ typedef struct {
pthread_cond_t cond_RUs;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_RUs;
uint16_t HFN; //NB-IoT
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_rxtx; //NB-IoT
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread_rxtx; //NB-IoT
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr_rxtx; //NB-IoT
/// condition variable for tx processing thread
pthread_cond_t cond_rxtx; //NB-IoT
int instance_cnt_rxtx;
} L1_rxtx_proc_t;
typedef struct {

View File

@@ -0,0 +1,139 @@
/*
* 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.0 (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
*/
#ifndef __PHY_EXTERN_NB_IOT_H__
#define __PHY_EXTERN_NB_IOT_H__
//#include "PHY/defs.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "openair2/PHY_INTERFACE/defs_NB_IoT.h"
//#include "PHY_INTERFACE/IF_Module_NB_IoT.h"
/*
extern char* namepointer_chMag ;
extern char* namepointer_log2;
extern char fmageren_name2[512];
extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
*/
#include "PHY/NBIoT_TRANSPORT/extern_NB_IoT.h"
//#include "SIMULATION/ETH_TRANSPORT/extern.h"
extern unsigned int DAQ_MBOX_NB_IoT;
extern int number_of_cards_NB_IoT;
//extern PHY_CONFIG *PHY_config;
//extern PHY_VARS *PHY_vars;
#ifndef OCP_FRAMEWORK
extern PHY_VARS_UE_NB_IoT ***PHY_vars_UE_NB_IoT_g;
extern PHY_VARS_eNB_NB_IoT ***PHY_vars_eNB_NB_IoT_g;
extern PHY_VARS_RN_NB_IoT **PHY_vars_RN_NB_IoT_g;
extern NB_IoT_DL_FRAME_PARMS *nb_iot_frame_parms_g;
#else
#define MAX_UE 10
#define MAX_eNB_NB_IoT 20
extern PHY_VARS_UE_NB_IoT *PHY_vars_UE_NB_IoT_g[MAX_UE][MAX_NUM_CCs];
extern PHY_VARS_eNB_NB_IoT *PHY_vars_eNB_NB_IoT_g[MAX_eNB_NB_IoT][MAX_NUM_CCs];
#endif
//extern MAC_xface_NB_IoT *mac_xface_NB_IoT;
extern short primary_synch_NB_IoT[264];
/*
extern short primary_synch1[144];
extern short primary_synch2[144];
extern unsigned char primary_synch0_tab[72];
extern unsigned char primary_synch1_tab[72];
extern unsigned char primary_synch2_tab[72]; */
extern int16_t *primary_synch0_time_NB_IoT; //!< index: [0..ofdm_symbol_size*2[
// extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[
// extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[
extern int *sync_corr_ue0_NB_IoT; //!< index [0..10*samples_per_tti[
/*
extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[
extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[
extern int flagMag;
//extern short **txdataF_rep_tmp;
extern char mode_string[4][20];
*/
/*
#ifndef OPENAIR2
extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST;
extern unsigned char NB_RN_INST;
#endif
extern unsigned int ULSCH_max_consecutive_errors;
extern int flag_LA;
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
extern double sinr_bler_map_up[MCS_COUNT][2][16];
extern int table_length[MCS_COUNT];
extern double sinr_to_cqi[4][16];
extern int cqi_to_mcs[16];
//for MU-MIMO abstraction using MIESM
//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
extern double MI_map_4qam[3][162];
extern double MI_map_16qam[3][197];
extern double MI_map_64qam[3][227];
extern double beta1_dlsch_MI[6][MCS_COUNT];
extern double beta2_dlsch_MI[6][MCS_COUNT];
extern double q_qpsk[8];
extern double q_qam16[8];
extern double q_qam64[8];
extern double p_qpsk[8];
extern double p_qam16[8];
extern double p_qam64[8];
extern double beta1_dlsch[6][MCS_COUNT];
extern double beta2_dlsch[6][MCS_COUNT];
extern char eNB_functions[6][20];
extern char eNB_timing[2][20];
*/
extern int16_t unscrambling_lut_NB_IoT[65536*16];
/*
extern uint8_t scrambling_lut[65536*16];
extern unsigned short msrsb_6_40[8][4];
extern unsigned short msrsb_41_60[8][4];
extern unsigned short msrsb_61_80[8][4];
extern unsigned short msrsb_81_110[8][4];
extern unsigned short Nb_6_40[8][4];
extern unsigned short Nb_41_60[8][4];
extern unsigned short Nb_61_80[8][4];
extern unsigned short Nb_81_110[8][4];
extern uint16_t hundred_times_log10_NPRB[100];
extern uint8_t alpha_lut[8];
*/
#endif /*__PHY_EXTERN_H__ */

2
openair1/PHY/impl_defs_lte.h Normal file → Executable file
View File

@@ -33,6 +33,8 @@
#ifndef __PHY_IMPLEMENTATION_DEFS_LTE_H__
#define __PHY_IMPLEMENTATION_DEFS_LTE_H__
#include "types.h"
typedef struct {
/// \brief Holds the transmit data in the frequency domain.
/// - first index: rx antenna [0..nb_antennas_rx[

View File

@@ -33,7 +33,9 @@
#ifndef __PHY_IMPL_DEFS_NB_IOT__H__
#define __PHY_IMPL_DEFS_NB_IOT__H__
#include "types_NB_IoT.h"
#include "types.h"
//#include "types_NB_IoT.h"
//#include "defs.h"
typedef enum {TDD_NB_IoT=1,FDD_NB_IoT=0} NB_IoT_frame_type_t;
@@ -278,8 +280,10 @@ typedef struct {
int32_t freq_offset;
/// eNb_id user is synched to
int32_t eNb_id;
} NB_IoT_UE_COMMON;
typedef struct {
/// \brief Received frequency-domain signal after extraction.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
@@ -400,7 +404,9 @@ typedef struct NPRACH_Parameters_NB_IoT{
} nprach_parameters_NB_IoT_t;
typedef struct{
nprach_parameters_NB_IoT_t list[3];
nprach_parameters_NB_IoT_t list[3];
}NPRACH_List_NB_IoT_t;
typedef long RSRP_Range_t;
@@ -469,9 +475,11 @@ typedef struct {
/// Ref signals configuration
UL_REFERENCE_SIGNALS_NPUSCH_t ul_ReferenceSignalsNPUSCH;
} NPUSCH_CONFIG_COMMON;
typedef struct{
/// See TS 36.213 [23, 16.2.1.1], unit dBm.
uint8_t p0_NominalNPUSCH;
@@ -489,18 +497,32 @@ typedef struct {
uint16_t dl_GapDurationCoeff;
} DL_GapConfig_NB_IoT;
#define NBIOT_INBAND_LTEPCI 0
#define NBIOT_INBAND_IOTPCI 1
#define NBIOT_INGUARD 2
#define NBIOT_STANDALONE 3
typedef struct {
/// for inband, lte bandwidth
uint8_t LTE_N_RB_DL;
uint8_t LTE_N_RB_UL;
/// Frame type (0 FDD, 1 TDD)
NB_IoT_frame_type_t frame_type;
/// Number of resource blocks (RB) in DL of the LTE (for knowing the bandwidth)
uint8_t N_RB_DL;
/// Number of resource blocks (RB) in UL of the LTE ((for knowing the bandwidth)
uint8_t N_RB_UL;
/// TDD subframe assignment (0-7) (default = 3) (254=RX only, 255=TX only)
uint8_t tdd_config;
/// Cell ID
uint16_t Nid_cell;
/// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
NB_IoT_prefix_type_t Ncp;
/// Cyclic Prefix for UL (0=Normal CP, 1=Extended CP)
NB_IoT_prefix_type_t Ncp_UL;
/// shift of pilot position in one RB
uint8_t nushift;
/// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
@@ -528,7 +550,9 @@ typedef struct {
/// flag to indicate SISO transmission
uint8_t mode1_flag;
/// Indicator that 20 MHz channel uses 3/4 sampling frequency
//uint8_t threequarter_fs;
uint8_t threequarter_fs;
/// Size of FFT
uint16_t ofdm_symbol_size;
/// Number of prefix samples in all but first symbol of slot
@@ -582,6 +606,7 @@ typedef struct {
* 3 =stand alone
*/
uint16_t operating_mode;
/*
* Only for In-band operating mode with same PCI
* its measured in number of OFDM symbols
@@ -607,20 +632,58 @@ typedef struct {
} NB_IoT_DL_FRAME_PARMS;
typedef struct {
/// \brief Pointers (dynamic) to the received data in the time domain.
/// - first index: rx antenna [0..nb_antennas_rx]
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti]
int32_t **rxdata;
/// \brief Pointers (dynamic) to the received data in the frequency domain.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti]
int32_t **rxdataF;
/// \brief Holds the transmit data in time domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index:
int32_t **txdata[3];
/// \brief holds the transmit data in the frequency domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
/// - third index: sample [0..]
int32_t **txdataF;
int32_t **txdataF[3];
/// \brief holds the transmit data after beamforming in the frequency domain.
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: sample [0..]
int32_t **txdataF_BF[3];
/// \brief Holds the received data in time domain.
/// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..]
int32_t **rxdata[3];
/// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
/// - first index: secotr id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..samples_per_tti[
int32_t **rxdata_7_5kHz[3];
/// \brief Holds the received data in the frequency domain.
/// - first index: sector id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
int32_t **rxdataF[3];
/// \brief Holds output of the sync correlator.
/// - first index: sector id [0..2] (hard coded)
/// - second index: sample [0..samples_per_tti*10[
uint32_t *sync_corr[3];
/// \brief Holds the beamforming weights
/// - first index: eNB id [0..2] (hard coded)
/// - second index: eNB antenna port index (hard coded)
/// - third index: tx antenna [0..nb_antennas_tx[
/// - fourth index: sample [0..]
int32_t **beam_weights[3][15];
/// \brief Holds the tdd reciprocity calibration coefficients
/// - first index: eNB id [0..2] (hard coded)
/// - second index: tx antenna [0..nb_antennas_tx[
/// - third index: frequency [0..]
int32_t **tdd_calib_coeffs[3];
} NB_IoT_eNB_COMMON;
typedef struct {
@@ -645,6 +708,7 @@ typedef struct {
uint32_t *sync_corr[3];
} NB_IoT_RU_COMMON;
typedef struct {
/// \brief Hold the channel estimates in frequency domain based on SRS.
/// - first index: sector id [0..2] (hard coded)

View File

@@ -3,7 +3,9 @@
* 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
*

View File

@@ -50,6 +50,8 @@ extern LTE_DL_FRAME_PARMS *lte_frame_parms_g;
extern PHY_VARS_eNB * PHY_vars_eNB_g[MAX_eNB][MAX_NUM_CCs];
#endif
extern short primary_synch0[144];
extern short primary_synch1[144];
extern short primary_synch2[144];

View File

@@ -149,6 +149,5 @@ char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p
int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
/// lookup table for scrambling in TX
uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
uint8_t max_turbo_iterations=4;
#endif /*__PHY_VARS_H__ */

View File

@@ -3,7 +3,7 @@
* 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
* 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
*

162
openair1/PHY/vars_NB_IoT.h Normal file
View File

@@ -0,0 +1,162 @@
/*
* 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.0 (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
*/
#ifndef __PHY_VARS_NB_IOT_H__
#define __PHY_VARS_NB_IOT_H__
#include "PHY/types_NB_IoT.h"
#include "PHY/defs_L1_NB_IoT.h"
/*
#ifndef USER_MODE
unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
unsigned int DAQ_MBOX;
#endif
char* namepointer_chMag ;
char fmageren_name2[512];
char* namepointer_log2;
//PHY_CONFIG *PHY_config;
*/
/*
#include "PHY/LTE_REFSIG/primary_synch.h"
int16_t *primary_synch0_time;
int16_t *primary_synch1_time;
int16_t *primary_synch2_time;
*/
//#include "PHY/CODING/vars.h"
//PHY_VARS *PHY_vars;
#ifndef OCP_FRAMEWORK
PHY_VARS_UE_NB_IoT ***PHY_vars_UE_NB_IoT_g;
PHY_VARS_eNB_NB_IoT ***PHY_vars_eNB_NB_IoT_g;
PHY_VARS_RN_NB_IoT **PHY_vars_RN_NB_IoT_g;
//NB_IoT_DL_FRAME_PARMS *lte_frame_parms_g;
#else
PHY_VARS_UE_NB_IoT * PHY_vars_UE_NB_IoT_g[MAX_UE][MAX_NUM_CCs]={NULL};
PHY_vars_eNB_NB_IoT * PHY_vars_eNB_NB_IoT_g[MAX_eNB_NB_IoT][MAX_NUM_CCs]={NULL};
#endif
///*
//unsigned short rev[2048],rev_times4[8192],rev_half[1024];
//unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192];
//*/
/*
char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
#include "PHY/LTE_TRANSPORT/vars.h"
#include "SIMULATION/ETH_TRANSPORT/vars.h"
#ifndef OPENAIR2
unsigned char NB_eNB_INST=0;
unsigned char NB_UE_INST=0;
unsigned char NB_RN_INST=0;
unsigned char NB_INST=0;
#endif
*/
/*
unsigned int ULSCH_max_consecutive_errors = 20;
int number_of_cards;
int flag_LA=0;
int flagMag;
//extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
//extern double ABS_SINR_eff_BLER_table[MCS_COUNT][9][9];
//extern double ABS_beta[MCS_COUNT];odi
double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
int table_length[MCS_COUNT];
//double sinr_bler_map_up[MCS_COUNT][2][16];
//for MU-MIMO abstraction using MIESM
//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
double MI_map_4qam[3][162];
double MI_map_16qam[3][197];
double MI_map_64qam[3][227];
// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs
double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424},
{-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572},
{-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392},
{ -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545}
};
//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
//for SNR to MI conversion 7 th order Polynomial coeff
double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425};
double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898};
//for MI to SNR conversion 7 th order Polynomial coeff
double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965};
double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089};
double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343};
// ideal CE MIESM
double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}};
double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}};
//real CE MIESM
////////
double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}};
double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}};
////////
//ideal channel estimation values
//double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}};
//double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}};
/////////double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}};
/////////double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}};
//real channel estimation valus
///
double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}};
double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1,1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}};
///
#ifdef OCP_FRAMEWORK
#include <enums.h>
#else
char eNB_functions[6][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RCC_IF4p5","NGFI_RAI_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5",};
char eNB_timing[2][20]={"synch_to_ext_device","synch_to_other"};
#endif
*/
/// lookup table for unscrambling in RX
int16_t unscrambling_lut_NB_IoT[65536*16] __attribute__((aligned(32)));
/*
/// lookup table for scrambling in TX
uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
*/
#endif /*__PHY_VARS_H__ */

View File

@@ -31,6 +31,7 @@
*/
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_extern.h"
#include "SCHED/sched_common_extern.h"
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
@@ -923,19 +924,33 @@ LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti)
// LOG_E(PHY,"get_UE_stats: UE with rnti %x not found\n",rnti);
return NULL;
}
return(&PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[(uint32_t)UE_id]);
}
return(&RC.eNB[Mod_id][CC_id]->UE_stats[(uint32_t)UE_id]);
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *eNB)
{
uint8_t i;
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
if ((eNB->dlsch[i]) &&
(eNB->dlsch[i][0]) &&
(eNB->dlsch[i][0]->rnti==rnti)) {
return(i);
}
}
return(-1);
}
*/
/*
LTE_DL_FRAME_PARMS* get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id)
{
return(&RC.eNB[Mod_id][CC_id]->frame_parms);
}
/*
MU_MIMO_mode *get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti)
{
int8_t UE_id = find_ue( rnti, RC.eNB[Mod_id][CC_id] );

57
openair1/SCHED/phy_procedures_lte_eNb.c Normal file → Executable file
View File

@@ -26,10 +26,15 @@
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk
* \last changes: M. Kanj, V. Savaux
* \date: 2018
* \company: b<>com
* \email: matthieu.kanj@b-com.com, vincent.savaux@b-com.com
* \note
* \warning
*/
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
#include "SCHED/sched_eNB.h"
@@ -39,14 +44,12 @@
#include "fapi_l1.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
#include "msc.h"
#include <time.h>
#include "targets/COMMON/openairinterface5g_limits.h"
#include "intertask_interface.h"
nfapi_ue_release_request_body_t release_rntis;
@@ -229,7 +232,6 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
}
void pdsch_procedures(PHY_VARS_eNB *eNB,
L1_rxtx_proc_t *proc,
int harq_pid,
@@ -613,6 +615,7 @@ void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,u
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
//-----------------------------------------------------------------------------
/*
* Main handler of PUCCH received
@@ -700,6 +703,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
frame,
subframe,
SR_payload,
uci->type,
uci->n_pucch_1_0_sr[0]);
@@ -1997,3 +2001,46 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
}
void release_rnti_of_phy(module_id_t mod_id){
int i,j;
int CC_id;
rnti_t rnti;
PHY_VARS_eNB *eNB_PHY = NULL;
LTE_eNB_ULSCH_t *ulsch = NULL;
LTE_eNB_DLSCH_t *dlsch = NULL;
for(i = 0; i< release_rntis.number_of_TLVs;i++){
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[mod_id][CC_id];
rnti = release_rntis.ue_release_request_TLVs_list[i].rnti;
for (j=0; j<NUMBER_OF_UE_MAX; j++) {
ulsch = eNB_PHY->ulsch[j];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch);
}
dlsch = eNB_PHY->dlsch[j][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)){
LOG_I(PHY, "clean_eNb_dlsch dlsch[%d] UE %x \n", j, rnti);
clean_eNb_dlsch(dlsch);
}
}
ulsch = eNB_PHY->ulsch[j];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch);
}
for(j=0; j<NUMBER_OF_UCI_VARS_MAX; j++) {
if(eNB_PHY->uci_vars[j].rnti == rnti){
LOG_I(PHY, "clean eNb uci_vars[%d] UE %x \n",j, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
}
}
}
}
memset(&release_rntis, 0, sizeof(nfapi_ue_release_request_body_t));
}

View File

@@ -31,12 +31,18 @@
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "LTE_TDD-Config.h"
#include "PHY/defs_L1_NB_IoT.h"
/*! \brief Function to compute subframe Number(DL and S) as a function of Frame type and TDD Configuration
@param frame_parms Pointer to DL frame parameter descriptor
@returns Subframe Number (DL,S)
*/
int subframe_num(LTE_DL_FRAME_PARMS *frame_parms);
///////// NB_IoT testing ///////////////////////////
void prach_procedures_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB);
///////////////////////////////////////////////////
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.
@param frame_parms Pointer to DL frame parameter descriptor
@param subframe Subframe index
@@ -180,7 +186,7 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id)
@param UE_id ID of UE which may be issuing the SR
@returns 1 if TXOp is active.
*/
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,L1_rxtx_proc_t *proc,uint8_t UE_id);
//uint8_t is_SR_subframe(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc,uint8_t UE_id);
/*! \brief Gives the UL subframe corresponding to a PDDCH order in subframe n
@param frame_parms Pointer to DL frame parameters
@@ -208,6 +214,7 @@ int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
//int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
//int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti);
void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance);
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint16_t timing_advance);
@@ -246,8 +253,8 @@ TDD, this routine computes the procedure described in Section 10.1 of 36.213 (th
@param n1_pucch2 Pointer to n1_pucch2
@param n1_pucch3 Pointer to n1_pucch3
*/
void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
L1_rxtx_proc_t *proc,
void get_n1_pucch_eNB(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t UE_id,
int16_t *n1_pucch0,
int16_t *n1_pucch1,
@@ -265,8 +272,8 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
@param SR_payload Indication of SR presence (TDD specific)
*/
void process_HARQ_feedback(uint8_t UE_id,
PHY_VARS_eNB *phy_vars_eNB,
L1_rxtx_proc_t *proc,
PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
uint8_t pusch_flag,
uint8_t *pucch_payload,
uint8_t pucch_sel,
@@ -342,11 +349,13 @@ int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subf
void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
/* from here: prototype added to remove compilation warnings, doc to be written by the author of the function */
int ul_ACK_subframe2_dl_frame(LTE_DL_FRAME_PARMS *frame_parms,int frame, unsigned char subframe,unsigned char subframe_tx);
void get_retransmission_timing(LTE_TDD_Config_t *tdd_Config, frame_t *frameP, sub_frame_t *subframeP);
/*@}*/

View File

@@ -186,7 +186,7 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
@param UE_id ID of UE which may be issuing the SR
@returns 1 if TXOp is active.
*/
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,L1_rxtx_proc_t *proc,uint8_t UE_id);
//uint8_t is_SR_subframe(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc,uint8_t UE_id);
int8_t find_ue_dlsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
@@ -218,7 +218,7 @@ int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id);
int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx);
void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
void release_rnti_of_phy(module_id_t mod_id);
/*@}*/

View File

@@ -0,0 +1,578 @@
/*
* 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.0 (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 IF_Module_L1_primitives_NB_IoT.c
* \brief handling nfapi
* \author NTUST BMW Lab./
* \date 2017
* \email:
* \version 1.0
*
*/
//#include "PHY/LTE_TRANSPORT/dlsch_tbs_full_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "IF_Module_L1_primitives_NB_IoT.h"
//#include "../SCHED/defs.h"
#include "defs_NB_IoT.h"
#include "assertions.h"
//#include "PHY/defs.h"
#include "PHY/defs_L1_NB_IoT.h"
//#include "PHY/extern.h"
#include "PHY/extern_NB_IoT.h"
#include "PHY/phy_extern.h"
//#include "PHY/vars.h"
#include "PHY/INIT/defs_NB_IoT.h"
int Irep_to_Nrep_x[16] = {1,2,4,8,16,32,64,128,192,256,384,512,768,1024,1536,2048};
void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
nfapi_dl_config_request_pdu_t *dl_config_pdu,
uint8_t *sdu)
{
NB_IoT_eNB_NDLSCH_t *ndlsch;
NB_IoT_eNB_NDLSCH_t *ndlsch23;
NB_IoT_DL_eNB_HARQ_t *ndlsch_harq;
NB_IoT_DL_eNB_HARQ_t *ndlsch_harq23;
nfapi_dl_config_ndlsch_pdu_rel13_t *rel13 = &dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13;
int UE_id= -1;
int flag_malloc = 0;
ndlsch= eNB->ndlsch_SIB1;
ndlsch23= eNB->ndlsch_SIB23;
// if(flag_malloc) free (ndlsch->harq_process);
// ndlsch->harq_process = (NB_IoT_DL_eNB_HARQ_t*) malloc (sizeof(NB_IoT_DL_eNB_HARQ_t));
flag_malloc = 1 ;
//Check for SI PDU since in NB-IoT there is no DCI for that
//SIB1 (type 0), other DLSCH data (type 1) (include the SI messages) based on our ASSUMPTIONs
//is SIB1-NB
if(rel13->rnti_type == 0 && rel13->rnti == 65535)
{
/*
* the configuration of the NDLSCH PDU for the SIB1-NB shoudl be the following:
* -RNTI type = 0; (BCCH)
* -RNTI = OxFFFF (65535)
* -Repetition number = 0-15 and should be mapped to 4,8,16 as reported in Table 16.4.1.3-3 TS 36.213 (is the schedulingInoSIB1 of the MIB)
* -Number of subframe for resource assignment = may is not neded to know since the scheduling is fixed
* (Spec TS 36.331 "SIB1-NB transmission occur in subframe #4 of every other frame in 16 continuous frame"
* meaning that from the starting point we should transmit the SIB1-NB in 8 subframes among the 16 available (every other))
*
* From spec. TS 36.321 v14.2.o pag 31 --> there is an HARQ process for all the broadcast (so we consider it also for SIB1-NB)
*
*/
//LOG_I(PHY,"B NB-handle_nfapi_dlsch_pdu_NB_IoT SIB1\n");
ndlsch->active = 1;
ndlsch->rnti = 65535;
ndlsch_harq = ndlsch->harq_process;
ndlsch->ndlsch_type = SIB1;
ndlsch->npdsch_start_symbol = rel13->start_symbol; //start symbol for the ndlsch transmission
//ndlsch_harq->pdu = sdu;
//LOG_I(PHY,"B content_sib1:%d\n",sdu);
/////ndlsch->content_sib1.pdu = sdu;
ndlsch_harq->pdu = sdu;
//LOG_I(PHY,"A content_sib1:%d\n",ndlsch->content_sib1.pdu);
//should be from 1 to 8
ndlsch->resource_assignment_SIB1 = rel13->number_of_subframes_for_resource_assignment;//maybe we don't care about it since a fixed schedule
ndlsch->repetition_number_SIB1 = rel13->repetition_number; //is the schedulingInfoSIB1 (value 1-15) of MIB that is mapped into value 4-8-16 (see NDLSCH fapi specs Table 4-47)
ndlsch->modulation = rel13->modulation;
ndlsch->status = ACTIVE_NB_IoT;
//ndlsch->
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no ack and nack)
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
//LOG_I(PHY,"A NB-handle_nfapi_dlsch_pdu_NB_IoT SIB1\n");
ndlsch_harq->TBS = TBStable_NB_IoT_SIB1[rel13->repetition_number];
}
//is SI message (this is an NDLSCH that will be transmitted very frequently)
else if(rel13->rnti_type == 1 && rel13->rnti == 65535)
{
/*
*
* the configuration of the NDLSCH PDU for the SIB1-NB should be the following:
* RNTI type = 1;
* RNTI = OxFFFF (65535)
* Repetition number = 0 and should be mapped to 1 through Table 16.4.1.3-2 TS 36.213
* Number of subframe for resource assignment = will be evaluated by the MAC based on the value of the "si-TB" field inside the SIB1-NB (value 2 or 8)
*
* From spec. TS 36.321 v14.2.o pag 31 --> there is an HARQ process for all the broadcast
*
* XXX for the moment we are not able to prevent the problem of Error: first transmission but sdu = NULL.
* anyway, the PHY layer if have finished the transmission it will not transmit anything and will generate the error
*
*/
//LOG_I(PHY,"B NB-handle_nfapi_dlsch_pdu_NB_IoT SIB23\n");
ndlsch_harq23 = ndlsch23->harq_process;
//new SI starting transmission (should enter here only the first time for a new transmission)
if(sdu != NULL)
{
ndlsch23->active = 1;
ndlsch23->ndlsch_type = SI_Message;
ndlsch23->rnti = 65535;
ndlsch23->npdsch_start_symbol = rel13->start_symbol; //start OFDM symbol for the ndlsch transmission
//ndlsch_harq->pdu = sdu;
//LOG_I(PHY,"B content_sib23:%d\n",sdu);
ndlsch_harq23->pdu = sdu;
ndlsch_harq23->repetition_number = rel13->repetition_number;//should be always fix to 0 to be mapped in 1
ndlsch_harq23->modulation = rel13->modulation;
ndlsch_harq23->TBS = rel13->length;
//LOG_I(PHY,"A content_sib23:%d\n",sdu);
ndlsch23->resource_assignment = rel13->number_of_subframes_for_resource_assignment;//value 2 or 8
ndlsch23->counter_repetition_number = rel13->number_of_subframes_for_resource_assignment;
ndlsch23->counter_current_sf_repetition = 0;
ndlsch23->pointer_to_subframe = 0;
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no sck and nack)
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch23->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch23->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
}
else
{
//continue the remaining transmission of the previous SI at PHY if any (otherwise nothing)
//there is no need of repeating the configuration on the ndlsch
//ndlsch_harq->pdu = NULL;
//LOG_I(PHY,"sib23=NULL\n");
ndlsch_harq23->pdu = NULL;
}
//Independently if we have the PDU or not (first transmission or repetition) the process is activated for triggering the ndlsch_procedure
//LOG_I(PHY,"ACTIVE_NB_IoT\n");
ndlsch_harq23->status = ACTIVE_NB_IoT;
//LOG_D(PHY,"A NB-handle_nfapi_dlsch_pdu_NB_IoT SIB23\n");
}
//ue specific data or RAR (we already have received the DCI for this)
else if(rel13->rnti != 65535 && rel13->rnti_type == 1)
{
//printf("rel13->rnti: %d, eNB->ndlsch_RAR->rnti: %d\n",rel13->rnti,eNB->ndlsch_RAR->rnti);
//eNB->ndlsch_RAR->rnti = rel13->rnti;
//check if the PDU is for RAR
//if(eNB->ndlsch_RAR != NULL && eNB->ndlsch_RAR->ndlsch_type == RAR) //rnti for the RAR should have been set priviously by the DCI
if(eNB->ndlsch_RAR != NULL && rel13->rnti == eNB->ndlsch_RAR->rnti) //rnti for the RAR should have been set priviously by the DCI
{
eNB->ndlsch_RAR->active = 1;
eNB->ndlsch_RAR->active_msg2 = 1; /// activated only when NPDSCH is transmitting msg2
eNB->ndlsch_RAR->rnti = rel13->rnti;
eNB->ndlsch_RAR->npdsch_start_symbol = rel13->start_symbol;
eNB->ndlsch_RAR->rnti_type = rel13->rnti_type;
eNB->ndlsch_RAR->resource_assignment = rel13->resource_assignment; // for NDLSCH // this value point to --> number of subframes needed
eNB->ndlsch_RAR->repetition_number = Irep_to_Nrep_x[rel13->repetition_number];
eNB->ndlsch_RAR->modulation = rel13->modulation;
eNB->ndlsch_RAR->number_of_subframes_for_resource_assignment = rel13->number_of_subframes_for_resource_assignment; // for NDLSCH //table 16.4.1.3-1 // TS 36.213
eNB->ndlsch_RAR->counter_repetition_number = Irep_to_Nrep_x[rel13->repetition_number];
eNB->ndlsch_RAR->counter_current_sf_repetition = 0;
eNB->ndlsch_RAR->pointer_to_subframe = 0;
//printf("number of subframe : %d, Rep of subframe : %d\n",eNB->ndlsch_RAR->number_of_subframes_for_resource_assignment,eNB->ndlsch_RAR->counter_repetition_number);
eNB->ndlsch_RAR->harq_process->TBS = rel13->length;
eNB->ndlsch_RAR->harq_process->pdu = sdu;
}
else
{ //this for ue data
//TODO
LOG_I(PHY,"handling MSG4 or ue-spec data\n");
//program addition DLSCH parameters not from DCI (for the moment we only pass the pdu)
//int UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST);
UE_id = 0;
//UE_id = find_ue_NB_IoT(rel13->rnti,eNB);
//AssertFatal(UE_id==-1,"no existing ue specific dlsch_context\n");
ndlsch = eNB->ndlsch[(uint8_t)UE_id];
ndlsch_harq = eNB->ndlsch[(uint8_t)UE_id][0]->harq_process;
AssertFatal(ndlsch_harq!=NULL,"dlsch_harq for ue specific is null\n");
ndlsch->active = 1;
ndlsch->rnti = rel13->rnti; // how this value is tested in line 177 ???? i am missing something ????
ndlsch->npdsch_start_symbol = rel13->start_symbol;
ndlsch->rnti_type = rel13->rnti_type;
ndlsch->resource_assignment = rel13->resource_assignment ; // for NDLSCH // this value point to --> number of subframes needed
ndlsch->repetition_number = Irep_to_Nrep_x[rel13->repetition_number];
ndlsch->modulation = rel13->modulation;
ndlsch->number_of_subframes_for_resource_assignment = rel13->number_of_subframes_for_resource_assignment; // for NDLSCH //table 16.4.1.3-1 // TS 36.213
ndlsch->counter_repetition_number = Irep_to_Nrep_x[rel13->repetition_number];
ndlsch->counter_current_sf_repetition = 0;
ndlsch->pointer_to_subframe = 0;
ndlsch_harq->TBS = rel13->length;
ndlsch_harq->pdu = sdu;
}
}
//I don't know which kind of data is
else
{
LOG_E(PHY, "handle_nfapi_dlsch_pdu_NB_IoT: Unknown type of data (rnti type %d, rnti %d)\n", rel13->rnti_type, rel13->rnti);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//Memo for initialization TODO: target/SIMU/USER/init_lte.c/init_lte_eNB --> new_eNB_dlsch(..) //
//this is where the allocation of PHy_vars_eNB_NB_IoT and all the ndlsch structures happen //
/////////////////////////////////////////////////////////////////////////////////////////////////
// do the schedule response and trigger the TX
void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
{
//LOG_I(PHY,"schedule_response_NB_IoT\n");
//XXX check if correct to take eNB like this
PHY_VARS_eNB_NB_IoT *eNB = PHY_vars_eNB_NB_IoT_g[0][Sched_INFO->CC_id];
eNB_rxtx_proc_NB_IoT_t *proc = &eNB->proc.proc_rxtx[0];
NB_IoT_eNB_NPBCH_t *npbch;
///
int i;
//module_id_t Mod_id = Sched_INFO->module_id;
//uint8_t CC_id = Sched_INFO->CC_id;
nfapi_dl_config_request_t *DL_req = Sched_INFO->DL_req;
nfapi_ul_config_request_t *UL_req = Sched_INFO->UL_req;
nfapi_hi_dci0_request_t *HI_DCI0_req = Sched_INFO->HI_DCI0_req;
nfapi_tx_request_t *TX_req = Sched_INFO->TX_req;
//uint32_t hypersfn = Sched_INFO->hypersfn;
//frame_t frame = Sched_INFO->frame; // unused for instance
sub_frame_t subframe = Sched_INFO->subframe;
// implicite declaration of AssertFatal
//AsserFatal(proc->subframe_tx != subframe, "Current subframe %d != NFAPI subframe %d\n",proc->subframe_tx,subframe);
//AsserFatal(proc->frame_tx != frame, "Current sframe %d != NFAPI frame %d\n", proc->frame_tx,frame );
uint8_t number_dl_pdu = DL_req->dl_config_request_body.number_pdu;
uint8_t number_ul_pdu = UL_req->ul_config_request_body.number_of_pdus;
uint8_t number_ul_dci = HI_DCI0_req->hi_dci0_request_body.number_of_dci;
/*
if(number_dl_pdu>=5) number_dl_pdu=0;
if(number_ul_dci>=5) number_ul_dci=0;
*/
//uint8_t number_pdsch_rnti = DL_req->number_pdsch_rnti; // for the moment not used
// at most 2 pdus (DCI) in the case of NPDCCH
nfapi_dl_config_request_pdu_t *dl_config_pdu;
nfapi_ul_config_request_pdu_t *ul_config_pdu;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
//clear previous possible allocation (maybe something else should be added)
for(int i = 0; i < NUMBER_OF_UE_MAX_NB_IoT; i++)
{
if(eNB->ndlsch[i])
{
eNB->ndlsch[i][0]->harq_process->round=0; // may not needed
/*clear previous allocation information for all UEs*/
eNB->ndlsch[i][0]->subframe_tx[subframe] = 0;
}
/*clear the DCI allocation maps for new subframe*/
if(eNB->ulsch_NB_IoT[i])
{
eNB->ulsch_NB_IoT[i]->harq_process->dci_alloc = 0; //flag for indicating that a DCI has been allocated for UL
eNB->ulsch_NB_IoT[i]->harq_process->rar_alloc = 0; //Flag indicating that this ULSCH has been allocated by a RAR (for Msg3)
//no phich for NB-IoT so no DMRS should be utilized
}
}
for (i=0;i<number_dl_pdu;i++) //in principle this should be at most 2 (in case of DCI)
{
dl_config_pdu = &DL_req->dl_config_request_body.dl_config_pdu_list[i];
//LOG_I(PHY, "number_dl_pdu: %d ,dl_config_pdu type: %d\n",number_dl_pdu,dl_config_pdu->pdu_type);
switch (dl_config_pdu->pdu_type)
{
case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
//Remember: there is no DCI for SI information
//LOG_D(PHY,"Generate DL DCI PDU information from scheduler\n");
//TODO: separate the ndlsch structure configuration from the DCI (here we will encode only the DCI)
generate_eNB_dlsch_params_NB_IoT(eNB,proc,dl_config_pdu);
break;
case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
// for the moment we don't care about the n-bch pdu content since we need only the sdu if tx.request
npbch = &eNB->npbch; //in the main of the lte-softmodem they should allocate this memory of PHY_vars
npbch->h_sfn_lsb = dl_config_pdu->nbch_pdu.nbch_pdu_rel13.hyper_sfn_2_lsbs;
//LOG_I(PHY,"npbch->pdu\n");
dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index = 1;
if(TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index].segments[0].segment_data != NULL)
npbch->pdu = TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->nbch_pdu.nbch_pdu_rel13.pdu_index].segments[0].segment_data;
else
LOG_E(PHY, "Received a schedule_response with N-BCH but no SDU!!\n");
break;
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
//we can have three types of NDLSCH based on our assumptions: SIB1, SI, Data, RAR
//remember that SI messages have no DCI in NB-IoT therefore this is the only way to configure the ndlsch_SI/ndlsch_SIB1 structures ndlsch->active = 1;
/*
* OBSERVATION:
* Although 2 DCI may be received over a schedule_response the transmission of the NDLSCH data foresees only 1 NDLSCH PDU at time.
* Therefore is the MAC scheduler that knowing the different timing delay will send the corresponding schedule_response containing the NDLSCH PDU and the MAC PDU
* at the proper DL subframe
* -for this reason the activation of the ndslch structure is done only when we receive the NDLSCH pdu (here) such the in the TX procedure only 1 ue-specific pdu
* result active from the loop before calling the ndlsch_procedure
*/
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index = 1;
handle_nfapi_dlsch_pdu_NB_IoT(eNB, proc,dl_config_pdu,TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data);
break;
default:
LOG_D(PHY, "dl_config_pdu type not for NB_IoT\n");
break;
}
}
for (i=0;i<number_ul_dci;i++)
{
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[i];
LOG_D(PHY, "number_ul_dci:%d ,hi_dci0_pdu->pdu_type: %d\n",number_ul_dci,hi_dci0_pdu->pdu_type);
switch (hi_dci0_pdu->pdu_type)
{
case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
LOG_I(PHY, "hi_dci0_pdu type for NB_IoT\n");
generate_eNB_ulsch_params_NB_IoT(eNB,proc,hi_dci0_pdu);
break;
default:
LOG_E(PHY, "hi_dci0_pdu type not for NB_IoT\n");
break;
}
}
for(i = 0; i< number_ul_pdu; i++)
{
ul_config_pdu = &UL_req->ul_config_request_body.ul_config_pdu_list[i];
NB_IoT_eNB_NULSCH_t *nulsch;
NB_IoT_UL_eNB_HARQ_t *nulsch_harq;
nfapi_ul_config_nulsch_pdu_rel13_t *nfapi_parameters_rel13 = &ul_config_pdu->nulsch_pdu.nulsch_pdu_rel13;
switch(ul_config_pdu->pdu_type)
{
case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
if(nfapi_parameters_rel13->nulsch_format==0)
{
// new condition should be added to identify if this is msg3 3 since the TBS_table is not the same.
// the type of subcarrier spacing should be specified before the call of rx_ulsch since the parameter does not exist in nfapi parameters.
//TODO should distinguish between data and between data (npusch format)
/*NB: for reception of Msg3 generally not exist a DCI (because scheduling information are implicitly given by the RAR)
* but in case of FAPI specs we should receive an UL_config (containing the NULSCH pdu) for configuring the PHY for Msg3 reception from the MAC
* (this UL_config most probably will be created by the MAC when fill the RAR)
* (most probably we don't have the DL_config (for the RAR transmission) and the UL_CONFIG (for the Msg3 reception) at the same time (same subrame)
* since we are working in HD-FDD mode so for sure the UE will transmit the Msg3 in another subframe so make sense to have a UL_CONFIG in subframe
* diferent from the DL_CONFIG one)
*
*/
///////////////////////////////////////////////////////////////////////////////////////////
//maybe this condition should be replaced by another test ?!
if(nfapi_parameters_rel13->size < 80) // msg3 data
{
nulsch = eNB->ulsch_NB_IoT[0];
nulsch_harq = nulsch->harq_process;
nulsch->Msg3_active = 1;
nulsch->Msg3_flag = 1;
nulsch->flag_vars = 1;
nulsch->rnti = nfapi_parameters_rel13->rnti;
nulsch->npusch_format = nfapi_parameters_rel13->nulsch_format;
nulsch->N_srs = nfapi_parameters_rel13->n_srs;
nulsch->C_init = nfapi_parameters_rel13->scrambling_sequence_initialization_cinit;
nulsch->SF_idx = nfapi_parameters_rel13->sf_idx;
nulsch->HARQ_ACK_resource = nfapi_parameters_rel13->nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource;
//nulsch_harq->subcarrier_spacing = nfapi_parameters_rel13->handle; // get from the UL_grant of MSG3
nulsch_harq->subcarrier_indication = nfapi_parameters_rel13->subcarrier_indication; // Isc =0->18 , or 0->47 // format 2, 0->3 or 0->7
nulsch_harq->resource_assignment = nfapi_parameters_rel13->resource_assignment; // valid for format 1 // this should be set by DCI N0 // not used for msg3 // I_RU --> helps to get N_RU
nulsch_harq->mcs = nfapi_parameters_rel13->mcs; // I_mcs = 0->10 (single tone) and 0->12 (multi-tone)
nulsch_harq->rvidx = nfapi_parameters_rel13->redudancy_version; // values = 0 or 1
nulsch_harq->repetition_number = nfapi_parameters_rel13->repetition_number; // // N_rep values = 0->7 // new funciton to be created to compute the nb_slots = f(N_rep)
nulsch_harq->new_data_indication = nfapi_parameters_rel13->new_data_indication; // valid only for DCI N0
nulsch_harq->TBS = nfapi_parameters_rel13->size; /// check if needed *8 or /8 or nothing to do
} else{ // other npusch data
nulsch = eNB->ulsch_NB_IoT[0];
nulsch_harq = nulsch->harq_process;
nulsch->Msg3_active = 1;
nulsch->Msg3_flag = 0;
nulsch->flag_vars = 1;
nulsch->rnti = nfapi_parameters_rel13->rnti;
nulsch->npusch_format = nfapi_parameters_rel13->nulsch_format;
nulsch->N_srs = nfapi_parameters_rel13->n_srs;
nulsch->C_init = nfapi_parameters_rel13->scrambling_sequence_initialization_cinit;
nulsch->SF_idx = nfapi_parameters_rel13->sf_idx;
nulsch->HARQ_ACK_resource = nfapi_parameters_rel13->nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource;
//nulsch_harq->subcarrier_spacing = nfapi_parameters_rel13->handle; // get from the UL_grant of MSG3
nulsch_harq->subcarrier_indication = nfapi_parameters_rel13->subcarrier_indication; // Isc =0->18 , or 0->47 // format 2, 0->3 or 0->7
nulsch_harq->resource_assignment = nfapi_parameters_rel13->resource_assignment; // valid for format 1 // this should be set by DCI N0 // not used for msg3 // I_RU --> helps to get N_RU
nulsch_harq->mcs = nfapi_parameters_rel13->mcs; // I_mcs = 0->10 (single tone) and 0->12 (multi-tone)
nulsch_harq->rvidx = nfapi_parameters_rel13->redudancy_version; // values = 0 or 1
nulsch_harq->repetition_number = nfapi_parameters_rel13->repetition_number; // // N_rep values = 0->7 // new funciton to be created to compute the nb_slots = f(N_rep)
nulsch_harq->new_data_indication = nfapi_parameters_rel13->new_data_indication; // valid only for DCI N0
nulsch_harq->TBS = nfapi_parameters_rel13->size; /// check if needed *8 or /8 or nothing to do
}
//nulsch_harq->rep_tmp = ;
////////////////////////////////////////////////////////////////////////////////////////
LOG_I(PHY,"subframe = %d (TX timing), IF module proceed UL config NULSCH data pdu, will trigger npusch in next subframe\n",subframe);
}else
{
nulsch = eNB->ulsch_NB_IoT[0];
nulsch_harq = nulsch->harq_process;
nulsch->Msg3_active = 1;
nulsch->Msg3_flag = 0;
nulsch->flag_vars = 1;
nulsch->rnti = nfapi_parameters_rel13->rnti;
nulsch->npusch_format = nfapi_parameters_rel13->nulsch_format;
nulsch->N_srs = nfapi_parameters_rel13->n_srs;
nulsch->C_init = nfapi_parameters_rel13->scrambling_sequence_initialization_cinit;
nulsch->SF_idx = nfapi_parameters_rel13->sf_idx;
nulsch->HARQ_ACK_resource = nfapi_parameters_rel13->nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource;
//nulsch_harq->subcarrier_spacing = nfapi_parameters_rel13->handle; // get from the UL_grant of MSG3
nulsch_harq->subcarrier_indication = nfapi_parameters_rel13->nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource; // Isc =0->18 , or 0->47 // format 2, 0->3 or 0->7
nulsch_harq->resource_assignment = nfapi_parameters_rel13->resource_assignment; // valid for format 1 // this should be set by DCI N0 // not used for msg3 // I_RU --> helps to get N_RU
nulsch_harq->mcs = nfapi_parameters_rel13->mcs; // I_mcs = 0->10 (single tone) and 0->12 (multi-tone)
nulsch_harq->rvidx = nfapi_parameters_rel13->redudancy_version; // values = 0 or 1
nulsch_harq->repetition_number = nfapi_parameters_rel13->ue_information.ue_information_rel13.total_number_of_repetitions; // // N_rep values = 0->7 // new funciton to be created to compute the nb_slots = f(N_rep)
nulsch_harq->new_data_indication = nfapi_parameters_rel13->new_data_indication; // valid only for DCI N0
nulsch_harq->TBS = nfapi_parameters_rel13->size; /// check if needed *8 or /8 or nothing to do
LOG_I(PHY,"subframe = %d (TX timing), IF module proceed UL config NULSCH ack pdu, will trigger npusch in next subframe\n",subframe);
}
break;
case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
//TODO just for update the nprach configuration (given at the beginning through phy_config_sib2)
break;
}
}
//XXX problem: although we may have nothing to transmit this function should be always triggered in order to allow the PHY layer to complete the repetitions
//of previous Transport Blocks
//phy_procedures_eNB_TX_NB_IoT(eNB,proc,NULL);
//phy_procedures_eNB_TX_NB_IoT(eNB,proc,0); // check if 0 or NULL ?!
LOG_D(PHY,"Schedule response has been done\n");
}
void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO){
LOG_D(PHY,"[NB-IoT] PHY CONFIG REQ NB-IoT In\n");
if(config_INFO->get_MIB != 0){
//MIB-NB configuration
phy_config_mib_eNB_NB_IoT(config_INFO->mod_id,
config_INFO->CC_id,
config_INFO->cfg->nfapi_config.rf_bands.rf_band[0],//eutraband
config_INFO->cfg->sch_config.physical_cell_id.value,
config_INFO->cfg->subframe_config.dl_cyclic_prefix_type.value,
config_INFO->cfg->subframe_config.ul_cyclic_prefix_type.value,
config_INFO->cfg->rf_config.tx_antenna_ports.value,
config_INFO->cfg->nfapi_config.earfcn.value,
config_INFO->cfg->nb_iot_config.prb_index.value,
config_INFO->cfg->nb_iot_config.operating_mode.value,
config_INFO->cfg->nb_iot_config.control_region_size.value,
config_INFO->cfg->nb_iot_config.assumed_crs_aps.value); //defined only in in-band different PCI
}
if(config_INFO->get_COMMON != 0)
{
//Common Configuration included in SIB2-NB
phy_config_sib2_eNB_NB_IoT(config_INFO->mod_id,
config_INFO->CC_id,
&config_INFO->cfg->nb_iot_config, // FIXME to be evaluated is should be passed a pointer
&config_INFO->cfg->rf_config,
&config_INFO->cfg->uplink_reference_signal_config,
&config_INFO->extra_phy_parms);
}
///FOR FAPI is not specified
if(config_INFO->get_DEDICATED!= 0)
{
//Dedicated Configuration
/*phy_config_dedicated_eNB_NB_IoT(config_INFO->mod_id,
config_INFO->CC_id,
config_INFO->rnti,
&config_INFO->extra_phy_parms);*/
}
LOG_D(PHY,"IF Module for PHY Configuration has been done\n");
}

Some files were not shown because too many files have changed in this diff Show More