1

我正在使用 systemc 进行模拟,我收到一条错误消息,告诉我

g++ -I/opt/Xilinx-14.2/Vivado_HLS/2012.2/Linux_x86_64/tools/systemc/include/ -o testBench.exe testBench.cc -L/opt/Xilinx-14.2/Vivado_HLS/2012.2/Linux_x86_64/tools/systemc/lib -lsystemc -lm /opt/Xilinx-14.2/Vivado_HLS/2012.2/Linux_x86_64/tools/systemc/include/sysc/communication/sc_signal_ports.h:在成员函数 void sc_core::sc_in::end_of_elaboration() [with T = std: :basic_string, std::allocator >]: testBench.cc:126: 从这里实例化

/opt/Xilinx-14.2/Vivado_HLS/2012.2/Linux_x86_64/tools/systemc/include/sysc/communication/sc_signal_ports.h:285:错误:没有匹配函数调用 sc_trace(sc_core::sc_trace_file*&, const std:: basic_string, std::allocator >&, std::string&)

你们对这个错误是什么以及如何解决它有任何想法吗?

#include "systemc.h"
#include "multiChipModule.cc"
#include <vector>
#include <string>
#include <iostream>
int convertTime(std::string input){   
// then main invocator function
int timeInt=atoi(input.substr(0,11).c_str());
int output =0;
for(int i=0;timeInt >0;i++){
 if(timeInt % 10 ==1) {
    output += static_cast<int> (pow(2,i));
    }
    timeInt /=10;
 }
    return output;
}


// include string
int sc_main(int argc,char* argv[]){
sc_signal<bool> BCOclock;
sc_signal<bool> MCA;
sc_signal<bool> MCB;
sc_signal<bool> enable;
sc_signal<sc_uint<8> > BCONumber;
sc_signal<std::string > inputMessage;
// input message will have 24 bits. The first 11 bits are for time.
//The next three bits more moduleNo, three bits for chipNo, seven bits for 
//stripNo. So in total it is 24 bits.


sc_signal<bool> SCLK;
sc_signal<bool> RCLK;
sc_signal<bool> outCLK;


multiChipModule module1("module1");
module1.BCOclock(BCOclock);
module1.MCA(MCA);
module1.MCB(MCB);
module1.SCLK(SCLK);
module1.RCLK(RCLK);
module1.outCLK(outCLK);
module1.enable(enable);
module1.BCONumber(BCONumber);
module1.inputMessage(inputMessage);

sc_start(0);
/*
sc_trace_file *wf=sc_create_vcd_trace_file("testBench");
sc_trace(wf,BCOclock,"BCOclock");
sc_trace(wf,MCA,"MCA");
sc_trace(wf,MCB,"MCB");
sc_trace(wf,enable,"enable");
sc_trace(wf,BCONumber,"BCONumber");
//sc_trace wf,coreTalking
sc_trace(wf,SCLK,"SCLK");
sc_trace(wf,RCLK,"RCLK");
sc_trace(wf,outCLK,"outCLK");
*/
//initialize all variables
cout<<"@"<<sc_time_stamp()<<"Asserting Enable\n"<<endl;
enable=1;
SCLK=1;
RCLK=1;
outCLK=0;
BCOclock=1;
MCA=1;
MCB=0;
BCONumber=0;
std::vector<std::string> vec1;
std::vector<int> vec2;
std::vector<std::string>::iterator it1;
std::vector<int>::iterator it2;
it1=vec1.begin();
it2=vec2.begin();
std::string input ="000111101000010010000000";
int time= convertTime(input);
it1=vec1.insert(it1,input);
it2=vec2.insert(it2,time);
input="010000100110010011111111";
time=convertTime(input);
it1=vec1.insert(it1,input);
it2=vec2.insert(it2,time);
//sorting here
int minimum=vec2[0];
int index=0;
for(int i=0;i<vec2.size();i++){
  for (int j=i;j<vec2.size();j++){
  if(vec2[j]<minimum){
    minimum=vec2[j];
    index=j;
    }
  }
  int tempTime =vec2[i];
  vec2[i]=vec2[index];
  vec2[index]=tempTime;
  std::string tempString=vec1[i];
  vec1[i]=vec1[index];
  vec1[index]=tempString;

  minimum=vec2[i];
  index=i;
}

int t=0;
for(int i=0;i<1000;i++){
 for(int j=0;j<vec2.size();j++){
  if(i==vec2[j])
    inputMessage=vec1[j];
 }
if(i%10==0)
  MCA=!MCA;
if((i-5)%10==0)
  MCB=!MCB;
if(i%132==0)
  BCOclock=!BCOclock;

 sc_start(1);
}
cout<<"@"<<sc_time_stamp()<<"De-Asserting Enable\n"<<endl;
enable=0;

cout<<"@"<<sc_time_stamp()<<"Terminating Simulation\n"<<endl;
sc_close_vcd_trace_file(wf);
return 0;
}
4

1 回答 1

1

错误来自"sc_signal<std::string > inputMessage;". "T = std::string"没有为、sc_insc_trace、等定义一大堆模板类/函数vcd_trace

但问题更根本:你为什么要使用std::stringa sc_signal?从代码中的注释中,您最好使用sc_uint<24>可以使用二进制字符串(如"0b1111..11".

Instead of 
   std::string input ="000111101000010010000000";
use
    sc_uint<24> input = "0b000111101000010010000000";
于 2013-04-01T05:56:03.257 回答