msksim.f90 is being used to learn how to call ldpc encode/decode C routines. nothing works yet.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6485 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2016-02-23 02:39:36 +00:00
parent 03656e17e5
commit c5d044712e
6 changed files with 72 additions and 1 deletions

View File

@ -70,7 +70,6 @@ progs: modules
$(LINK) verify.o mod2sparse.o mod2dense.o mod2convert.o check.o \
rcode.o alloc.o intio.o blockio.o open.o -lm -o verify
# MAKE THE TEST PROGRAMS. First makes the modules used.
tests: modules

39
lib/ldpc/Makefile.msk_osx Normal file
View File

@ -0,0 +1,39 @@
# Compilers
CC = gcc
CXX = g++
FC = gfortran
AR = ar cr
RANLIB = ranlib
MKDIR = mkdir -p
CP = cp
RM = rm -f
FFLAGS = -O2 -fbounds-check -Wall -Wno-conversion
CFLAGS = -O2 -I.
# Default rules
%.o: %.c
${CC} ${CFLAGS} -c $<
%.o: %.f
${FC} ${FFLAGS} -c $<
%.o: %.F
${FC} ${FFLAGS} -c $<
%.o: %.f90
${FC} ${FFLAGS} -c $<
%.o: %.F90
${FC} ${FFLAGS} -c $<
all: msksim
OBJS = msksim.o alloc.o rcode.o channel.o dec.o enc.o \
intio.o blockio.o check.o open.o mod2dense.o \
mod2sparse.o mod2convert.o distrib.o rand.o
msksim: $(OBJS)
$(FC) -o msksim $(OBJS)
rand.o:
$(CC) -DRAND_FILE=\"`pwd`/randfile\" rand.c
clean:
$(RM) *.o msksim

View File

@ -383,3 +383,9 @@ void iterprp
}
}
}
void ldpc_decode_ ( mod2sparse *H, double *lratio, char *dblk, char *pchk, double *bprb )
{
int n;
n = prprp_decode ( H, lratio, dblk, pchk, bprb );
}

View File

@ -152,3 +152,12 @@ void mixed_encode
{ cblk[cols[j]] = mod2dense_get(v,j,0);
}
}
// Wrapper for calling sparse_encode from fortran
void ldpc_encode_(
char msg[72],
char cdw[128]
){
sparse_encode(msg,cdw);
}

View File

@ -16,3 +16,4 @@
void sparse_encode (char *, char *);
void dense_encode (char *, char *, mod2dense *, mod2dense *);
void mixed_encode (char *, char *, mod2dense *, mod2dense *);
void ldpc_encode_ (char *, char *);

View File

@ -198,3 +198,20 @@ garbled:
fprintf(stderr,"Garbled generator matrix in file %s\n",gen_file);
exit(1);
}
// Fortran interface routine
void init_ldpc_ ( )
{
char *pchk_file,*gen_file;
pchk_file="./jtmode_codes/ldpc-128-82-sf11.pchk";
gen_file="./jtmode_codes/ldpc-128-82-sf11.gen";
printf("pchk_file %s\n",pchk_file);
printf("gen_file %s\n",gen_file);
read_pchk( pchk_file );
read_gen( gen_file, 0, 0 );
printf("N %d M %d\n",N,M);
}