Capsim Block Documentation
This star stretches the incoming data.
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | y |
| Num | Description | Type | Name | Default Value | |
|---|---|---|---|---|---|
| 0 | Stretch factor | int | s | 1 |
| Num | Type | Name | Initial Value | Description |
|---|---|---|---|---|
| 0 | int | last_clk | ||
| 1 | float | last_x |
int i,j,no_samples; int clk; float x; float z; |
|---|
if (NO_OUTPUT_BUFFERS() == 1)
;
else
return(1);
if (s == 0)
{
if (NO_INPUT_BUFFERS() == 2)
;
else
return(2);
}
else if (s > 0)
{
if (NO_INPUT_BUFFERS() == 1)
;
else
return(3);
}
else
return(4);
last_clk = 0;
|
|---|
/* note the minimum number of samples on the input buffers */
/* and iterate that many times */
if (i > 0)
{
for(no_samples=MIN_AVAIL();no_samples >0; --no_samples)
{
IT_IN(0);
x = INF(0,0);
if(IT_OUT(0)) {
KrnOverflow("stretch",0);
return(99);
}
y(0) = x;
for(i=1; 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 */
|
|---|
/* stretch.s */ /************************************************************************* stretch() ************************************************************************** Inputs: in(0), the data to be stretched in(1), a clock (optional) Outputs: y, the stretched data Parameters: s, the stretch factor ************************************************************************** This star stretches the incoming data. If the paramater s is 0 then the data is clocked by the rising edge of the second input. Else, the data is stretched by the fixed factor of s. Each case is shown below. s = 0: x: 1 2 3 4 5 6 7 8 9 clk: 110110101011001100110110110 y: 111222334455556666777888999 s > 3: x: 1 2 3 4 5 6 7 8 9 y: 111222333444555666777888999 |
|---|