Capsim Block Documentation
This star simulates a decision element for a data receiver.
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | x |
| Num | Description | Type | Name | Default Value | |
|---|---|---|---|---|---|
| 0 | Array of decision levels: # of levels, levels | array | level |
| Num | Type | Name | Initial Value | Description |
|---|---|---|---|---|
| 0 | int | obufs | ||
| 1 | float | thresh[10] |
int i,j; int no_samples; |
|---|
if((obufs = NO_OUTPUT_BUFFERS()) < 1) {
fprintf(stderr,"slicer: no output buffers\n");
return(2);
}
if(n_level < 2) {
fprintf(stderr,"slicer: improper parameters\n");
return(1);
}
for(i=0; i
|
|---|
for(no_samples=MIN_AVAIL();no_samples >0; --no_samples) {
IT_IN(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 */
|
|---|
/*********************************************************************
slice()
**********************************************************************
This star simulates a decision element for a data receiver.
It compares the incoming signal to a set of thresholds, which are
COMPUTED from the user-specified set of output levels.
Thresholds are always exactly HALF way between specified output levels.
Output levels are specified via a topology file parameter array.
Parameter arrays are float, so there are no restrictions on specified
output values. Only 10 levels are allowed, and must be listed in
ascending magnitude order.
Examples-- binary decision (threshold = 0.0)
param array 2 -1.0 1.0
quaternary decision (thresholds -2/0/2)
param array 4 -3. -1. 1. 3.
The number of output channels is determined at run-time (auto-fanout).
|
|---|