ecount

Capsim Block Documentation

Short Description

This star compares two data streams for "equality".

Top
Input Connections
Port Type Name
0 float w
1 float x
Top
Parameters
Num Description Type Name Default Value
0 Number of samples to ignore for final error tally int ignore 0
1 Index after which each error is printed to terminal int err_msg 30000
Top
States
Num Type Name Initial Value Description
0 int samples 0
1 int error_count 0
2 int hits 0
3 int obufs
Top

Declarations


 

	int i,j;
	int numin;
	int err_out;



Top

Initialization Code



 

	obufs = NO_OUTPUT_BUFFERS();




Top

Main Code



 


	numin = MIN_AVAIL();
	for(i=0; i x(0) + GBAND || w(0) < x(0) - GBAND ) {
			hits++;
			if(samples >= ignore) {
				err_out = 1.;
				error_count++;
				if(samples >= err_msg)
	fprintf(stderr, "ecount: symbol error @%d\n",samples);

			}
			else {
				if(samples >= err_msg)
	fprintf(stderr, "ecount: symbol error @%d  (ignore)\n",samples);
			}
		}
		samples++;

		for(j=0; j
    
Top

Wrapup Code



 

fprintf(stderr,"ecount: hits/samples = %d/%d  (ignore %d)  BER = %d/%d = %.4g\n",
		hits, samples, samples>ignore? ignore:samples,
		error_count, samples>ignore? samples-ignore:0,
		samples>ignore? (float)error_count/(samples-ignore):0);




Top

License



/*  Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
    Copyright (C) 1989-2017  Silicon DSP Corporation

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    http://www.silicondsp.com
    Silicon DSP  Corporation
    Las Vegas, Nevada
*/


Top

Description



 

/**********************************************************************
                ecount()
***********************************************************************
"error counter"
This star compares two data streams for "equality".  (Since the input
streams are floating point, a guard band is used.) An output stream
is created, with 'zero' output for equality, and 'one' if there is a
difference.  (Note: the output stream is optional--if no star is
connected to the output, there is no output.)
Param. 1 selects an initial number of samples to be ignored for
the final error tally (used during training sequences); default zero.
Param 2 sets an index, after which a message is printed to stderr for
each error.  It defaults to "infinity", i.e. no error messages.
This star prints a final message to stderr giving the error rate
(errors/smpl), disregarding the initial ignored samples.

ecount


"error counter"
This star compares two data streams for "equality".  (Since the input
streams are floating point, a guard band is used.) An output stream
is created, with 'zero' output for equality, and 'one' if there is a
difference.  (Note: the output stream is optional--if no star is
connected to the output, there is no output.)
Param. 1 selects an initial number of samples to be ignored for
the final error tally (used during training sequences); default zero.
Param 2 sets an index, after which a message is printed to stderr for
each error.  It defaults to "infinity", i.e. no error messages.
This star prints a final message to stderr giving the error rate
(errors/smpl), disregarding the initial ignored samples.


Programmer: L.J. Faber 
Date: Dec 1987
Modified: April 1988
Modified: May 1988--Fix report print
Modified: June 1988--Fix report print

*/