Hi,
I have followed the design in systemC, but I have some troubles when instantiating multiples components. In bankreg.h I have the instantiation of several registers.
The problem is that after execution, I have the following errors for each register:
Warning: (W505) object already exists: bankreg.memory.port_0. Latter declaration will be ignored In file: sc_object.cpp:164 Warning: (W505) object already exists: bankreg.memory.port_1. Latter declaration will be ignored In file: sc_object.cpp:164 Warning: (W505) object already exists: bankreg.memory.port_2. Latter declaration will be ignored In file: sc_object.cpp:164 Warning: (W505) object already exists: bankreg.memory.port_3. Latter declaration will be ignored In file: sc_object.cpp:164 Warning: (W505) object already exists: bankreg.memory.port_4. Latter declaration will be ignored In file: sc_object.cpp:164 Warning: (W505) object already exists: bankreg.memory.behaviour. Latter declaration will be ignored In file: sc_object.cpp:164 Error: (E112) get interface failed: port is not bound: port 'bankreg.port_4' (sc_out) Error: (E112) get interface failed: port is not bound: port 'bankreg.port_7' (sc_out)
Find attached both .h files: //bankreg.h #include "librairie.h" #include "reg.h" #ifndef __bankreg_h__ #define __bankreg_h__ SC_MODULE(bankreg) { //sc_in clearn; sc_in new_data[MAT_WIDTH]; sc_in enable_data; sc_in clk; sc_in reset_intern; sc_out output[MAT_LENGTH][MAT_WIDTH]; sc_signal out_reg[MAT_LENGTH][MAT_WIDTH];
SC_CTOR(bankreg) {
reg *memory[MAT_LENGTH][MAT_WIDTH];
for (int i=0; i < MAT_LENGTH; i++) { for (int j=0; j < MAT_WIDTH; j++) { memory[i][j] = new reg("memory"); if (i==0) { memory[i][j]->input(new_data[j]); memory[i][j]->enable(enable_data); memory[i][j]->clearn(reset_intern); memory[i][j]->clk(clk); memory[i][j]->output(out_reg[i][j]); } else { memory[i][j]->input(out_reg[i-1][j]); memory[i][j]->enable(enable_data); memory[i][j]->clearn(reset_intern); memory[i][j]->clk(clk); memory[i][j]->output(out_reg[i][j]); } } } for (int i=0; i < MAT_LENGTH; i++) { for (int j=0; j < MAT_WIDTH; j++) { output[i][j] = (out_reg[i][j]).read(); } } } }; #endif
//reg.h #include "librairie.h" #ifndef __reg_h__ #define __reg_h__ template SC_MODULE(reg) { const static int MAX = size; sc_in input; sc_in enable; sc_in clearn; sc_in clk; sc_out output;
unsigned int value;
void behaviour() { if (clearn == false){ value = 0; } else if (enable) { value = input.read(); } else { value = value; } output = value; } SC_CTOR(reg) { SC_METHOD(behaviour); sensitive_pos