SystemC Development with CapsimTMK

Source Code imp.s

imp.s

 <BLOCK>
       <LICENSE>
       /* 
 Copyright (C) 2006-2007 Silicon DSP Corporation, Portland, Oregon
 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
       */
     </LICENSE>
     <BLOCK_NAME>imp</BLOCK_NAME> 
<COMMENTS>
     <![CDATA[ 
/* imp.s */
       /***************************************************************************
   imp()
   *****************************************************************************
   This block generates an imp. 
   */
]]>
     </COMMENTS> 
<DESC_SHORT>
       This block generates an imp. 
     </DESC_SHORT>
<DESCRIPTION>
       This block generates an imp.
       The parameter specifies the number of samples to output.
     </DESCRIPTION>
<PROGRAMMERS>
       Programmer: Sasan Ardalan
       Date: Nov. 1987
       Modified: SystemC July 2006
     </PROGRAMMERS>
<INCLUDES>
     <![CDATA[ 
     
]]>
     </INCLUDES> 
<DEFINES> 
#define PI 3.141592654
       #define PIDIV2 1.570796327
       #define PI2 6.283185307
</DEFINES> 
     
<OUTPUT_BUFFERS>
 <BUFFER>
 <TYPE>float</TYPE>
 <NAME>y</NAME>
 </BUFFER>
 </OUTPUT_BUFFERS>
     
 
     <DECLARATIONS> 
 float yy;
</DECLARATIONS> 
 
<PARAMETERS>
     <PARAM>
 <DEF>Total number of samples to output</DEF>
 <TYPE>int</TYPE>
 <NAME>numberOfSamples</NAME>
 <VALUE>128</VALUE>
 </PARAM>
 </PARAMETERS>
     
 
<STATES>
 <STATE>
 <TYPE>long</TYPE>
 <NAME>samplesOut</NAME>
 <VALUE>0</VALUE>
 </STATE>
 </STATES>
 
<INIT_CODE>
     <![CDATA[ 
 samplesOut=0;
]]>
     </INIT_CODE> 
     
<MAIN_CODE>
     <![CDATA[ 
   if(samplesOut < 1) yy=0.0; //account for clocks needed for reset
   else {
   if(samplesOut ==1) yy=1.0;
   else yy=0.0;
   }
   y.write(yy);
   samplesOut += 1;
   if(samplesOut > numberOfSamples) sc_stop();
]]>
     </MAIN_CODE> 
<WRAPUP_CODE>
     <![CDATA[ 
     
]]>
</WRAPUP_CODE> 
 
</BLOCK> 


Contact | ©2007 Silcon DSP Corporation , Portland, Oregon