Commit cea4ef53 authored by laurent's avatar laurent

generate sss tables

parent 16314f04
......@@ -1108,6 +1108,7 @@ set(PHY_SRC
# actual source
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss_gen.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
......@@ -1147,6 +1148,7 @@ set(PHY_SRC_RU
set(PHY_SRC_UE
# actual source
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/sss_ue.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss_gen.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <math.h>
int16_t *d0_sss;
int16_t *d5_sss;
#define MyAssert(x) { if(!(x)) { printf("Error in table intialization: %s:%d\n",__FILE__,__LINE__); exit(1);}}
#define gen(table, formula) { \
int x[31]= {0}; \
x[4]=1; \
for(int i=0; i<26; i++) \
x[i+5]=formula; \
for (int i=0; i<31; i++) \
table[i]=1-2*x[i]; \
}
#define mod31(a) (a)%31
#define mod2(a) (a)%2
#define mod8(a) (a)%8
__attribute__((constructor)) static void init_sss(void) {
MyAssert(0==posix_memalign((void **)&d0_sss, 16,504*31*2*sizeof(*d0_sss)));
MyAssert(0==posix_memalign((void **)&d5_sss, 16,504*31*2*sizeof(*d5_sss)));
int s[31];
gen(s, mod2(x[i+2]+x[i]));
int z[31];
gen(z, mod2(x[i+4]+x[i+2]+x[i+1]+x[i]));
int c[31];
gen(c, mod2(x[i+3]+x[i]));
for (int Nid2=0; Nid2<3; Nid2++) {
for (int Nid1=0; Nid1<168; Nid1++) {
int qprime = Nid1/30;
int q = (Nid1+(qprime*(qprime+1))/2)/30;
int mprime = Nid1 + q*(q+1)/2;
int m0 = mprime%31;
int m1 = (m0+mprime/31+1)%31;
int rowIndex=(Nid2+3*Nid1)*31*2;
for (int i=0; i<31; i++) {
d0_sss[rowIndex+i*2]= s[mod31(i+m0)] * c[mod31(i+Nid2)];
d5_sss[rowIndex+i*2]= s[mod31(i+m1)] * c[mod31(i+Nid2)];
d0_sss[rowIndex+i*2+1]= s[mod31(i+m1)] * c[mod31(i+Nid2+3)] * z[mod31(i+mod8(m0))];
d5_sss[rowIndex+i*2+1]= s[mod31(i+m0)] * c[mod31(i+Nid2+3)] * z[mod31(i+mod8(m1))];
}
}
}
}
#ifdef SSS_TABLES_TEST
void main () {
printf("int16_t d0_sss[504*62] = {");
for (int i=0; i<504*62; i++)
printf("%d,\n",d0_sss[i]);
printf("};\n\n");
printf("int16_t d5_sss[504*62] = {");
for (int i=0; i<504*62; i++)
printf("%d,\n",d5_sss[i]);
printf("};\n\n");
}
#endif
% generate s
x = zeros(1,30);
x(1:5) = [0 0 0 0 1];
for i=1:26
x(i+5) = rem(x(i+2) + x(i),2);
end
s = 1 - 2*x;
% generate z
x = zeros(1,30);
x(1:5) = [0 0 0 0 1];
for i=1:26
x(i+5) = rem(x(i+4)+ x(i+2) + x(i+1) + x(i),2);
end
z = 1 - 2*x;
% generate c
x = zeros(1,30);
x(1:5) = [0 0 0 0 1];
for i=1:26
x(i+5) = rem(x(i+3) + x(i),2);
end
c = 1 - 2*x;
d0 = zeros(504,62);
d5 = zeros(504,62);
for Nid2=0:2,
c0 = [c((1+Nid2) : end) c(1:Nid2)];
c1 = [c((4+Nid2) : end) c(1:(3+Nid2))];
for Nid1=0:167,
qprime = floor(Nid1/30);
q = floor((Nid1+qprime*(qprime+1)/2)/30);
mprime = Nid1 + q*(q+1)/2;
m0 = rem(mprime,31);
m1 = rem(m0+floor(mprime/31)+1,31);
sm0 = [s((1+m0) : end) s(1:m0)];
sm1 = [s((1+m1) : end) s(1:m1)];
m0mod8 = rem(m0,8);
m1mod8 = rem(m1,8);
zm0 = [z((1+m0mod8) : end) z(1:m0mod8)];
zm1 = [z((1+m1mod8) : end) z(1:m1mod8)];
d0(1+Nid2+(3*Nid1),1:2:62) = sm0.*c0;
d5(1+Nid2+(3*Nid1),1:2:62) = sm1.*c0;
d0(1+Nid2+(3*Nid1),2:2:62) = sm1.*c1.*zm0;
d5(1+Nid2+(3*Nid1),2:2:62) = sm0.*c1.*zm1;
end
end
fd = fopen("sss.h","w");
fprintf(fd,"s16 d0_sss[504*62] = {");
fprintf(fd,"%d,",d0);
fprintf(fd,"};\n\n");
fprintf(fd,"s16 d5_sss[504*62] = {");
fprintf(fd,"%d,",d5);
fprintf(fd,"};\n\n");
fclose(fd);
\ No newline at end of file
......@@ -44,7 +44,7 @@ extern unsigned short scfdma_amps[26];
extern char dci_format_strings[15][13];
extern int16_t d0_sss[504*62],d5_sss[504*62];
extern int16_t *d0_sss,*d5_sss;
extern uint8_t wACK[5][4];
extern int8_t wACK_RX[5][4];
......
......@@ -21,7 +21,6 @@
#include "dlsch_tbs.h"
//#include "dlsch_tbs_full.h"
#include "sss.h"
unsigned short lte_cqi_eff1024[16] = {156, //-6, .15234
240, //-4 .234
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment