decimate

Capsim Block Documentation

Short Description

Decimation filter for weights in Delta Sigma Modulation

Top
Input Connections
Port Type Name
0 float xx
Top
Output Connections
Port Type Name
0 float y
Top
Parameters
Num Description Type Name Default Value
0 Weighting: 1-Uniform 2-Triangular 3-Parabolic int iw 3
1 Number of taps for FIR decimation filter int nf 128
2 Decimation factor int idec 32
Top
States
Num Type Name Initial Value Description
0 int* weights_P
1 int* x_P
2 float wnorm
3 int k
Top

Declarations


 

	int buffer_no,no_samples;
        float xf,ysum,sum,tmp;
        int n1,n2,i,j,m;
	int nf1,nfd2,nfd3;
	float	tmp2,tmp1;



Top

Initialization Code



 

/*   
 * allocate work space      
 */
if(((weights_P=(int*)calloc(nf,sizeof(int))) == NULL) ||
		(x_P =(int*)calloc(nf,sizeof(int))) == NULL) { 
		fprintf(stderr,"decimate(): can't allocate work space \n");
		return(1);
}
nf1=nf-1;
nfd2=(int)(nf/2);
nfd3=(int)(nf/3.)+1;
/*
 * setup weights for decimation filters
 */
wnorm=0.0;
for(i=0; i
    
Top

Main Code



 


while(IT_IN(0)) {
	/*
         * Shift input sample into tapped delay line
         */
         tmp2=xx(0);
         for(i=0; i
    
Top

Wrapup Code



 

	free(x_P);
	free(weights_P);




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



 

/*************************************************************
	Decimation filter for weights in Delta Sigma Modulation
***************************************************************

decimate


Decimation filter for weights in Delta Sigma Modulation


Programmer: Sasan H Ardalan
Date: August 22,1987

*/