0
hello我是systemc的新手。我被分配了連接8051的所有較低模塊(即addsub,mutliplier,divider)的任務。我編寫的代碼編譯時沒有任何錯誤,但是當我運行目標文件時出現以下錯誤 錯誤:(E107)將接口綁定到端口失敗:接口已經綁定到端口:端口'MC8051_ALU()。AM.port_27' (sc_in)錯誤:(E107)將接口綁定到端口失敗:接口已綁定到端口:端口'MC8051_ALU()。AM.port_27'(sc_in)
這是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);
}
};
現在,當我想通過寫在主要功能的測試平臺我正在上面的錯誤越來越
這是運行這個我的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;
}
是的,我發現錯誤...謝謝你的回答.. –