imp.h
Generated by XSLT script syscblkgen.xsl.
#ifndef IMP #define IMP
/* 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 */ /*
This block generates an imp.
*/ /*
Programmer: Sasan Ardalan Date: Nov. 1987 Modified: SystemC July 2006
*/
/* * SystemC code for block generated by Capsim */ #include <stdio.h> #include <math.h>
#define PI 3.141592654 #define PIDIV2 1.570796327 #define PI2 6.283185307
SC_MODULE(imp) {
sc_in_clk CLK; sc_in<bool> rst_n;
/* * Output Signals */ sc_out < float > y;
/* * STATES */
long samplesOut;
/* * Parameters */ int numberOfSamples;
SC_CTOR(imp) { SC_METHOD(entry); dont_initialize();
/* * sensitivity list */ sensitive_pos(CLK); sensitive_neg << rst_n;
} void entry();
};
/* * Entry Code */ void imp::entry() {
/* * Declarations */
float yy;
if(!rst_n) {
/* * User Init Code */
samplesOut=0;
} else {
/* * Main Code */
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();
} }
#endif