OpenCores
URL https://opencores.org/ocsvn/sciir/sciir/trunk

Subversion Repositories sciir

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

/sciir/trunk/SystemC/tfi/IIR_TFI.cpp
0,0 → 1,69
#include "systemc.h"
#include "IIR_TFI.h"
#include "Stimuli.h"
 
int sc_main(int argc, char* argv[])
{
sc_clock CLOCK("CLOCK", 1, SC_US);
sc_signal<bool> RST;
sc_signal<float > iIIR;
sc_signal<float > oIIR;
float b[orderFF] = {0.0995,0.1486,0.1481,0.0999};
float a[orderFB] = {0.9828,-0.5450,0.0671};
const int Size = 16;
IIR_TFI<float > DUT("DUT", b, a);
DUT.CLR(RST);
DUT.CLK(CLOCK);
DUT.iIIR(iIIR);
DUT.oIIR(oIIR);
Stimuli<float > inputVector("Stimuli", Size);
inputVector.clr(RST);
inputVector.clk(CLOCK);
inputVector.streamout(iIIR);
cout << "FF Order \t" << orderFF << endl;
cout << "FB Order \t" << orderFB << endl;
sc_trace_file *fp;
fp = sc_create_vcd_trace_file("wave");
fp -> set_time_unit(100, SC_PS);
 
sc_trace(fp, RST, "RST");
sc_trace(fp, CLOCK, "CLOCK");
sc_trace(fp, iIIR, "IP");
sc_trace(fp, oIIR, "OP");
sc_trace(fp, DUT.oMultiplierFF[0], "oMU_FF(0)");
sc_trace(fp, DUT.oMultiplierFF[1], "oMU_FF(1)");
sc_trace(fp, DUT.oMultiplierFF[2], "oMU_FF(2)");
sc_trace(fp, DUT.oMultiplierFF[3], "oMU_FF(3)");
sc_trace(fp, DUT.oAdderFF[0], "oAD_FF(0)");
sc_trace(fp, DUT.oAdderFF[1], "oAD_FF(1)");
sc_trace(fp, DUT.oAdderFF[2], "oAD_FF(2)");
sc_trace(fp, DUT.oAdderFF[3], "oAD_FF(3)");
sc_trace(fp, DUT.oDelayFF[0], "oDL_FF(0)");
sc_trace(fp, DUT.oDelayFF[1], "oDL_FF(1)");
sc_trace(fp, DUT.oDelayFF[2], "oDL_FF(2)");
sc_trace(fp, DUT.oDelayFF[3], "oDL_FF(3)");
sc_trace(fp, DUT.oMultiplierFB[0], "oMU_FB(0)");
sc_trace(fp, DUT.oMultiplierFB[1], "oMU_FB(1)");
sc_trace(fp, DUT.oMultiplierFB[2], "oMU_FB(2)");
 
RST = true;
sc_start(3, SC_US);
RST = false;cout << " RESET " << endl;
sc_start(16, SC_US);
 
sc_close_vcd_trace_file(fp);
return 0;
}
 
// g++ -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux IIR_TFI.cpp -lsystemc -lm -o iir.o
// g++ -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux IIR_TFI.cpp -lsystemc -lm -o sdm.o -DSC_INCLUDE_FX
/sciir/trunk/SystemC/tfi/Step.txt
0,0 → 1,16
 
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
/sciir/trunk/SystemC/tfi/IIR_TFI.h
0,0 → 1,135
/*
* This is a semi-behavioral/structural description for digital IIR filter
* Direct-Form II structure
* Direct-Form I Transposed structure using Matlab notation
*
* \Sigma_{i=0}^{N} b[i]z^{-1}
* H(z) = ---------------------------------
* 1 - \Sigma_{i=1}^{N} a[i]z^{-1}
*
* H(z): transfer function
* b: feed-forward coefficients
* a: feed-back coefficients
* N: filter order
*
* U. Meyer-Baese, "Digital signal processing with field programmable gate arrays", Springer Verlag, 2004
*/
 
#define order 3
#define orderFF order+1
#define orderFB orderFF-1
template<class T>
SC_MODULE(IIR_TFI)
{
/* Entity */
sc_in<bool> CLR; // Asynchronous active high reset
sc_in<bool> CLK; // Rising edge clock
sc_in<T> iIIR; // IIR input
sc_out<T> oIIR; // IIR ouput
/* Internal Signals Declaration */
sc_signal<T> oMultiplierFF[orderFF]; // FF multipliers output
sc_signal<T> oAdderFF[orderFF]; // FF adders output
sc_signal<T> oDelayFF[orderFF]; // FF delays output
sc_signal<T> oMultiplierFB[orderFB]; // FB multipliers output
sc_signal<T> oAdderFB[orderFB]; // FB adders output
sc_signal<T> oDelayFB[orderFB]; // FB delays output
sc_signal<T> tIIR; // Temporary intput
/* Constructor Architecture */
SC_HAS_PROCESS(IIR_TFI);
IIR_TFI(sc_module_name name, T* _b, T* _a) :
sc_module(name), // Arbitrary module name
b(_b), // Feed-Forward Coefficients
a(_a) // Feed-Back Coefficients
{
SC_METHOD(multipliers);
sensitive << tIIR;
SC_METHOD(adders);
for (int i = 0; i < orderFF; i++)
{
sensitive << oMultiplierFF[i];
sensitive << oDelayFF[i];
}
SC_METHOD(delays);
sensitive << CLK.pos();
SC_METHOD(input);
sensitive << iIIR << oDelayFB[orderFB-1];
}
void multipliers()
{
/* Feed-Forward */
for (int i = 0; i < orderFF; i++)
{
oMultiplierFF[i] = tIIR * b[i];
}
/* Feed-Back */
for (int i = 0; i < orderFB; i++)
{
oMultiplierFB[i] = tIIR * a[orderFB-1-i];
}
}
void adders()
{
/* Feed-Forward */
for (int i = 0; i < orderFF; i++)
{
if (i < (orderFF-1))
{
oAdderFF[i] = oMultiplierFF[i] + oDelayFF[i];
}
else
{
oAdderFF[i] = oMultiplierFF[i];
}
}
/* Feed-Back */
for (int i = 0; i < orderFB; i++)
{
if (i == 0)
{
oAdderFB[i] = oMultiplierFB[i];
}
else
{
oAdderFB[i] = oMultiplierFB[i] + oDelayFB[i-1];
}
}
}
void delays()
{
/* Feed-Forward */
for (int i = 0; i < orderFF-1; i++)
{
oDelayFF[i] = oAdderFF[i+1];
}
/* Feed-Back */
for (int i = 0; i < orderFB; i++)
{
oDelayFB[i] = oAdderFB[i];
}
}
void input()
{
tIIR.write(iIIR.read() + oDelayFB[orderFB-1]);
}
/* Deconstructor */
~IIR_TFI()
{
}
T *b, *a;
};
/sciir/trunk/SystemC/tfi/Impulse.txt
0,0 → 1,16
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/sciir/trunk/SystemC/tfi/Stimuli.h
0,0 → 1,82
/** This function read in a text file into a local variable and export it
in array format */
template<class T> T* ReafFileData(int Size)
{
T *values = new T[Size];
int numValuesRead = 0;
 
// open the file
FILE* pFile = fopen("Step.txt","r+t");
 
while( ! feof( pFile ) )
{
T currentInt = 0;
fscanf( pFile, "%f", &currentInt);
values[numValuesRead] = currentInt ;
numValuesRead++;
}
 
fclose(pFile);
 
return values;
 
delete pFile;
}
 
/** This module/block start reading the data from the array data
when the clear signal is set to zero and at each rising edge of the clock */
template<class T>
SC_MODULE(Stimuli) {
// Input and Output Ports
sc_in_clk clk;
sc_in<bool> clr;
sc_out<T > streamout;
 
// Internal variable
unsigned int count;
float *data;
// Constructor
SC_HAS_PROCESS(Stimuli);
Stimuli(sc_module_name name, int _Size):
sc_module(name),
Size(_Size)
{
SC_METHOD(bitstream);
sensitive << clr << clk.pos();
data = ReafFileData<float> (Size);
}
 
// Process
void bitstream()
{
if (clr == true)
{
count = 0;
streamout.write(0.0);
}
else
{
if (clk.posedge())
{
if (count < Size)
{
streamout.write(data[count]);
count = count + 1;
}
else
{
count = 0;
}
}
}
}
 
~Stimuli()
{
}
int Size;
};
/sciir/trunk/SystemC/dfii/IIR_DFII.cpp
0,0 → 1,72
#include "systemc.h"
#include "IIR_DFII.h"
#include "Stimuli.h"
 
int sc_main(int argc, char* argv[])
{
sc_clock CLOCK("CLOCK", 1, SC_US);
sc_signal<bool> RST;
sc_signal<float > iIIR;
sc_signal<float > oIIR;
/*float b[orderFF] = {0.0995,0.1486,0.1481,0.0999};
float a[orderFF] = {0.0,0.9828,-0.5450,0.0671};*/
float b[orderFF] = {0.0565,0.0967,0.1184,0.0970,0.0564};
float a[orderFF] = {0.0,1.3320,-1.0422,0.3544,-0.0700};
const int Size = 16;
IIR_DFII<float > DUT("DUT", b, a);
DUT.CLR(RST);
DUT.CLK(CLOCK);
DUT.iIIR(iIIR);
DUT.oIIR(oIIR);
Stimuli<float > inputVector("Stimuli", Size);
inputVector.clr(RST);
inputVector.clk(CLOCK);
inputVector.streamout(iIIR);
cout << "FF Order \t" << orderFF << endl;
cout << "FB Order \t" << orderFB << endl;
sc_trace_file *fp;
fp = sc_create_vcd_trace_file("wave");
fp -> set_time_unit(100, SC_PS);
 
sc_trace(fp, RST, "RST");
sc_trace(fp, CLOCK, "CLOCK");
sc_trace(fp, iIIR, "IP");
sc_trace(fp, oIIR, "OP");
sc_trace(fp, DUT.oMultiplierFF[0], "oMU_FF(0)");
sc_trace(fp, DUT.oMultiplierFF[1], "oMU_FF(1)");
sc_trace(fp, DUT.oMultiplierFF[2], "oMU_FF(2)");
sc_trace(fp, DUT.oMultiplierFF[3], "oMU_FF(3)");
sc_trace(fp, DUT.oAdderFF[0], "oAD_FF(0)");
sc_trace(fp, DUT.oAdderFF[1], "oAD_FF(1)");
sc_trace(fp, DUT.oAdderFF[2], "oAD_FF(2)");
sc_trace(fp, DUT.oAdderFF[3], "oAD_FF(3)");
sc_trace(fp, DUT.oDelay[0], "oDL_FF(0)");
sc_trace(fp, DUT.oDelay[1], "oDL_FF(1)");
sc_trace(fp, DUT.oDelay[2], "oDL_FF(2)");
sc_trace(fp, DUT.oDelay[3], "oDL_FF(3)");
sc_trace(fp, DUT.oMultiplierFB[0], "oMU_FB(0)");
sc_trace(fp, DUT.oMultiplierFB[1], "oMU_FB(1)");
sc_trace(fp, DUT.oMultiplierFB[2], "oMU_FB(2)");
sc_trace(fp, DUT.oMultiplierFB[3], "oMU_FB(3)");
 
RST = true;
sc_start(3, SC_US);
RST = false;cout << " RESET " << endl;
sc_start(16, SC_US);
 
sc_close_vcd_trace_file(fp);
return 0;
}
 
// g++ -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux IIR_DFII.cpp -lsystemc -lm -o iir.o
// g++ -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux IIR_DFII.cpp -lsystemc -lm -o sdm.o -DSC_INCLUDE_FX
/sciir/trunk/SystemC/dfii/IIR_DFII.h
0,0 → 1,145
/*
* This is a semi-behavioral/structural description for digital IIR filter
* Direct-Form II structure using Matlab notation
*
* \Sigma_{i=0}^{N} b[i]z^{-1}
* H(z) = ---------------------------------
* 1 - \Sigma_{i=1}^{N} a[i]z^{-1}
*
* H(z): transfer function
* b: feed-forward coefficients
* a: feed-back coefficients
* N: filter order
*
*/
 
#define orderFF 5
#define orderFB orderFF-1
 
template<class T>
SC_MODULE(IIR_DFII)
{
/* Entity */
sc_in<bool> CLR; // Asynchronous active high reset
sc_in<bool> CLK; // Rising edge clock
sc_in<T> iIIR; // IIR input
sc_out<T> oIIR; // IIR ouput
/* Internal Signals Declaration */
sc_signal<T> oMultiplierFF[orderFF]; // FF multipliers output
sc_signal<T> oAdderFF[orderFF]; // FF adders output
sc_signal<T> oMultiplierFB[orderFF]; // FB multipliers output
sc_signal<T> oAdderFB[orderFF]; // FB adders output
sc_signal<T> oDelay[orderFF]; // Delays output
sc_signal<T> tIIR; // Temporary intput
/* Constructor Architecture */
SC_HAS_PROCESS(IIR_DFII);
IIR_DFII(sc_module_name name, T* _b, T* _a) :
sc_module(name),
b(_b),
a(_a)
{
SC_METHOD(input);
sensitive << CLK.neg();
SC_METHOD(delays);
sensitive << CLK.pos();
SC_METHOD(multipliers);
for (int i = 1; i < orderFF; i++)
sensitive << oDelay[i];
SC_METHOD(addersFF);
sensitive << oMultiplierFF[0];
SC_METHOD(addersFB);
for (int i = 1; i < 2; i++)
{
sensitive << oMultiplierFB[i];
sensitive << oAdderFB[i];
}
SC_METHOD(output);
sensitive << CLK.pos();
}
void input()
{
tIIR.write(iIIR.read() + oAdderFB[1]);
oDelay[0].write(iIIR.read() + oAdderFB[1]);
}
void delays()
{
for (int i = 1; i < orderFF; i++)
{
oDelay[i] = oDelay[i-1];
}
}
void multipliers()
{
/* Feed-Forward */
for (int i = 0; i < orderFF; i++)
{
oMultiplierFF[i] = oDelay[i] * b[i];
}
/* Feed-Back */
for (int i = 0; i < orderFF; i++)
{
oMultiplierFB[i] = oDelay[i] * a[i];
}
}
void addersFF()
{
/* Feed-Forward */
for (int i = 0; i < orderFF; i++)
{
if (i == 0)
{
oAdderFF[i] = oMultiplierFF[i];
}
else
{
oAdderFF[i] = oMultiplierFF[i] + oAdderFF[i-1];
}
}
cout << oAdderFF[0] << endl;
}
void addersFB()
{
/* Feed-Back */
for (int i = 0; i < orderFF; i++)
{
if (i == 0)
{
oAdderFB[i] = 0;
}
else if (i < orderFB)
{
oAdderFB[i] = oMultiplierFB[i] + oAdderFB[i+1];
}
else
{
oAdderFB[i] = oMultiplierFB[i];
}
}
}
void output()
{
oIIR.write(oAdderFF[orderFF-1]);
}
/* Deconstructor */
~IIR_DFII()
{
}
T *b, *a;
};
/sciir/trunk/SystemC/dfii/Step.txt
0,0 → 1,16
 
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
/sciir/trunk/SystemC/dfii/Impulse.txt
0,0 → 1,16
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/sciir/trunk/SystemC/dfii/Stimuli.h
0,0 → 1,82
/** This function read in a text file into a local variable and export it
in array format */
template<class T> T* ReafFileData(int Size)
{
T *values = new T[Size];
int numValuesRead = 0;
 
// open the file
FILE* pFile = fopen("Step.txt","r+t");
 
while( ! feof( pFile ) )
{
T currentInt = 0;
fscanf( pFile, "%f", &currentInt);
values[numValuesRead] = currentInt ;
numValuesRead++;
}
 
fclose(pFile);
 
return values;
 
delete pFile;
}
 
/** This module/block start reading the data from the array data
when the clear signal is set to zero and at each rising edge of the clock */
template<class T>
SC_MODULE(Stimuli) {
// Input and Output Ports
sc_in_clk clk;
sc_in<bool> clr;
sc_out<T > streamout;
 
// Internal variable
unsigned int count;
float *data;
// Constructor
SC_HAS_PROCESS(Stimuli);
Stimuli(sc_module_name name, int _Size):
sc_module(name),
Size(_Size)
{
SC_METHOD(bitstream);
sensitive << clr << clk.pos();
data = ReafFileData<float> (Size);
}
 
// Process
void bitstream()
{
if (clr == true)
{
count = 0;
streamout.write(0.0);
}
else
{
if (clk.posedge())
{
if (count < Size)
{
streamout.write(data[count]);
count = count + 1;
}
else
{
count = 0;
}
}
}
}
 
~Stimuli()
{
}
int Size;
};
/sciir/trunk/SystemC/tfii/IIR_TFII.cpp
0,0 → 1,67
#include "systemc.h"
#include "IIR_TFII.h"
#include "Stimuli.h"
 
int sc_main(int argc, char* argv[])
{
sc_clock CLOCK("CLOCK", 1, SC_US);
sc_signal<bool> RST;
sc_signal<float > iIIR;
sc_signal<float > oIIR;
float b[orderFF] = {0.0995,0.1486,0.1481,0.0999};
float a[orderFF] = {0.0,0.9828,-0.5450,0.0671};
const int Size = 16;
IIR_TFII<float > DUT("DUT", b, a);
DUT.CLR(RST);
DUT.CLK(CLOCK);
DUT.iIIR(iIIR);
DUT.oIIR(oIIR);
Stimuli<float > inputVector("Stimuli", Size);
inputVector.clr(RST);
inputVector.clk(CLOCK);
inputVector.streamout(iIIR);
sc_trace_file *fp;
fp = sc_create_vcd_trace_file("wave");
fp -> set_time_unit(100, SC_PS);
 
sc_trace(fp, RST, "RST");
sc_trace(fp, CLOCK, "CLOCK");
sc_trace(fp, iIIR, "IP");
sc_trace(fp, oIIR, "OP");
sc_trace(fp, DUT.oMultiplierFF[0], "oMU_FF(0)");
sc_trace(fp, DUT.oMultiplierFF[1], "oMU_FF(1)");
sc_trace(fp, DUT.oMultiplierFF[2], "oMU_FF(2)");
sc_trace(fp, DUT.oMultiplierFF[3], "oMU_FF(3)");
sc_trace(fp, DUT.oAdder[0], "oAD(0)");
sc_trace(fp, DUT.oAdder[1], "oAD(1)");
sc_trace(fp, DUT.oAdder[2], "oAD(2)");
sc_trace(fp, DUT.oAdder[3], "oAD(3)");
sc_trace(fp, DUT.oDelay[0], "oDL(0)");
sc_trace(fp, DUT.oDelay[1], "oDL(1)");
sc_trace(fp, DUT.oDelay[2], "oDL(2)");
sc_trace(fp, DUT.oMultiplierFB[0], "oMU_FB(0)");
sc_trace(fp, DUT.oMultiplierFB[1], "oMU_FB(1)");
sc_trace(fp, DUT.oMultiplierFB[2], "oMU_FB(2)");
sc_trace(fp, DUT.oMultiplierFB[2], "oMU_FB(2)");
 
RST = true;
sc_start(3, SC_US);
RST = false;cout << " RESET " << endl;
sc_start(16, SC_US);
 
sc_close_vcd_trace_file(fp);
return 0;
}
 
// g++ -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux IIR_TFII.cpp -lsystemc -lm -o iir.o
// g++ -I$SYSTEMC_HOME/include -L$SYSTEMC_HOME/lib-linux IIR_TFII.cpp -lsystemc -lm -o iir.o -DSC_INCLUDE_FX
 
/sciir/trunk/SystemC/tfii/IIR_TFII.h
0,0 → 1,127
/*
* This is a semi-behavioral/structural description for digital IIR filter
* Direct-Form I structure
* Direct-Form II Transposed structure using Matlab notation
*
* \Sigma_{i=0}^{N} b[i]z^{-1}
* H(z) = ---------------------------------
* 1 - \Sigma_{i=1}^{N} a[i]z^{-1}
*
* H(z): transfer function
* b: feed-forward coefficients
* a: feed-back coefficients
* N: filter order
*
* U. Meyer-Baese, "Digital signal processing with field programmable gate arrays", Springer Verlag, 2004
*/
#define orderFF 4
#define orderFB orderFF-1
 
template<class T>
SC_MODULE(IIR_TFII)
{
/* Entity */
sc_in<bool> CLR; // Asynchronous active high reset
sc_in<bool> CLK; // Rising edge clock
sc_in<T> iIIR; // IIR input
sc_out<T> oIIR; // IIR ouput
/* Internal Signals Declaration */
sc_signal<T> oMultiplierFF[orderFF]; // FF multipliers output
sc_signal<T> oMultiplierFB[orderFF]; // FB multipliers output
sc_signal<T> oAdder[orderFF]; // Adders output
sc_signal<T> oDelay[orderFB]; // Delays output
/* Constructor Architecture */
SC_HAS_PROCESS(IIR_TFII);
IIR_TFII(sc_module_name name, T* _b, T* _a) :
sc_module(name), // Arbitrary module name
b(_b), // Feed-Forward Coefficients
a(_a) // Feed-Back Coefficients
{
SC_METHOD(multipliers);
sensitive << iIIR << oAdder[0];
SC_METHOD(adders);
for (int i = 0; i < orderFF; i++)
{
if (i < orderFB)
{
sensitive << oMultiplierFF[i];
sensitive << oMultiplierFB[i];
sensitive << oDelay[i];
}
else
{
sensitive << oMultiplierFF[i];
sensitive << oMultiplierFB[i];
}
}
SC_METHOD(delays);
sensitive << CLK.pos();
SC_METHOD(output);
sensitive << CLK.pos();
}
void multipliers()
{
/* Feed-Forward */
for (int i = 0; i < orderFF; i++)
{
oMultiplierFF[i] = iIIR.read() * b[i];
cout << "FF MU [" << i << "]\t" << oMultiplierFF[i] << endl;
}
/* Feed-Back */
for (int i = 0; i < orderFF; i++)
{
if (i == 0)
{
oMultiplierFB[i] = 0;
}
else
{
oMultiplierFB[i] = oAdder[0] * a[i];
}
}
}
void adders()
{
for (int i = 0; i < orderFF; i++)
{
if (i < orderFB )
{
oAdder[i] = oMultiplierFF[i] + oMultiplierFB[i] + oDelay[i];
}
else
{
oAdder[i] = oMultiplierFF[i] + oMultiplierFB[i];
}
}
}
void delays()
{
for (int i = 0; i < orderFB; i++)
{
oDelay[i] = oAdder[i+1];
}
}
void output()
{
oIIR.write(oAdder[0].read());
}
/* Deconstructor */
~IIR_TFII()
{
}
T *a, *b;
};
/sciir/trunk/SystemC/tfii/Step.txt
0,0 → 1,16
 
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
/sciir/trunk/SystemC/tfii/Impulse.txt
0,0 → 1,16
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/sciir/trunk/SystemC/tfii/Stimuli.h
0,0 → 1,82
/** This function read in a text file into a local variable and export it
in array format */
template<class T> T* ReafFileData(int Size)
{
T *values = new T[Size];
int numValuesRead = 0;
 
// open the file
FILE* pFile = fopen("Step.txt","r+t");
 
while( ! feof( pFile ) )
{
T currentInt = 0;
fscanf( pFile, "%f", &currentInt);
values[numValuesRead] = currentInt ;
numValuesRead++;
}
 
fclose(pFile);
 
return values;
 
delete pFile;
}
 
/** This module/block start reading the data from the array data
when the clear signal is set to zero and at each rising edge of the clock */
template<class T>
SC_MODULE(Stimuli) {
// Input and Output Ports
sc_in_clk clk;
sc_in<bool> clr;
sc_out<T > streamout;
 
// Internal variable
unsigned int count;
float *data;
// Constructor
SC_HAS_PROCESS(Stimuli);
Stimuli(sc_module_name name, int _Size):
sc_module(name),
Size(_Size)
{
SC_METHOD(bitstream);
sensitive << clr << clk.pos();
data = ReafFileData<float> (Size);
}
 
// Process
void bitstream()
{
if (clr == true)
{
count = 0;
streamout.write(0.0);
}
else
{
if (clk.posedge())
{
if (count < Size)
{
streamout.write(data[count]);
count = count + 1;
}
else
{
count = 0;
}
}
}
}
 
~Stimuli()
{
}
int Size;
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.