From 7b54487b91aa3cadbf0fd195edea936aea652116 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Tue, 26 Jul 2016 23:14:30 +0000 Subject: [PATCH] Change msk32 messages to (32,16) code (no sync word) with 6-bit report and 10-bit hash. No decoder yet. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6952 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/genmsk32.f90 | 42 +++++++++++++++++++++++------------------- lib/ldpc32_table.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 lib/ldpc32_table.c diff --git a/lib/genmsk32.f90 b/lib/genmsk32.f90 index 67fcd929c..ea0578ac7 100644 --- a/lib/genmsk32.f90 +++ b/lib/genmsk32.f90 @@ -2,24 +2,29 @@ subroutine genmsk32(msg,msgsent,ichk,itone,itype) use hashing character*22 msg,msgsent,hashmsg - character*4 crpt,rpt(0:31) + character*4 crpt,rpt(0:63) logical first integer itone(144) - integer ig24(0:4096-1) !Codewords for Golay (24,12) code - integer*1 codeword(24),bitseq(32) + integer ig32(0:65536-1) !Codewords for Golay (24,12) code + integer*1 codeword(32),bitseq(32) integer*1 s8r(8) data s8r/1,0,1,1,0,0,0,1/ - data rpt /'-04 ','-02 ','+00 ','+02 ','+04 ','+06 ','+08 ','+10 ','+12 ', & - '+14 ','+16 ','+18 ','+20 ','+22 ','+24 ', & - 'R-04','R-02','R+00','R+02','R+04','R+06','R+08','R+10','R+12', & - 'R+14','R+16','R+18','R+20','R+22','R+24', & - 'RRR ','73 '/ - data first/.true./ - save first,ig24 + save first,ig32 if(first) then - call golay24_table(ig24) !Define the Golay(24,12) codewords + call ldpc32_table(ig32) !Define the Golay(24,12) codewords + do i=0,30 + if( i.lt.5 ) then + write(rpt(i),'(a1,i2.2,a1)') '-',abs(i-5) + write(rpt(i+31),'(a2,i2.2,a1)') 'R-',abs(i-5) + else + write(rpt(i),'(a1,i2.2,a1)') '+',i-5 + write(rpt(i+31),'(a2,i2.2,a1)') 'R+',i-5 + endif + enddo + rpt(62)='RRR ' + rpt(63)='73 ' first=.false. endif @@ -30,7 +35,7 @@ subroutine genmsk32(msg,msgsent,ichk,itone,itype) if(i1.lt.9) go to 900 call fmtmsg(msg,iz) crpt=msg(i1+2:i1+5) - do i=0,31 + do i=0,63 if(crpt.eq.rpt(i)) go to 10 enddo go to 900 @@ -39,22 +44,21 @@ subroutine genmsk32(msg,msgsent,ichk,itone,itype) if(ichk.lt.10000) then hashmsg=msg(2:i1-1)//' '//crpt call hash(hashmsg,22,ihash) - ihash=iand(ihash,127) !7-bit hash - ig=32*ihash + irpt !12-bit codeword + ihash=iand(ihash,1023) !10-bit hash + ig=64*ihash + irpt !6-bit report else ig=ichk-10000 endif - ncodeword=ig24(ig) + ncodeword=ig32(ig) -! write(*,*) 'codeword is: ',ncodeword,'message is: ',ig,'report index: ',irpt,'hash: ',ihash + write(*,*) 'codeword is: ',ncodeword,'message is: ',ig,'report index: ',irpt,'hash: ',ihash - do i=1,24 + do i=1,32 codeword(i)=iand(1,ishft(ncodeword,1-i)) enddo - bitseq(1:8)=s8r - bitseq(9:32)=codeword + bitseq=codeword bitseq=2*bitseq-1 ! Map I and Q to tones. diff --git a/lib/ldpc32_table.c b/lib/ldpc32_table.c new file mode 100644 index 000000000..3a4beaf45 --- /dev/null +++ b/lib/ldpc32_table.c @@ -0,0 +1,30 @@ +void ldpc32_table_(int cw[]) +{ + // Compute and return the table of 65535 codewords for the (32,16) code. + + // Array y contains the sixteen rows (columns) of the parity-check matrix + int y[16] = { 0xd452, 0x7ecb, 0xc5d5, 0xf81c, + 0x61d7, 0x0ed8, 0xa3c5, 0x9ef9, + 0xb3bd, 0xe5b6, 0x2fcd, 0xc23a, + 0x5deb, 0xfa0e, 0x35fc, 0x1379 }; + + unsigned int c[2]; /* Codeword composed of 16-bit info and 16-bit parity */ + + + int i,j,k; + int aux; + int weight(int vector); + + for(k=0; k<65536; k++) { + c[0] = k; + c[1] = 0; + for (i=0; i<16; i++) { + aux = 0; + for (j=0; j<16; j++) { + aux = aux ^ ((c[0] & y[i]) >> j & 1); + } + c[1] = (c[1] << 1) ^ aux; + } + cw[k]=65536*c[1] + c[0]; + } +}