systemC 错误:没有构造函数"BlackBox<R、expR、C、expC、T、expT> ...等
systemC Error: No instance of constructor "BlackBox<R, expR, C, expC, T, expT> ... etc
我正试图在SystemC中创建一个模块,但不得不与此错误作斗争。
错误:没有构造函数"BlackBox::BlackBox with[R=1, expR =3, C=5, expC=-6, T=1, expT=-1]"的实例匹配参数列表
我不知道问题在哪里。似乎是这行代码造成的:
dut0 = new BlackBox<1,3, 5,-6, 1,-4> ("DUT0");
//ERROR
//(this is Core_osc.h)
#include <systemc.h>
#include <sc_float.h>
#include <cmath>
#ifndef _CORE_OSC_H_
#define _CORE_OSC_H_
////CIRCUIT ELEMENTS DEFINITION
//#define R //definition of value of R - resistance
//#define C //definition of value of C - kapacitance
//#define T //definition of value of T - Time step
template <int R, int expR, int C, int expC, int T, int expT>
class BlackBox : public sc_module //MODULE DECLARATION
{
public:
//PORTS
//inputs
sc_in_clk clk;
sc_in<bool> rst;
sc_in<bool> en;
//outputs
sc_out< sc_float<5,10> > outp; // half precision output (1b_sign, 5b_exponent, 10b_mantisa)
//handshaking
sc_in<bool> inp_vld;
sc_out<bool> inp_rdy;
sc_in<bool> outp_rdy;
sc_out<bool> outp_vld;
//COEFICIENTS AND PARAMETERS OF sc_exp_core
const sc_float<5,10> coef0;
const sc_float<5,10> coef1;
const sc_float<5,10> coef2;
#include "sc_exp.inc"
//FUNCTION
void oscilator();
//CONSTRUCTOR
SC_HAS_PROCESS( BlackBox );
BlackBox(): coef0(coef_1_2()), coef1(coef_1_2()), coef2(coef_3()),
//(sc_module_name nm): sc_module(nm),
//inputs
clk ("clk"),
rst ("rst"),
en ("en"),
//outputs
outp ("outp"),
//handshaking
inp_vld ("inp_vld"),
inp_rdy ("inp_rdy"),
outp_rdy ("outp_rdy"),
outp_vld ("outp_vld")
{
SC_CTHREAD( oscilator, clk.pos());
reset_signal_is( rst, true );
}
};//END MODULE DECLARATION
#endif
// (this is Core_osc.cpp)
#include <systemc.h>
#include <sc_float.h>
#include "core_osc.h"
#ifndef _CORE_OSC_CPP_
#define _CORE_OSC_CPP_
// FUNCTION OSCILATOR
// [calculation of next value of sequence]
void BlackBox<1,3, 5,-6, 1,-4>::oscilator(void)
{
//
//INTERNALS
sc_float<5,10> func_value;
sc_float<5,10> Uz;
Uz = 100.0;
//in
bool en_var;
//out
sc_float<5,10> outp_var;
//temporary for reset
sc_float<5,10> tmp;
tmp = 0.0;
//RESET_EXECUTION
outp_var = 0.0; //reseting internals
inp_rdy.write(false); //handshaking_reset
outp_vld.write(false);
outp.write(tmp);
wait();
//RESET_OVER
while(true)
{
/// //handshaking input
inp_rdy.write(true);
do{
wait();
} while(!inp_vld.read());
en_var = en.read();
inp_rdy.write(false);
/// /////////////
if( en )
{
sc_exp(coef0, coef1, coef2, &func_value, Uz, en_var);
//func_value[1] = func_value[0];
}
//wait();
/// //handshaking output
outp_vld.write(true);
do {
wait();
} while (!outp_rdy.read());
outp.write(func_value);
outp_vld.write(false);
/// ////////
}//end while
}//end func
#endif
//(this is sc_exp.inc)
// ------------------------------------------------------------------
// ---------------------------- Exponent function -------------------
// ------------------------------------------------------------------
///////////////////////////////////////////////////////
/////// CORE FUNCTION ///////
/////// [calculation of next value of sequence] ///////
///////////////////////////////////////////////////////
void sc_exp(sc_float<5,10> coef0,sc_float<5,10> coef1, sc_float<5,10> coef2, sc_float<5,10> *func_value, sc_float<5,10> Uz, bool en)
{
if(en)
{ //current //previous
*func_value = coef0*Uz + coef1*Uz + coef2*(*func_value);
}
}
///////////////////////////////////////////////////////////////////
////CALCULATION COEFICIENTS OF SEQUENE
////[sequence is obtained from bilinear transform of RC(RL) circuit]
//////////////////////////////////////////////////////////////////////
sc_float<5,10> coef_1_2()
{
double tmp_R = R*pow(10.0,expR);
double tmp_C = C*pow(10.0,expC);
double tmp_T = T*pow(10.0,expC);
return((tmp_T)/(2*tmp_R*tmp_C+tmp_T));}
sc_float<5,10> coef_3()
{
double tmp_R = R*pow(10.0,expR);
double tmp_C = C*pow(10.0,expC);
double tmp_T = T*pow(10.0,expC);
return((2*tmp_R*tmp_C-tmp_T)/(2*tmp_R*tmp_C+tmp_T));
}
/////////////////////////////////////////////////////////////////////////
//(this is Main function) - there is also test bench header and cpp
#include <systemc.h>
#include <sc_float.h>
#include "core_osc.h"
#include "Core_tb.h"
#ifndef _MAIN_CORE_CPP_
#define _MAIN_CORE_CPP_
class Main_Core : public sc_module
{
public:
//INTERNAL SIGNALS
sc_clock clk_sig;
sc_signal<bool> rst_sig;
sc_signal<bool> en_sig;
sc_signal< sc_float<5,10> > outp_sig;
//handshaking
sc_signal<bool> inp_vld_sig;
sc_signal<bool> inp_rdy_sig;
sc_signal<bool> outp_vld_sig;
sc_signal<bool> outp_rdy_sig;
//INSTANCES
BlackBox<1,3, 5,-6, 1,-4> *dut0;
BlackBox_TB *tb0;
//CONSTRUCTOR
SC_HAS_PROCESS(Main_Core);
Main_Core (sc_module_name nm): sc_module(nm),
clk_sig ("clk_sig", 10, SC_NS),
//inp signals to DUT
rst_sig ("rst_sig"),
en_sig ("en_sig"),
//outp signals from DUT
outp_sig ("outp_sig")
{
dut0 = new BlackBox<1,3, 5,-6, 1,-4> ("DUT0"); //ERROR
tb0 = new BlackBox_TB ("TB0");
dut0->clk (clk_sig);
dut0->rst (rst_sig);
dut0->en (en_sig);
dut0->outp (outp_sig);
//handshaking
dut0->inp_vld (inp_vld_sig);
dut0->inp_rdy (inp_rdy_sig);
dut0->outp_vld (outp_vld_sig);
dut0->outp_rdy (outp_rdy_sig);
tb0->clk (clk_sig);
tb0->rst (rst_sig);
tb0->en (en_sig);
tb0->outp (outp_sig);
//handshaking
tb0->inp_vld (inp_vld_sig);
tb0->inp_rdy (inp_rdy_sig);
tb0->outp_vld (outp_vld_sig);
tb0->outp_rdy (outp_rdy_sig);
}
//DESTRUCTOR
~Main_Core()
{
delete dut0;
delete tb0;
}
};
#endif
int sc_main(int argc, char* argv[])
{
Main_Core *SYSTEM0 = new Main_Core ("SYSTEM0");
sc_start();
return 0;}
从查看您的代码和给出的错误,您似乎错过了BlackBox
构造函数,该构造函数接受字符串(或指向char的指针)参数:
BlackBox::BlackBox(const char *); // or similar
或
BlackBox::BlackBox(const std::string& s); // or similar
您需要定义一个类似于上述构造函数的构造函数
相关文章:
- 如何理解C++标准N3337中的expr.const.cast子句8
- expr[{ .. }] 有什么用?
- 在 z3::expr 中使用C++字符串?
- 是否可以使用"if constexpr"来声明具有不同类型和init-expr的变量
- 这是当前草案中[Expr.Ref]/(4.2)和[Expr.sub]/1之间的矛盾
- [expr.unary.op]/9 似乎暗示"运算符!()' 不能应用于下面的类型 A.但编译器不同意这一点
- 无法专用化函数模板'unknown-type std::invoke(_Callable &&,_Types &&...) noexcept(<expr>)'
- 为什么这句话"The expression can be used only as the left-hand operand of a member function call"在 [expr.re
- 野牛的错误:“ yyval.yystype :: expr”没有类型
- 自定义一元/二进制Expr() eigen3 的参数
- [expr.ref]/2 中的左值到右值转换
- [expr.cond]/2 中不是缺少一些东西吗?
- 具有特征类型输出的特征二进制 Expr
- 如何避免Expr中的溢出.A B C D
- 使用带有提升/正则表达式的 Rcpp,在 eval(expr, envir, enclos) 中出错:找不到对象 'libboost_regex'
- 成员函数中的decltype(auto)忽略无效的正文,declttype(expr)失败
- int(expr)在C++中的含义是什么
- "new (expr-list) type"操作的含义和示例
- 构造函数何时调用 const-expr
- systemC 错误:没有构造函数"BlackBox<R、expR、C、expC、T、expT> ...等