Capsim Block Documentation
This star adds all of its input samples using fixed point arithmetic.
| Num | Description | Type | Name | Default Value | |
|---|---|---|---|---|---|
| 0 | roundoff bits | int | roundoff_bits | 8 | |
| 1 | Word length | int | size | 32 | |
| 2 | outputsize | int | output_size | 32 | |
| 3 | saturation mode | int | saturation_mode | 1 |
| Num | Type | Name | Initial Value | Description |
|---|---|---|---|---|
| 0 | int | numberInputBuffers | ||
| 1 | int | numberOutputBuffers |
int i, j, samples; int sum1, sum0, input1, input0, out1, out0, out; doublePrecInt inputSample; |
|---|
if (size > 32) {
fprintf(stderr,"fxadd:size can not be greater than 32\n");
return(4);
}
if ((size & 1) == 1) {
fprintf(stderr,"fxadd: Sorry, size can not be an odd number\n");
return(4);
}
/*
* store as state the number of input/output buffers
*/
if ((numberInputBuffers = NO_INPUT_BUFFERS()) < 1) {
fprintf(stderr,"fxadd: no input buffers\n");
return(2);
}
for(i=0; i< numberInputBuffers; i++)
SET_CELL_SIZE_IN(i,sizeof(doublePrecInt));
if ((numberOutputBuffers = NO_OUTPUT_BUFFERS()) < 1) {
fprintf(stderr,"fxadd: no output buffers\n");
return(3);
}
for(i=0; i< numberOutputBuffers; i++)
SET_CELL_SIZE_OUT(i,sizeof(int));
|
|---|
/*
* read one sample from each input buffer and add them
*/
for (samples = (MIN_AVAIL());samples > 0; --samples) {
sum1 = 0;
sum0 = 0;
for (i=0; i |
|---|
/* 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 */
|
|---|
/* fxadd.s */ /********************************************************************** fxadd() *********************************************************************** This star adds all of its input samples. The input is accepted in pairs coming from fxgain.s star. The output is rounded by the number of bits specified by the parameter roundoff_bits. Parameters : 1 - (int) roudoff_bits 2 - (int) size : The size of input number 3 - (int) output_size : output register word-length |
|---|