|
-
April 2nd, 2009, 08:19 AM
#1
template error link
I wrote this template
code:
tPMF_Receiver.h
#include "ac_int.h"
#include "ac_channel.h"
typedef ac_int<1,false> PN_Code_Data_Type; //!<PN code type
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
class TCReceiver
{
private :
static IQ_Data_Type pI_data[Num_FFT*Num_Sample_Per_Chip*Num_Chips_In_PMF_Structure]; //!<Array data I in input
static IQ_Data_Type pQ_data[Num_FFT*Num_Sample_Per_Chip*Num_Chips_In_PMF_Structure]; //!<Array data Q in input
IQ_Data_Type pFFT_I_data_out[Num_FFT]; //!<Array FFT transform of I data to out
IQ_Data_Type pFFT_Q_data_out[Num_FFT]; //!<Array FFT transform of Q data to out
IQ_Data_Type pFFT_I_data_in[Num_FFT]; //!<Array of I data to FFT transform
IQ_Data_Type pFFT_Q_data_in[Num_FFT]; //!<Array of Q data to FFT transorm
static PN_Code_Data_Type pPN_code[Num_FFT*Num_Sample_Per_Chip]; //!<PN code
static PN_Code_Data_Type p_PN_code_upsampling[Num_FFT*Num_Sample_Per_Chip*Num_Chips_In_PMF_Structure]; //!<PN code upsamplingly
void pShift_IQ_array(IQ_Data_Type I_sample, IQ_Data_Type Q_sample);
void pComplex_partial_match_filter();
public:
TCReceiver <IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>()
{
};
~TCReceiver <IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>()
{
};
void Add_IQ_sample(ac_channel<IQ_Data_Type> *I_channel,ac_channel<IQ_Data_Type> *Q_channel);
void Get_out_PMF(IQ_Data_Type I_data_out_pmf[Num_FFT], IQ_Data_Type Q_data_out_pmf[Num_FFT]);
void Set_PN_sequence(PN_Code_Data_Type PN_sequence[Num_FFT*Num_Sample_Per_Chip]);
void Test();
//{
//};
};
tPMF_Receiver.cpp
#include "tPMF_Receiver.h"
#pragma design
/*! \brief Shift function
*
* This function shift left of 1 position \ref pI_data and \ref pQ_data array
*
*\param I_sample [in] Input I sample
*\param Q_sample [in] Input Q sample
*/
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
void TCReceiver<IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>: Shift_IQ_array(IQ_Data_Type I_sample, IQ_Data_Type Q_sample)
{
IQ_Data_Type I_temp = 0, Q_temp = 0;
SHIFT: for(int i = Num_FFT*Num_Sample_Per_Chip*Num_Chips_In_PMF_Structure-1; i>=0 ; i--)
{
if(i == 0)
{
pI_data[i] = I_sample;
pQ_data[i] = Q_sample;
}
else
{
pI_data[i] = pI_data[i-1];
pQ_data[i] = pQ_data[i-1];
}
}
}
#pragma design
/*! \brief Complex PMF structure
*
* This function estimated output of complex partial matched filter and set \ref pFFT_I_data_in and \ref pFFT_Q_data_in
*
*/
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
void TCReceiver<IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>: Complex_partial_match_filter()
{
}
#pragma design
/*! \brief Add sample
*
* This function receive a sample of I and Q data
*
*\param I_channel [in] I channel
*\param Q_channel [in] Q channel
*
*/
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
void TCReceiver<IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>::Add_IQ_sample(ac_channel<IQ_Data_Type> *I_channel,ac_channel<IQ_Data_Type> *Q_channel)
{
pShift_IQ_array(I_channel->read(),Q_channel->read());
}
#pragma design
/*! \brief Get out of PMF
*
* This function get output of partial matched filter
*
*\param I_data_out_pmf [out] Output I array
*\param Q_data_out_pmf [out] Output Q array
*
*/
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
void TCReceiver<IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>::Get_out_PMF(IQ_Data_Type I_data_out_pmf[Num_FFT], IQ_Data_Type Q_data_out_pmf[Num_FFT])
{
}
#pragma design
/*! \brief Set PN sequence
*
* This function set PN sequence in \ref pPN_code
*
*\param PN_sequence [in] PN sequence
*
*/
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
void TCReceiver<IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>::Set_PN_sequence(PN_Code_Data_Type PN_sequence[Num_FFT*Num_Sample_Per_Chip])
{
//pPN_code = PN_sequence;
}
template <class IQ_Data_Type, class In_Data_Type, int Num_FFT, int Num_Chips_In_PMF_Structure, int Num_Sample_Per_Chip>
void TCReceiver<IQ_Data_Type,In_Data_Type,Num_FFT,Num_Chips_In_PMF_Structure,Num_Sample_Per_Chip>::Test()
{
}
main:
#include "tPMF_Receiver.h"
typedef ac_int<4,true> IQ_type;
typedef ac_int<4,true> In_type;
#define NUM_FFT 8
#define NUM_CHIPS 2
#define NUM_SAMPLE 2
#ifdef CCS_SCVERIFY
#include "mc_testbench.h"
#endif
void channelify(IQ_type in_data[], ac_channel<IQ_type>& in_channelify, int num_elem);
void unchannelify(IQ_type out_data[], ac_channel<IQ_type>& out_channelify, int num_elem);
void channelify(IQ_type in_data[], ac_channel<IQ_type>& in_channelify, int num_elem)
{
for (int i=0;i<num_elem;i++)
{
in_channelify.write(in_data[i]);
}
}
void unchannelify( IQ_type out_data[], ac_channel<IQ_type>& out_channelify, int num_elem)
{
for (int i=0;i<num_elem;i++)
{
out_data[i]=out_channelify.read();
}
}
#ifdef CCS_SCVERIFY
void testbench::main()
#else
int main()
#endif
{
PN_Code_Data_Type PN[NUM_FFT*NUM_CHIPS] = {
#include "PN code.txt"
};
TCReceiver<IQ_type,In_type,NUM_FFT,NUM_CHIPS,NUM_SAMPLE> receiver;
receiver.Test();
receiver.Set_PN_sequence(PN);
#ifdef CCS_SCVERIFY
//testbench::exec_function();
#else
//function();
#endif
#ifndef CCS_SCVERIFY
system("PAUSE");
#endif
}
when i compile this code, the compiler return this error:
Error 41 error LNK2019: unresolved external symbol "public: void __thiscall TCReceiver<class ac_int<4,1>,class ac_int<4,1>,8,2,2>::Set_PN_sequence(class ac_int<1,0> * const)" (?Set_PN_sequence@?$TCReceiver@V?$ac_int@$03$00@@V1@$07$01$01@@QAEXQAV?$ac_int@$00$0A@@@@Z) referenced in function _main Tb_main.obj PMF
I use vs 2008
what is this error??
Help me!!!!!!!!!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|