Capsim Block Documentation
This star produces the fft of the input signal. The points are output as complex numbers.
| Port | Type | Name | |
|---|---|---|---|
| 0 | complex | x |
| Port | Type | Name | |
|---|---|---|---|
| 0 | complex | y |
| Num | Description | Type | Name | Default Value | |
|---|---|---|---|---|---|
| 0 | Size of FFT | int | npts | 128 |
| Num | Type | Name | Initial Value | Description |
|---|---|---|---|---|
| 0 | int | fftexp | ||
| 1 | int | fftl | ||
| 2 | cap_fft_cpx* | cxinBuff | ||
| 3 | cap_fft_cpx* | cxoutBuff | ||
| 4 | cap_fft_cfg | cfg | ||
| 5 | int | pointCount | 0 |
int no_samples; complex calc; int i,j; |
|---|
fftl=npts;
fprintf(stderr,"cmxfft: fft length is: %d \n", fftl);
if (fftl < 2)
{
fprintf(stderr,"cmxfft: fft length is too short \n");
return(1);
}
cfg=cap_fft_alloc(fftl,0,NULL,NULL);
if ((cxinBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL)
{
fprintf(stderr,"cmxfft: can't allocate work space \n");
return(2);
}
if ((cxoutBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL)
{
fprintf(stderr,"cmxfft: can't allocate work space \n");
return(3);
}
SET_CELL_SIZE_IN(0,sizeof(complex));
SET_CELL_SIZE_OUT(0,sizeof(complex));
|
|---|
for (no_samples = MIN_AVAIL(); no_samples > 0; --no_samples)
{
/*
* real input buffer
*/
j=pointCount;
IT_IN(0);
cxinBuff[j].r=x(0).re;
cxinBuff[j].i=x(0).im;
pointCount++;
/*
* Get enough points
*/
if(pointCount >= fftl )
{
/*
* perform fft calculation
*/
cap_fft(cfg, cxinBuff, cxoutBuff);
/*
* now, output complex pairs
*/
for (i=0; i |
|---|
/* * free up allocated space */ free((cap_fft_cpx*)cxinBuff); free((cap_fft_cpx*)cxoutBuff); |
|---|
/* 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 */
|
|---|
/* cmxfft.s */
/***********************************************************************
cmxfft()
************************************************************************
Inputs: x complex
Outputs: y, the fft of the signal complex
Parameters: int inpts the fft length
************************************************************************
This star produces the fft of the input signal. The points are output
as complex numbers. The number of points input is npts and the number
of points generated is npts;
Programmer: Prayson Pate
Date: April 15, 1988
Modified: April 18, 1988
Modified: Sasan Ardalan to use cxfft() routine, use complex buffers.
*/
|
|---|