Capsim Block Documentation
Decimation filter for weights in Delta Sigma Modulation
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | xx |
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | y |
| 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 |
| Num | Type | Name | Initial Value | Description |
|---|---|---|---|---|
| 0 | int* | weights_P | ||
| 1 | int* | x_P | ||
| 2 | float | wnorm | ||
| 3 | int | k |
int buffer_no,no_samples;
float xf,ysum,sum,tmp;
int n1,n2,i,j,m;
int nf1,nfd2,nfd3;
float tmp2,tmp1;
|
|---|
/*
* 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 |
|---|
while(IT_IN(0)) {
/*
* Shift input sample into tapped delay line
*/
tmp2=xx(0);
for(i=0; i |
|---|
free(x_P); free(weights_P); |
|---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
Copyright (C) 1989-2002 XCAD 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://capsimtmk.sourceforge.net
XCAD Corporation
Raleigh, North Carolina */
|
|---|
/************************************************************* Decimation filter for weights in Delta Sigma Modulation *************************************************************** |
|---|