File: encode174.f90

package info (click to toggle)
wsjtx 2.0.0%2Brepack-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 192,624 kB
  • sloc: cpp: 1,071,838; ansic: 60,751; f90: 25,266; python: 20,318; sh: 10,636; xml: 8,148; cs: 2,121; fortran: 2,051; yacc: 472; asm: 353; makefile: 316; perl: 19
file content (50 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
subroutine encode174(message,codeword)
! Encode an 87-bit message and return a 174-bit codeword. 
! The generator matrix has dimensions (87,87). 
! The code is a (174,87) regular ldpc code with column weight 3.
! The code was generated using the PEG algorithm.
! After creating the codeword, the columns are re-ordered according to 
! "colorder" to make the codeword compatible with the parity-check matrix 
!

include "ldpc_174_87_params.f90"

integer*1 codeword(N)
integer*1 gen(M,K)
integer*1 itmp(N)
integer*1 message(K)
integer*1 pchecks(M)
logical first
data first/.true./

save first,gen

if( first ) then ! fill the generator matrix
  gen=0
  do i=1,M
    do j=1,11
      read(g(i)( (j-1)*2+1:(j-1)*2+2 ),"(Z2)") istr
        do jj=1, 8
          icol=(j-1)*8+jj
          if( icol .le. 87 ) then
            if( btest(istr,8-jj) ) gen(i,icol)=1
          endif
        enddo
    enddo
  enddo
first=.false.
endif

do i=1,M
  nsum=0
  do j=1,K 
    nsum=nsum+message(j)*gen(i,j)
  enddo
  pchecks(i)=mod(nsum,2)
enddo
itmp(1:M)=pchecks
itmp(M+1:N)=message(1:K)
codeword(colorder+1)=itmp(1:N)

return
end subroutine encode174