URL
https://opencores.org/ocsvn/pcie_ds_dma/pcie_ds_dma/trunk
Subversion Repositories pcie_ds_dma
[/] [pcie_ds_dma/] [trunk/] [soft/] [linux/] [common/] [utils/] [tf_testbufm2.cpp] - Rev 41
Go to most recent revision | Compare with Previous | Blame | View Log
/** \file \brief Π€ΡΠ½ΠΊΡΠΈΠΈ ΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΈ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ ΠΌΠ°ΡΡΠΈΠ²Π° Π΄Π°Π½Π½ΡΡ Π ΡΠ°ΠΉΠ»Π΅ ΡΠΎΠ΄Π΅ΡΠΆΠΈΡΡΡ ΡΠ΅Π°Π»ΠΈΠ·Π°ΡΠΈΡ ΠΊΠ»Π°ΡΡΠ° TF_TestBufM2 - ΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΈ ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° ΠΌΠ°ΡΡΠΈΠ²Π° Π΄Π°Π½Π½ΡΡ . \author Dmitry Smekhov \version 1.0 */ #include <stdio.h> #include "utypes.h" #include "tf_testbufm2.h" //! ΠΠΎΠ½ΡΡΡΡΠΊΡΠΎΡ TF_TestBufM2::TF_TestBufM2() { } //! ΠΠ΅ΡΡΡΡΠΊΡΠΎΡ TF_TestBufM2::~TF_TestBufM2() { } //! Π€ΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π° /** Π€ΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡ ΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π°. ΠΠ»Π³ΠΎΡΠΈΡΠΌ ΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΡ Π·Π°Π²ΠΈΡΠΈΡ ΠΎΡ Π½ΠΎΠΌΠ΅ΡΠ° n. \param buf - ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΌΠ°ΡΡΠΈΠ² \param n - Π½ΠΎΠΌΠ΅Ρ Π±Π»ΠΎΠΊΠ° \param size - ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° \param mode - ΡΠ΅ΠΆΠΈΠΌ Π·Π°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ Π±ΠΈΡ 7=1 - ΡΠΈΠΊΡΠΈΡΠΎΠ²Π°Π½Π½ΡΠΉ ΡΠΈΠΏ Π±Π»ΠΎΠΊΠ°, 11..8 - ΡΠΈΠΏ Π±Π»ΠΎΠΊΠ° */ void TF_TestBufM2::buf_set( U32 *buf, U32 n, U32 size, U32 mode ) { // n%100 - ΡΠΈΠΏ Π±Π»ΠΎΠΊΠ° U32 ii; __int64 *ptr=(__int64*)buf; U32 size64 = size/2; __int64 data_ex = 0ULL; __int64 data_sig = 0ULL; __int64 data_ex1 = 0ULL; __int64 data_ex2 = 0ULL; data_sig = n; if( mode & 0x80 ) { block_mode=(mode>>8)&0xF; data_sig = n; } data_sig <<=32; data_sig |=0xA5A50123; *ptr++ = data_sig; //data_in = *ptr++; switch( block_mode ) { case 0: data_ex = 1; break; case 1: data_ex = ~1; break; case 2: data_ex = 1; break; case 3: data_ex = ~1; break; case 4: data_ex = 1; data_ex2=0; break; case 5: data_ex = ~1; data_ex2=0xFFFFFFFFFFFFFFFFULL; break; case 6: case 7: data_ex = data_ex_cnt; break; case 8: case 9: data_ex = data_ex_noise; break; } switch( block_mode ) { case 0: case 1: for( ii=1; ii<size64; ii++ ) { //data_in=*ptr++; *ptr++=data_ex; { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } } break; case 2: case 3: //data_in=*ptr++; *ptr++=(~data_ex); { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } for( ii=2; ii<size64; ii+=2 ) { //data_in=*ptr++; *ptr++=data_ex; *ptr++=~data_ex; { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } } break; case 4: case 5: { int flag; for( ii=1; ii<size64; ii++ ) { flag=( (n & 0xFF)==(ii&0xFF) )? 1 : 0; //data_in=*ptr++; data_ex1 = ( flag ) ? data_ex : data_ex2; *ptr++=data_ex1; if( flag ) { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } } } break; case 6: case 7: //data_in=*ptr++; *ptr++=~data_ex; //if( (~data_ex)!=data_in ) //{ // cnt_err+=check( 1, ~data_ex, data_in ); //} data_ex++; for( ii=2; ii<size64; ii+=2 ) { //data_in=*ptr++; *ptr++=data_ex; *ptr++=~data_ex; data_ex++; } data_ex_cnt = data_ex; break; case 8: case 9: { /* //__int64 f63; //__int64 f62; //__int64 f60; //__int64 f59; //__int64 f0; U32 data_h; U32 f63; U32 f62; U32 f60; U32 f59; U32 f0; */ for( ii=1; ii<size64; ii++ ) { //data_in=*ptr++; *ptr++=data_ex; {/* f63 = data_ex >> 63; f62 = data_ex >> 62; f60 = data_ex >> 60; f59 = data_ex >> 59; f0 = (f63 ^ f62 ^ f60 ^ f59)&1; */ U32 data_h=data_ex>>32; U32 f63 = data_h >> 31; U32 f62 = data_h >> 30; U32 f60 = data_h >> 28; U32 f59 = data_h >> 27; U32 f0 = (f63 ^ f62 ^ f60 ^ f59)&1; //U32 data_l=data_ex; //U32 f31 = (data_l>>31) & 1; //data_l<<=1; //data_l&=~1; //data_l|=f0; //data_h<<=1; //data_h&=~1; //data_h|=f31; //data_ex=data_h; //data_ex<<=32; //data_ex|=data_l; data_ex <<= 1; data_ex &= ~1; data_ex |=f0; } } } data_ex_noise = data_ex; break; } block_mode++; if( block_mode==10 ) block_mode=0; buf_current++; } //! ΠΡΠΎΠ²Π΅ΡΠΊΠ° ΠΎΡΠ΅ΡΠ΅Π΄Π½ΠΎΠ³ΠΎ ΡΠ»ΠΎΠ²Π° Π΄Π°Π½Π½ΡΡ /** Π€ΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡ ΠΏΡΠΎΠ²Π΅ΡΠΊΡ ΠΎΡΠ΅ΡΠ΅Π΄Π½ΠΎΠ³ΠΎ ΡΠ»ΠΎΠ²Π° Π΄Π°Π½Π½ΡΡ . ΠΡΠΈ Π½Π΅ΡΠΎΠ²ΠΏΠ°Π΄Π΅Π½ΠΈΠΈ ΠΎΠΆΠΈΠ΄Π°Π΅ΠΌΠΎΠ³ΠΎ ΠΈ ΠΏΡΠΈΠ½ΡΡΠΎΠ³ΠΎ ΡΠ»ΠΎΠ²Π° ΡΡΠ½ΠΊΡΠΈΡ Π·Π°ΠΏΠΈΡΡΠ²Π°Π΅Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ Π² ΠΌΠ°ΡΡΠΈΠ² word_error (Π΄Π»Ρ ΠΏΠ΅ΡΠ²ΡΡ ΠΎΡΠΈΠ±ΠΎΠΊ - Π½Π΅ Π±ΠΎΠ»Π΅Π΅ ΡΠ΅ΠΌ Π΄Π»Ρ max_cnt_error) ΠΈ ΡΠΎΡΠΌΠΈΡΡΠ΅Ρ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ. \param index ΠΠΎΠΌΠ΅Ρ ΡΠ»ΠΎΠ²Π° Π² ΠΌΠ°ΡΡΠΈΠ²Π΅ \param d0 ΠΠΆΠΈΠ΄Π°Π΅ΠΌΡΠ΅ ΡΠ΄ΠΎΠ²ΠΎ \param di0 ΠΡΠΈΠ½ΡΡΠΎΠ΅ ΡΠ»ΠΎΠ²ΠΎ \return 1 - Π΅ΡΡΡ ΠΎΡΠΈΠ±ΠΊΠ°, 0 - Π½Π΅Ρ ΠΎΡΠΈΠ±ΠΊΠΈ */ inline U32 TF_TestBufM2::check( U32 index, __int64 d0, __int64 di0 ) { U32 flag_error=0; //if( d0!=di0 ) { flag_error=1; // ΠΠ°ΠΏΠΈΡΡ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΠΈ ΠΎΠ± ΠΎΡΠΈΠ±ΠΊΠ΅ if( word_cnt_error<max_cnt_error ) { word_error[ word_cnt_error*4+0 ]=buf_current; word_error[ word_cnt_error*4+1 ]=index; word_error[ word_cnt_error*4+2 ]=d0; word_error[ word_cnt_error*4+3 ]=di0; } word_cnt_error++; /* if( max_bit_cnt>0 ) { // ΠΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ U32 jj; U32 mask=1; for( jj=0; jj<32; jj++ ) { if( (d0&mask)!=(di0&mask) ) { if( max_bit_cnt<=32 ) { if( (di0&mask)==0 ) bit_error0[jj%max_bit_cnt]++; else bit_error1[jj%max_bit_cnt]++; } else { if( (di0&mask)==0 ) bit_error0[jj+32*(index&1)]++; else bit_error1[jj+32*(index&1)]++; } } } } */ } return flag_error; } //! ΠΡΠΎΠ²Π΅ΡΠΊΠ° ΠΌΠ°ΡΡΠΈΠ²Π° /** Π€ΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΎΠ²Π΅ΡΡΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ² buf Π½Π° ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΠ΅ ΠΎΠΆΠΈΠ΄Π°Π΅ΠΌΡΠΌ Π΄Π°Π½Π½ΡΠΌ. ΠΠ°ΡΡΠΈΠ² Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΡΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ ΡΡΠ½ΠΊΡΠΈΠ΅ΠΉ buf_set ΠΈΠ»ΠΈ Π°Π½Π°Π»ΠΎΠ³ΠΈΡΠ½ΠΎΠΉ ΠΡΠΈ ΠΎΠ±Π½Π°ΡΡΠΆΠ΅Π½ΠΈΠΈ ΠΎΡΠΈΠ±ΠΊΠΈ Π² ΠΌΠ°ΡΡΠΈΠ² word_error Π·Π°ΠΏΠΈΡΡΠ²Π°ΡΡΡΡ ΡΠ΅ΡΡΡΠ΅ ΡΠΈΡΠ»Π°: - Π½ΠΎΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° - ΠΈΠ½Π΄Π΅ΠΊΡ Π² ΠΌΠ°ΡΡΠΈΠ²ΠΊ - ΠΎΠΆΠΈΠ΄Π°Π΅ΠΌΡΠ΅ Π΄Π°Π½Π½ΡΠ΅ - ΠΏΠΎΠ»ΡΡΠ΅Π½Π½ΡΠ΅ Π΄Π°Π½Π½ΡΠ΅ Π ΠΌΠ°ΡΡΠΈΠ²Ρ bit_error0 ΠΈ bit_error1 Π·Π°Π½ΠΎΡΠΈΡΡΡ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ. \param buf - ΠΠ΄ΡΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° \param n - ΠΠΎΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° \param size - Π Π°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° Π² 32-Ρ ΡΠ°Π·ΡΡΠ΄Π½ΡΡ ΡΠ»ΠΎΠ²Π°Ρ \param mode - Π Π΅ΠΆΠΈΠΌ ΡΠΎΡΠΌΠΈΡΠ²ΠΎΠ°Π½ΠΈΡ Π±Π»ΠΎΠΊΠ°: Π±ΠΈΡ 7=1 - ΠΏΡΠΈΠ·Π½Π°ΠΊ ΠΏΡΠΈΠ½ΡΠ΄ΠΈΡΠ΅Π»ΡΠ½ΠΎΠΉ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠΈ, 11..8 - ΡΠΈΠΏ \return Π§ΠΈΡΠ»ΠΎ ΠΎΠ±Π½Π°ΡΡΠΆΠ΅Π½Π½ΡΡ ΠΎΡΠΈΠ±ΠΎΠΊ */ U32 TF_TestBufM2::buf_check( U32 *buf, U32 n, U32 size, U32 mode ) { // n%100 - ΡΠΈΠΏ Π±Π»ΠΎΠΊΠ° U32 ii; U32 cnt_err=0; __int64 *ptr=(__int64*)buf; U32 size64 = size/2; __int64 data_ex = 0ULL; __int64 data_in = 0ULL; __int64 data_sig = 0ULL; __int64 data_ex1 = 0ULL; __int64 data_ex2 = 0ULL; data_sig = n; if( mode & 0x80 ) { block_mode=(mode>>8)&0xF; data_sig = n; } data_sig <<=32; data_sig |=0xA5A50123; data_in = *ptr++; if( data_sig!=data_in ) { cnt_err+=check( 0, data_sig, data_in ); } /* when "0000" => -- ΠΠ΅Π³ΡΡΠ°Ρ 1 ΠΏΠΎ 64-ΠΌ ΡΠ°Π·ΡΡΠ΄Π°ΠΌ data_ex0 <= x"0000000000000001" after 1 ns; when "0001" => -- ΠΠ΅Π³ΡΡΠΈΠΉ 0 ΠΏΠΎ 64-ΠΌ ΡΠ°Π·ΡΡΠ΄Π°ΠΌ data_ex0 <= not x"0000000000000001" after 1 ns; when "0010" => -- ΠΠ΅Π³ΡΡΠ°Ρ 1 Ρ ΠΈΠ½Π²Π΅ΡΡΠΈΠ΅ΠΉ ΠΏΠΎ 64-ΠΌ ΡΠ°Π·ΡΡΠ΄Π°ΠΌ data_ex1 <= x"0000000000000001" after 1 ns; when "0011" => -- ΠΠ΅Π³ΡΡΠΈΠΉ 0 Ρ ΠΈΠ½Π²Π΅ΡΡΠΈΠ΅ΠΉ ΠΏΠΎ 64-ΠΌ ΡΠ°Π·ΡΡΠ΄Π°ΠΌ data_ex1 <= not x"0000000000000001" after 1 ns; when "0100" => -- ΠΠ΅Π³ΡΡΠ°Ρ 1 Π² Π±Π»ΠΎΠΊΠ΅ 0 data_ex2 <= x"0000000000000001" after 1 ns; data_ex3 <= (others=>'0'); when "0101" => -- ΠΠ΅Π³ΡΡΠΈΠΉ 0 Π² Π±Π»ΠΎΠΊΠ΅ 1 data_ex2 <= not x"0000000000000001" after 1 ns; data_ex3 <= (others=>'1') after 1 ns; */ switch( block_mode ) { case 0: data_ex = 1; break; case 1: data_ex = ~1; break; case 2: data_ex = 1; break; case 3: data_ex = ~1; break; case 4: data_ex = 1; data_ex2=0; break; case 5: data_ex = ~1; data_ex2=0xFFFFFFFFFFFFFFFFULL; break; case 6: case 7: data_ex = data_ex_cnt; break; case 8: case 9: data_ex = data_ex_noise; break; } switch( block_mode ) { case 0: case 1: for( ii=1; ii<size64; ii++ ) { data_in=*ptr++; if( data_ex!=data_in ) { cnt_err+=check( ii, data_ex, data_in ); //cnt_err=0; } { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } } break; case 2: case 3: data_in=*ptr++; if( (~data_ex)!=data_in ) { cnt_err+=check( 1, ~data_ex, data_in ); } { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } for( ii=2; ii<size64; ii+=2 ) { data_in=*ptr++; if( data_ex!=data_in ) { cnt_err+=check( ii, data_ex, data_in ); //cnt_err=0; } data_in=*ptr++; if( (~data_ex)!=data_in ) { cnt_err+=check( ii+1, ~data_ex, data_in ); } { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } } break; case 4: case 5: { int flag; for( ii=1; ii<size64; ii++ ) { flag=( (n & 0xFF)==(ii&0xFF) )? 1 : 0; data_in=*ptr++; data_ex1 = ( flag ) ? data_ex : data_ex2; if( data_ex1!=data_in ) { cnt_err+=check( ii, data_ex1, data_in ); //cnt_err=0; } if( flag ) { U32 f= (data_ex & 0x8000000000000000ULL) ? 1:0; data_ex <<= 1; data_ex &=~1; data_ex |=f; } } } break; case 6: case 7: data_in=*ptr++; if( (~data_ex)!=data_in ) { cnt_err+=check( 1, ~data_ex, data_in ); } data_ex++; for( ii=2; ii<size64; ii+=2 ) { data_in=*ptr++; if( data_ex!=data_in ) { cnt_err+=check( ii, data_ex, data_in ); //cnt_err=0; } data_in=*ptr++; if( (~data_ex)!=data_in ) { cnt_err+=check( ii+1, ~data_ex, data_in ); } data_ex++; } data_ex_cnt = data_ex; break; case 8: case 9: { /* //__int64 f63; //__int64 f62; //__int64 f60; //__int64 f59; //__int64 f0; U32 data_h; U32 f63; U32 f62; U32 f60; U32 f59; U32 f0; */ for( ii=1; ii<size64; ii++ ) { data_in=*ptr++; if( data_ex!=data_in ) { cnt_err+=check( ii, data_ex, data_in ); } {/* f63 = data_ex >> 63; f62 = data_ex >> 62; f60 = data_ex >> 60; f59 = data_ex >> 59; f0 = (f63 ^ f62 ^ f60 ^ f59)&1; */ U32 data_h=data_ex>>32; U32 f63 = data_h >> 31; U32 f62 = data_h >> 30; U32 f60 = data_h >> 28; U32 f59 = data_h >> 27; U32 f0 = (f63 ^ f62 ^ f60 ^ f59)&1; //U32 data_l=data_ex; //U32 f31 = (data_l>>31) & 1; //data_l<<=1; //data_l&=~1; //data_l|=f0; //data_h<<=1; //data_h&=~1; //data_h|=f31; //data_ex=data_h; //data_ex<<=32; //data_ex|=data_l; data_ex <<= 1; data_ex &= ~1; data_ex |=f0; } } } data_ex_noise = data_ex; break; } block_mode++; if( block_mode==10 ) block_mode=0; buf_current++; if (cnt_err==0) buf_cnt_ok++; else buf_cnt_error++; return cnt_err; } //! ΠΡΠΎΠ²Π΅ΡΠΊΠ° ΠΌΠ°ΡΡΠΈΠ²Π° /** Π€ΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΎΠ²Π΅ΡΡΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ² buf Π½Π° ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΠ΅ ΠΎΠΆΠΈΠ΄Π°Π΅ΠΌΡΠΌ Π΄Π°Π½Π½ΡΠΌ. ΠΠ°ΡΡΠΈΠ² Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΡΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ ΡΡΠ½ΠΊΡΠΈΠ΅ΠΉ buf_set ΠΈΠ»ΠΈ Π°Π½Π°Π»ΠΎΠ³ΠΈΡΠ½ΠΎΠΉ ΠΡΠΈ ΠΎΠ±Π½Π°ΡΡΠΆΠ΅Π½ΠΈΠΈ ΠΎΡΠΈΠ±ΠΊΠΈ Π² ΠΌΠ°ΡΡΠΈΠ² word_error Π·Π°ΠΏΠΈΡΡΠ²Π°ΡΡΡΡ ΡΠ΅ΡΡΡΠ΅ ΡΠΈΡΠ»Π°: - Π½ΠΎΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° - ΠΈΠ½Π΄Π΅ΠΊΡ Π² ΠΌΠ°ΡΡΠΈΠ²ΠΊ - ΠΎΠΆΠΈΠ΄Π°Π΅ΠΌΡΠ΅ Π΄Π°Π½Π½ΡΠ΅ - ΠΏΠΎΠ»ΡΡΠ΅Π½Π½ΡΠ΅ Π΄Π°Π½Π½ΡΠ΅ Π ΠΌΠ°ΡΡΠΈΠ²Ρ bit_error0 ΠΈ bit_error1 Π·Π°Π½ΠΎΡΠΈΡΡΡ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ. ΠΠΆΠΈΠ΄Π°Π΅ΡΡΡ ΠΏΡΠ΅Π²Π΄ΠΎΡΠ»ΡΡΠ°ΠΉΠ½Π°Ρ ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎΡΡΡ. ΠΠ°ΡΠ°Π»ΡΠ½ΠΎΠ΅ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ 2; Π‘ΠΈΠ³Π½Π°ΡΡΡΡ ΠΈ Π½ΠΎΠΌΠ΅ΡΠ° Π±Π»ΠΎΠΊΠ° Π½Π΅ ΠΎΠΆΠΈΠ΄Π°Π΅ΡΡΡ. \param buf - ΠΠ΄ΡΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° \param size - Π Π°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° Π² 32-Ρ ΡΠ°Π·ΡΡΠ΄Π½ΡΡ ΡΠ»ΠΎΠ²Π°Ρ \return Π§ΠΈΡΠ»ΠΎ ΠΎΠ±Π½Π°ΡΡΠΆΠ΅Π½Π½ΡΡ ΠΎΡΠΈΠ±ΠΎΠΊ */ U32 TF_TestBufM2::buf_check_psd( U32 *buf, U32 size ) { // n%100 - ΡΠΈΠΏ Π±Π»ΠΎΠΊΠ° U32 ii; U32 cnt_err=0; __int64 *ptr=(__int64*)buf; U32 size64 = size/2; __int64 data_ex; __int64 data_in; data_ex = data_ex_psd ; for( ii=0; ii<size64; ii++ ) { data_in=*ptr++; if( data_ex!=data_in ) { if( word_cnt_error<max_cnt_error ) { word_error[ word_cnt_error*4+0 ]=buf_current; word_error[ word_cnt_error*4+1 ]=ii; word_error[ word_cnt_error*4+2 ]=data_ex; word_error[ word_cnt_error*4+3 ]=data_in; } word_cnt_error++; cnt_err++; //cnt_err+=check( ii, data_ex, data_in ); data_ex=data_in; } {/* f63 = data_ex >> 63; f62 = data_ex >> 62; f60 = data_ex >> 60; f59 = data_ex >> 59; f0 = (f63 ^ f62 ^ f60 ^ f59)&1; */ U32 data_h=data_ex>>32; U32 f63 = data_h >> 31; U32 f62 = data_h >> 30; U32 f60 = data_h >> 28; U32 f59 = data_h >> 27; U32 f0 = (f63 ^ f62 ^ f60 ^ f59)&1; //U32 data_l=data_ex; //U32 f31 = (data_l>>31) & 1; //data_l<<=1; //data_l&=~1; //data_l|=f0; //data_h<<=1; //data_h&=~1; //data_h|=f31; //data_ex=data_h; //data_ex<<=32; //data_ex|=data_l; data_ex <<= 1; data_ex &= ~1; data_ex |=f0; } } data_ex_psd = data_ex; block_mode++; if( block_mode==10 ) block_mode=0; buf_current++; if (cnt_err==0) buf_cnt_ok++; else buf_cnt_error++; return cnt_err; } //! ΠΡΠΎΠ²Π΅ΡΠΊΠ° Π΄Π²ΠΎΠΈΡΠ½ΠΎ-ΠΈΠ½Π²Π΅ΡΡΠ½ΠΎΠΉ ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ U32 TF_TestBufM2::buf_check_inv( U32 *buf, U32 size ) { // n%100 - ΡΠΈΠΏ Π±Π»ΠΎΠΊΠ° U32 ii; U32 cnt_err=0; __int64 *ptr=(__int64*)buf; U32 size64 = size/2; __int64 data_ex; __int64 data_in; register unsigned f0; data_ex = data_ex_inv ; for( ii=0; ii<size64; ii++ ) { data_in=*ptr++; if( data_ex!=data_in ) { cnt_err+=check( ii, data_ex, data_in ); //data_ex=data_in; } //data_h=data_ex>>32; f63 = data_h >> 31; f0 = f63^1; data_ex <<= 1; data_ex &= ~1; data_ex |=f0; f0 = ((data_ex >>63) & 1) ^1; data_ex <<= 1; data_ex &= ~1; data_ex |=f0; } data_ex_inv = data_ex; block_mode++; if( block_mode==10 ) block_mode=0; buf_current++; if (cnt_err==0) buf_cnt_ok++; else buf_cnt_error++; return cnt_err; } //! ΠΠ°ΡΠ°Π»ΠΎ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ Π³ΡΡΠΏΠΏΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² /** Π€ΡΠ½ΠΊΡΠΈΡ ΠΏΠΎΠ΄Π³ΠΎΡΠ°Π²Π»ΠΈΠ²Π°Π΅Ρ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ Π΄Π»Ρ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΈΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². ΠΠ±Π½ΡΠ»ΡΡΡΡΡ ΡΡΡΡΡΠΈΠΊΠΈ ΠΎΡΠΈΠ±ΠΎΠΊ. \param n_error - ΡΠΈΡΠ»ΠΎ ΡΠΈΠΊΡΠΈΡΡΠ΅ΠΌΡΡ ΠΎΡΠΈΠ±ΠΎΠΊ. ΠΠ΅ Π±ΠΎΠ»ΡΡΠ΅ 128. \param bit_cnt - Π§ΠΈΡΠ»ΠΎ Π±ΠΈΡ Π² ΡΠ»ΠΎΠ²Π΅, Π΄Π»Ρ ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ. */ void TF_TestBufM2::buf_check_start( U32 n_error, U32 bit_cnt ) { if( n_error<32 ) { max_cnt_error=n_error; } else { max_cnt_error=32; } buf_cnt_ok=0; buf_cnt_error=0; word_cnt_error=0; buf_current=0; max_bit_cnt=bit_cnt; block_mode=0; data_ex_cnt=0; data_ex_noise=1; data_ex_psd=2; data_ex_inv=0; for( int ii=0; ii<64; ii++ ) { bit_error0[ii]=0; bit_error1[ii]=0; } for( int ii=0; ii<128*4; ii++ ) { word_error[ii]=0; } } //! Π Π΅Π·ΡΠ»ΡΡΠ°ΡΡ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ Π³ΡΡΠΏΠΏΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² /** Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΡ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². ΠΡΠ»ΠΈ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ ΡΠ°Π²Π΅Π½ NULL, ΡΠΎ ΠΎΠ½ ΠΈΠ³Π½ΠΎΡΠΈΡΡΠ΅ΡΡΡ. \param cnt_ok - Π£ΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΠΈΡΠ»ΠΎ ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². \param cnt_error - Π£ΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΠΈΡΠ»ΠΎ Π½Π΅ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². \param error - Π£ΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ. ΠΠΎ ΡΡΠΎΠΌΡ Π°Π΄ΡΠ΅ΡΡ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΡΡΡ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° word_error - ΡΠΏΠΈΡΠΎΠΊ ΠΎΡΠΈΠ±ΠΎΠΊ. \param bit0 - Π£ΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ. ΠΠΎ ΡΡΠΎΠΌΡ Π°Π΄ΡΠ΅ΡΡ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΡΡΡ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° bit_error0 - ΡΠΈΡΠ»ΠΎ ΠΎΡΠΈΠ±ΠΎΡΠ½ΠΎ ΠΏΡΠΈΠ½ΡΡΡΡ Π½ΡΠ»Π΅ΠΉ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ. \param bit1 - Π£ΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ. ΠΠΎ ΡΡΠΎΠΌΡ Π°Π΄ΡΠ΅ΡΡ ΠΏΠ΅ΡΠ΅Π΄Π°ΡΡΡΡ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° bit_error1 - ΡΠΈΡΠ»ΠΎ ΠΎΡΠΈΠ±ΠΎΡΠ½ΠΎ ΠΏΡΠΈΠ½ΡΡΡΡ Π½ΡΠ»Π΅ΠΉ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ. \return ΠΠ±ΡΠ΅Π΅ ΡΠΈΡΠ»ΠΎ ΠΎΡΠΈΠ±ΠΎΠΊ. */ U32 TF_TestBufM2::check_result( U32 *cnt_ok, U32 *cnt_error, U32 **error, U32 **bit0, U32 **bit1 ) { if( cnt_ok ) *cnt_ok=buf_cnt_ok; if( cnt_error ) *cnt_error=buf_cnt_error; if( error ) *error=(U32*)word_error; if( bit0 ) *bit0=bit_error0; if( bit1 ) *bit1=bit_error1; return word_cnt_error; } //! Π€ΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΎΡΡΡΡΠ° ΠΏΠΎ ΠΎΡΠΈΠ±ΠΊΠ°ΠΌ /** Π€ΡΠ½ΠΊΡΠΈΡ ΡΠΎΡΠΌΠΈΡΡΠ΅Ρ ΠΎΡΡΡΡ ΠΏΠΎ ΠΎΠ±Π½Π°ΡΡΠΆΠ΅Π½Π½ΡΠΌ ΠΎΡΠΈΠ±ΠΊΠ°ΠΌ ΠΈ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½Π½ΡΡ ΡΡΡΠΎΠΊΡ. ΠΡΠ²ΠΎΠ΄ΠΈΡΡΡ Π½ΠΎΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π°Π΄ΡΠ΅Ρ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅, ΠΎΠΆΠΈΠ΄Π°Π΅ΠΌΠΎΠ΅ ΠΈ ΠΏΠΎΠ»ΡΡΠ΅Π½Π½ΠΎΠ΅ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅. ΠΡΠ²ΠΎΠ΄ΠΈΡΡΡ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ ΡΠ»ΠΎΠ²Π°. */ char* TF_TestBufM2::report_word_error( void ) { char *ptr=str; int len; //char bit[64], *ptr_bit; U32 nb, na; __int64 dout, din; int size=0; //U32 mask; *ptr=0; int cnt=max_cnt_error; if( word_cnt_error<max_cnt_error ) cnt=word_cnt_error; for( int ii=0; ii<cnt; ii++ ) { nb=word_error[ii*4+0]; na=word_error[ii*4+1]; dout=word_error[ii*4+2]; din=word_error[ii*4+3]; //ptr_bit=bit; /* mask=0x80000000; for( int jj=0; jj<32; jj++ ) { if( mask & (dout ^ din ) ) { *ptr_bit++='1'; } else { *ptr_bit++='0'; } mask>>=1; if( ((jj+1)%8)==0 ) *ptr_bit++=' '; } *ptr_bit=0; */ // len=sprintf( ptr, "%4d Block: %-4d Index: %.8X Waiting: %.16LX Receive: %.16LX \r\n", len=sprintf( ptr, "%4d Block: %-4d Index: %.8X Waiting: %.16llX Received: %.16llX \r\n", //" Bits: %s\r\n\r\n" ii, nb, na, dout, din //bit ); ptr+=len; size+=len; if( size>5000 ) break; } return str; } //! Π€ΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΎΡΡΡΡΠ° ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΏΠΎ Π±ΠΈΡΠ°ΠΌ /** Π€ΡΠ½ΠΊΡΠΈΡ ΡΠΎΡΠΌΠΈΡΡΠ΅Ρ ΠΎΡΡΡΡ ΠΏΠΎ ΠΎΠ±Π½Π°ΡΡΠΆΠ΅Π½Π½ΡΠΌ ΠΎΡΠΈΠ±ΠΊΠ°ΠΌ ΠΈ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΡΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½Π½ΡΡ ΡΡΡΠΎΠΊΡ. ΠΡΠ²ΠΎΠ΄ΠΈΡΡΡΡ ΡΠΈΡΠ»ΠΎ ΠΎΡΠΈΠ±ΠΎΠΊ Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ Π±ΠΈΡΠ°, ΡΠΈΡΠ»ΠΎ ΠΎΡΠΈΠ±ΠΎΡΠ½ΠΎ ΠΏΡΠΈΠ½ΡΡΡΡ 0 ΠΈ ΡΠΈΡΠ»ΠΎ ΠΎΡΠΈΠ±ΠΎΡΠ½ΠΎ ΠΏΡΠΈΠ½ΡΡΡΡ 1. */ char* TF_TestBufM2::report_bit_error( void ) { char *ptr=str; //int len; //char bit[64], *ptr_bit; //U32 mask; *ptr=0; return str; } //---------------------------------------------------------------------------
Go to most recent revision | Compare with Previous | Blame | View Log