简体   繁体   English

错误:(E107)将接口绑定到端口失败:接口已绑定到端口:端口'MC8051_ALU()。AM.port_27'(sc_in)

[英]Error: (E107) bind interface to port failed: interface already bound to port: port 'MC8051_ALU().AM.port_27' (sc_in)

hello I am new to systemc. 你好,我是systemc的新手。 I am assigned a task of connecting all lower modules of alu of 8051(ie addsub,mutliplier,divider). 我被分配了连接8051的所有较低模块的任务(即addsub,mutliplier,divider)。 I have written code which is compiling without any error but when i run object file I get the following error Error: (E107) bind interface to port failed: interface already bound to port: port 'MC8051_ALU().AM.port_27' (sc_in) 我编写了正在编译的代码,没有任何错误,但是当我运行目标文件时,出现以下错误错误:(E107)将接口绑定到端口失败:接口已绑定到端口:端口'MC8051_ALU()。AM.port_27'(sc_in )

this is mc8051_alu().cpp file 这是mc8051_alu()。cpp文件

#include "systemc.h"
#include <alumux.h>
#include <addsub_core.h>
#include <comb_mltplr.h>
#include <comb_divider.h>
#include <dcml_adjust.h>

SC_MODULE(mc8051_alu) {
//inputs of the block
sc_in< sc_bv<8> > rom_data_i,ram_data_i,acc_i;
sc_in< sc_bv<6> > cmd_i;
sc_in< sc_bv<2> > cy_i;
sc_in< sc_bv<1> > ov_i; 
//outs of th block 
sc_out< sc_bv<1> > new_ov_o; 
sc_out< sc_bv<2> > new_cy_o;
sc_out< sc_bv<8> > result_a_o,result_b_o;
//making an instance of every block 

//intrtnal signal of the block to connect the units alumux, addsub_core, alucore,_comb_mltplr,comb_divider and decimal_adjust together.
sc_signal< sc_bv<8> > s_alu_result;
sc_signal< sc_bv<2> > s_alu_new_cy;
sc_signal< sc_bv<8> > s_alu_op_a;
sc_signal< sc_bv<8> > s_alu_op_b;
sc_signal< sc_bv<4> > s_alu_cmd;
sc_signal< sc_bv<8> > s_dvdnd;
sc_signal< sc_bv<8> > s_dvsor;
sc_signal< sc_bv<8> > s_qutnt;
sc_signal< sc_bv<8> > s_rmndr;
sc_signal< sc_bv<8> > s_mltplcnd;
sc_signal< sc_bv<8> > s_mltplctr;
sc_signal< sc_bv<8> > s_product;
sc_signal< sc_bv<8> > s_dcml_data;
sc_signal< sc_bv<8> > s_dcml_rslt;
sc_signal< sc_bv<1> > s_dcml_cy;
sc_signal< sc_bv<8> > s_addsub_rslt;
sc_signal< sc_bv<2> > s_addsub_newcy;
sc_signal< sc_bv<1> > s_addsub_ov;
sc_signal< sc_bv<1> > s_addsub_cy;
sc_signal< sc_bv<1> > s_addsub;
sc_signal< sc_bv<8> > s_addsub_opa;
sc_signal< sc_bv<8> > s_addsub_opb;
//constructor of the module
SC_CTOR(mc8051_alu) 
{
// connecting alumux inputs and outputs 

  alumux am("AM");
  addsub_core asc("ASC");
  comb_mltplr cm("CM");
  comb_divider cd("CD");
  dcml_adjust da("DA");

  am.rom_data_i(rom_data_i);
  am.ram_data_i(ram_data_i);
  am.acc_i(acc_i);
  am.cmd_i(cmd_i);
  am.cy_i(cy_i);
  am.ov_i(ov_i);
  am.cy_o(new_cy_o);
  am.ov_o(new_ov_o);
  am.result_a_o(s_addsub_opa);
  am.result_b_o(result_b_o);
  am.result_i(s_alu_result);
  am.new_cy_i(s_alu_new_cy);
  am.addsub_rslt_i(s_addsub_rslt);
  am.addsub_cy_i(s_addsub_newcy);
  am.addsub_ov_i(s_addsub_ov);
  am.op_a_o(s_alu_op_a);
  am.op_b_o(s_alu_op_b);
  am.alu_cmd_o(s_alu_cmd);
  am.opa_o(s_addsub_opa);
  am.opb_o(s_addsub_opb);
  am.addsub_o(s_addsub);
  am.addsub_cy_o(s_addsub_cy);
  am.addsub_ov_i(s_addsub_ov);
  am.dvdnd_o(s_dvdnd);
  am.dvsor_o(s_dvsor);
  am.qutnt_i(s_qutnt);
  am.rmndr_i(s_rmndr);
  am.mltplcnd_o(s_mltplcnd);
  am.mltplctr_o(s_mltplctr);
  am.product_i(s_product);
  am.dcml_data_o(s_dcml_data);
  am.dcml_data_i(s_dcml_rslt);
  am.dcml_cy_i(s_dcml_cy); 

// connecting alucore inputs and outputs 
 // ac.op_a_i(s_alu_op_a);
 // ac.op_b_i(s_alu_op_b);
 // ac.alu_cmd_i(s_alu_cmd);
 // ac.cy_i(cy_i);
 // ac.cy_o(s_alu_new_cy);
 // ac.result_o(s_alu_result);

// connecting addsub_core inputs and outputs 
  asc.opa_i(result_a_o);
  asc.opb_i(s_addsub_opb);
  asc.addsub_i(s_addsub);
  asc.cy_i(s_addsub_cy);
  asc.cy_o(s_addsub_newcy);
  asc.ov_o(s_addsub_ov);
  asc.result_o(s_addsub_rslt);
// connecting comb_mltplr inputs and outputs 
  cm.mltplcnd_i(s_mltplcnd);
  cm.mltplctr_i(s_mltplctr);
  cm.product_o(s_product);
// connecting comb_divider inputs and outputs 
  cd.dvdnd_i(s_dvdnd);
  cd.dvsor_i(s_dvsor);
  cd.qutnt_o(s_qutnt);
  cd.rmndr_o(s_rmndr);
// connecting dcml_adjust inputs and outputs 
  da.data_i(s_dcml_data);
  da.cy_i(cy_i);
  da.data_o(s_dcml_rslt);
  da.cy_o(s_dcml_cy);
}
};

now when i want to run this by writing a testbench in main function i am getting above error 现在,当我想通过在主函数中编写一个测试台来运行此程序时,我遇到了错误

this is my main.cpp file 这是我的main.cpp文件

 #include "systemc.h"
#include "mc8051_alu().cpp"
//#include "stim.h"

int sc_main (int argc, char* argv[]) {


        sc_signal< sc_bv<6> > cmd_i; //= sc_uint<8>(1);
    sc_signal< sc_bv<8> > result_a_o,result_b_o,rom_data_i,ram_data_i,acc_i;

        sc_signal< sc_bv<2> > cy_i,new_cy_o;
        sc_signal< sc_bv<1> > ov_i,new_ov_o;
 mc8051_alu DUT("MC8051_ALU()");(//LINE WHERE ERROR IS COMING)
DUT.rom_data_i(rom_data_i);
DUT.ram_data_i(ram_data_i);
DUT.acc_i(acc_i);
DUT.cmd_i(cmd_i);
DUT.ov_i(ov_i);
DUT.cy_i(cy_i);
DUT.new_ov_o(new_ov_o);
DUT.new_cy_o(new_cy_o);
DUT.result_a_o(result_a_o);
DUT.result_b_o(result_b_o);

cmd_i= 0b010101;
sc_start(sc_time(1,SC_NS));

cout << "this is here"<< endl;
cout << cmd_i<< endl;

sc_stop();
return 0;
}

It is good practice to name all your objects especially your ports and signals, so that error messages make more sense by directly pointing to the relevant object. 优良作法是为所有对象命名,尤其是为端口和信号命名,以便通过直接指向相关对象来使错误消息更有意义。 Do that in the module constructor initialization list. 在模块构造函数初始化列表中执行此操作。

Without all code its difficult to say, but most certainly your error is from "am.addsub_ov_i(s_addsub_ov);". 没有所有代码,很难说,但是最肯定的是您的错误来自“ am.addsub_ov_i(s_addsub_ov);”。 You have that line twice in your constructor. 您在构造函数中有两次该行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM