From 8307ae5b5d67b86549422f3bbf9f85c117d99bae Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Wed, 14 Jun 2017 15:59:36 +0000 Subject: [PATCH] Fix some bugs. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7714 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/fsk4hf/bpdecode174.f90 | 5 +- lib/fsk4hf/ldpc_174_87_params.f90 | 141 +++++++++++++++--------------- lib/fsk4hf/ldpcsim174.f90 | 12 ++- lib/fsk4hf/osd174.f90 | 4 +- 4 files changed, 79 insertions(+), 83 deletions(-) diff --git a/lib/fsk4hf/bpdecode174.f90 b/lib/fsk4hf/bpdecode174.f90 index 334f88f2c..cf3f62bff 100644 --- a/lib/fsk4hf/bpdecode174.f90 +++ b/lib/fsk4hf/bpdecode174.f90 @@ -309,7 +309,6 @@ ncw=3 toc=0 tov=0 tanhtoc=0 -!write(*,*) llr ! initialize messages to checks do j=1,M do i=1,nrw(j) @@ -337,9 +336,9 @@ do iter=0,maxiterations do i=1,M synd(i)=sum(cw(Nm(1:nrw(i),i))) if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1 -! if( mod(synd(i),2) .ne. 0 ) write(*,*) 'check ',i,' unsatisfied' +! if( mod(synd(i),2) .ne. 0 ) write(*,*) 'check ',i,' unsatisfied' enddo -!write(*,*) 'number of unsatisfied parity checks ',ncheck +! write(*,*) 'number of unsatisfied parity checks ',ncheck if( ncheck .eq. 0 ) then ! we have a codeword - reorder the columns and return it ! niterations=iter codeword=cw(colorder+1) diff --git a/lib/fsk4hf/ldpc_174_87_params.f90 b/lib/fsk4hf/ldpc_174_87_params.f90 index 08ee971e7..35af9b815 100644 --- a/lib/fsk4hf/ldpc_174_87_params.f90 +++ b/lib/fsk4hf/ldpc_174_87_params.f90 @@ -2,94 +2,93 @@ integer, parameter:: N=174, K=87, M=N-K character*22 g(87) integer colorder(N) data g/ & !parity generator matrix for (174,87) code -"23bba830e23b6b6f509828", & -"1f8e55da218c5df3309050", & +"23bba830e23b6b6f50982e", & +"1f8e55da218c5df3309052", & "ca7b3217cd92bd59a5ae20", & -"56f78313537d0f43829648", & -"29c29dba9c545e267762f8", & -"6be396b5e2e819e3733408", & +"56f78313537d0f4382964e", & +"29c29dba9c545e267762fe", & +"6be396b5e2e819e373340c", & "293548a138858328af4210", & -"cb6c6afcdc28bb3f7c6e80", & +"cb6c6afcdc28bb3f7c6e86", & "3f2a86f5c5bd225c961150", & -"849dd2d63673481860f628", & -"56cdaec6e7ae14b43feee8", & -"04ef5cfa3766ba778f45a0", & -"c525ae4bd4f627320a3970", & -"fe37802941d66dde02b998", & -"41fd9520b2e4abeb2f9898", & -"40907b01280f03c0323940", & -"7fb36c24085a34d8c1dbc0", & -"40fc3e44bb7d2bb2756e40", & -"d38ab0a1d2e52a8ec3bc70", & -"3d0f929ef3949bd84d4730", & -"45d3814f504064f80549a8", & -"f14dbf263825d0bd04b058", & +"849dd2d63673481860f62c", & +"56cdaec6e7ae14b43feeee", & +"04ef5cfa3766ba778f45a4", & +"c525ae4bd4f627320a3974", & +"fe37802941d66dde02b99c", & +"41fd9520b2e4abeb2f989c", & +"40907b01280f03c0323946", & +"7fb36c24085a34d8c1dbc4", & +"40fc3e44bb7d2bb2756e44", & +"d38ab0a1d2e52a8ec3bc76", & +"3d0f929ef3949bd84d4734", & +"45d3814f504064f80549ae", & +"f14dbf263825d0bd04b05e", & "f08a91fb2e1f78290619a8", & -"7a8dec79a51e8ac5388020", & -"ca4186dd44c3121565cf58", & -"db714f8f64e8ac7af1a768", & +"7a8dec79a51e8ac5388022", & +"ca4186dd44c3121565cf5c", & +"db714f8f64e8ac7af1a76e", & "8d0274de71e7c1a8055eb0", & -"51f81573dd4049b082de10", & +"51f81573dd4049b082de14", & "d037db825175d851f3af00", & "d8f937f31822e57c562370", & -"1bf1490607c54032660ed8", & -"1616d78018d0b4745ca0f0", & -"a9fa8e50bcb032c85e3300", & -"83f640f1a48a8ebc0443e8", & -"eca9afa0f6b01d92305ed8", & -"3776af54ccfbae916afde0", & -"6abb212d9739dfc02580f0", & +"1bf1490607c54032660ede", & +"1616d78018d0b4745ca0f2", & +"a9fa8e50bcb032c85e3304", & +"83f640f1a48a8ebc0443ea", & +"eca9afa0f6b01d92305edc", & +"3776af54ccfbae916afde6", & +"6abb212d9739dfc02580f2", & "05209a0abb530b9e7e34b0", & -"612f63acc025b6ab476f78", & -"0af7723161ec223080be80", & +"612f63acc025b6ab476f7c", & +"0af7723161ec223080be86", & "a8fc906976c35669e79ce0", & -"45b7ab6242b77474d9f118", & -"b274db8abd3c6f396ea350", & -"9059dfa2bb20ef7ef73ad0", & -"3d188ea477f6fa41317a48", & -"8d9071b7e7a6a2eed69658", & -"a377253773ea678367c3f0", & -"ecbd7c73b9cd34c3720c88", & -"b6537f417e61d1a7085330", & -"6c280d2a0523d9c4bc5940", & +"45b7ab6242b77474d9f11a", & +"b274db8abd3c6f396ea356", & +"9059dfa2bb20ef7ef73ad4", & +"3d188ea477f6fa41317a4e", & +"8d9071b7e7a6a2eed6965e", & +"a377253773ea678367c3f6", & +"ecbd7c73b9cd34c3720c8a", & +"b6537f417e61d1a7085336", & +"6c280d2a0523d9c4bc5946", & "d36d662a69ae24b74dcbd8", & -"d747bfc5fd65ef70fbd9b8", & -"a9fa2eefa6f8796a355770", & -"cc9da55fe046d0cb3a7708", & -"f6ad4824b87c80ebfce460", & -"cc6de59755420925f90ed0", & -"164cc861bdd803c547f2a8", & -"c0fc3ec4fb7d2bb2756640", & -"0dbd816fba1543f721dc70", & -"a0c0033a52ab6299802fd0", & +"d747bfc5fd65ef70fbd9bc", & +"a9fa2eefa6f8796a355772", & +"cc9da55fe046d0cb3a770c", & +"f6ad4824b87c80ebfce466", & +"cc6de59755420925f90ed2", & +"164cc861bdd803c547f2ac", & +"c0fc3ec4fb7d2bb2756644", & +"0dbd816fba1543f721dc72", & +"a0c0033a52ab6299802fd2", & "bf4f56e073271f6ab4bf80", & "57da6d13cb96a7689b2790", & -"81cfc6f18c35b1e1f17110", & -"481a2a0df8a23583f82d68", & -"1ac4672b549cd6dba79bc8", & +"81cfc6f18c35b1e1f17114", & +"481a2a0df8a23583f82d6c", & +"1ac4672b549cd6dba79bcc", & "c87af9a5d5206abca532a8", & "97d4169cb33e7435718d90", & -"a6573f3dc8b16c9d19f740", & -"2c4142bf42b01e71076ac8", & -"081c29a10d468ccdbcecb0", & -"5b0f7742bca86b80126098", & -"012dee2198eba82b19a1d8", & -"f1627701a2d692fd9449e0", & -"35ad3fb0faeb5f1b0c30d8", & -"b1ca4ea2e3d173bad43798", & -"37d8e0af9258b9e8c5f9b0", & -"cd921fdf59e882683763f0", & -"6114e08483043fd3f38a88", & -"2e547dd7a05f6597aac510", & -"95e45ecd0135aca9d6e6a8", & +"a6573f3dc8b16c9d19f746", & +"2c4142bf42b01e71076acc", & +"081c29a10d468ccdbcecb6", & +"5b0f7742bca86b8012609a", & +"012dee2198eba82b19a1da", & +"f1627701a2d692fd9449e6", & +"35ad3fb0faeb5f1b0c30dc", & +"b1ca4ea2e3d173bad4379c", & +"37d8e0af9258b9e8c5f9b2", & +"cd921fdf59e882683763f6", & +"6114e08483043fd3f38a8a", & +"2e547dd7a05f6597aac516", & +"95e45ecd0135aca9d6e6ae", & "b33ec97be83ce413f9acc8", & -"c8b5dffc335095dcdcaf28", & -"3dd01a59d86310743ec750", & -"14cd0f642fc0c5fe3a65c8", & +"c8b5dffc335095dcdcaf2a", & +"3dd01a59d86310743ec752", & +"14cd0f642fc0c5fe3a65ca", & "3a0a1dfd7eee29c2e827e0", & "8abdb889efbe39a510a118", & -"3f231f212055371cf3e2a0"/ - +"3f231f212055371cf3e2a2"/ data colorder/ & 0, 1, 2, 3, 30, 4, 5, 6, 7, 8, 9, 10, 11, 32, 12, 40, 13, 14, 15, 16,& 17, 18, 37, 45, 29, 19, 20, 21, 41, 22, 42, 31, 33, 34, 44, 35, 47, 51, 50, 43,& diff --git a/lib/fsk4hf/ldpcsim174.f90 b/lib/fsk4hf/ldpcsim174.f90 index 57486eb77..c8b260f61 100644 --- a/lib/fsk4hf/ldpcsim174.f90 +++ b/lib/fsk4hf/ldpcsim174.f90 @@ -69,8 +69,8 @@ write(*,*) "niter= ",max_iterations," s= ",s allocate ( codeword(N), decoded(K), message(K) ) allocate ( rxdata(N), llr(N) ) -! msg="K1JT K9AN EN50" - msg="G4WJS K9AN EN50" + msg="K1JT K9AN EN50" +! msg="G4WJS K9AN EN50" call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent write(*,*) "message sent ",msgsent @@ -182,10 +182,10 @@ do idb = 14,-6,-1 endif llr=2.0*rxdata/(ss*ss) - nap=0 ! number of AP bits - llr(colorder(174-87+1:174-87+nap)+1)=5*(2.0*msgbits(1:nap)-1.0) +! nap=0 ! number of AP bits +! llr(colorder(174-87+1:174-87+nap)+1)=5*(2.0*msgbits(1:nap)-1.0) apmask=0 - apmask(colorder(174-87+1:174-87+nap)+1)=1 +! apmask(colorder(174-87+1:174-87+nap)+1)=1 ! max_iterations is max number of belief propagation iterations call bpdecode174(llr, apmask, max_iterations, decoded, niterations) @@ -236,6 +236,4 @@ do i=1,87 enddo close(25) - - end program ldpcsim174 diff --git a/lib/fsk4hf/osd174.f90 b/lib/fsk4hf/osd174.f90 index 6fcee3c61..da979eeba 100644 --- a/lib/fsk4hf/osd174.f90 +++ b/lib/fsk4hf/osd174.f90 @@ -24,7 +24,7 @@ save first,gen if( first ) then ! fill the generator matrix gen=0 do i=1,M - do j=1,21 + do j=1,22 read(g(i)(j:j),"(Z1)") istr do jj=1, 4 irow=(j-1)*4+jj @@ -139,7 +139,7 @@ nt=nt+1 i2min=i2 i3min=i3 i4min=i4 - if( nhardmin .le. 5 ) goto 200 ! early exit - tune for each code + if( nhardmin .le. 15 ) goto 200 ! early exit - tune for each code endif enddo enddo