Add the CRC check.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7634 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2017-04-07 20:22:46 +00:00
parent b39f92926c
commit 02722a43fd
3 changed files with 31 additions and 1 deletions

View File

@ -327,6 +327,7 @@ set (wsjt_FSRCS
lib/baddata.f90
lib/ccf2.f90
lib/ccf65.f90
lib/fsk4hf/chkcrc10.f90
lib/chkhist.f90
lib/chkmsg.f90
lib/chkss2.f90

27
lib/fsk4hf/chkcrc10.f90 Normal file
View File

@ -0,0 +1,27 @@
subroutine chkcrc10(decoded,nbadcrc)
use crc
integer*1 decoded(60)
integer*1, target:: i1Dec8BitBytes(9)
! Check the CRC
do ibyte=1,6
itmp=0
do ibit=1,8
itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*8+ibit))
enddo
i1Dec8BitBytes(ibyte)=itmp
enddo
i1Dec8BitBytes(7)=decoded(49)*128+decoded(50)*64
! Pack received CRC into bytes 8 and 9 for crc10_check
i1Dec8BitBytes(8)=decoded(51)*2+decoded(52)
i1Dec8BitBytes(9)=decoded(53)*128 + decoded(54)*64+decoded(55)*32 + &
decoded(56)*16
i1Dec8BitBytes(9)=i1Dec8BitBytes(9) + decoded(57)*8+decoded(58)*4 + &
decoded(59)*2+decoded(60)*1
nbadcrc=1
if(crc10_check(c_loc(i1Dec8BitBytes),9)) nbadcrc=0
return
end subroutine chkcrc10

View File

@ -227,7 +227,9 @@ program dbpsksim
apmask=0
max_iterations=10
call bpdecode120(llr,apmask,max_iterations,decoded,niterations,cw)
if(niterations.lt.0 .or. count(msgbits.ne.decoded).gt.0) nfe2=nfe2+1
if(niterations.ge.0) call chkcrc10(decoded,nbadcrc)
if(niterations.lt.0 .or. count(msgbits.ne.decoded).gt.0 .or. &
nbadcrc.ne.0) nfe2=nfe2+1
enddo
fsigma=sqrt(sqf/iters)