c++systemc

Error: (E112) get interface failed: port is not bound: port 'server.outgoin1' (sc_out)


I can't seem to figure out why I am getting the error.

server.cpp

#include "systemc.h"

SC_MODULE(server){
    sc_in<bool> begin1, begin2, begin3, end1, end2, end3, incoming1, incoming2, incoming3;
    sc_out<bool> free, outgoing1, outgoing2, outgoing3;

void monitor(){
    free = true;
    outgoing1 = false;
    outgoing2 = false;
    outgoing3 = false;

    while(true){
        wait(incoming1 | incoming2 | incoming3);

        //Mobile 1
        if(incoming1 == true){
            cout << "Mobile 1 received." << endl;
            while(!free); // Wait for the server to free up

            //Now that the server has freed up, proceed
            outgoing1 = true;
            free = false;
            wait(begin1);
            cout << "Begin1 @" << sc_simulation_time() << endl;
            wait(end1);
            cout << "End1 @" << sc_simulation_time() << endl;
            free = true;
        }

        //Mobile 2
        if(incoming2 == true){
            cout << "Mobile 2 received." << endl;
            while(!free);// Wait for the server to free up

            //Now that the server has freed up, proceed
            outgoing2 = true;
            free = false;
            wait(begin2);
            cout << "Begin2 @" << sc_simulation_time() << endl;
            wait(end2);
            cout << "End2 @" << sc_simulation_time() << endl;
            free = true;
        }

        //Mobile 3
        if(incoming3 == true){
            cout << "Mobile 3 received." << endl;
            while(!free);// Wait for the server to free up

            //Now that the server has freed up, proceed
            outgoing3 = true;
            free = false;
            wait(begin3);
            cout << "Begin3 @" << sc_simulation_time() << endl;
            wait(end3);
            cout << "End3 @" << sc_simulation_time() << endl;
            free = true;
        }
    }
}

SC_CTOR(server):free("free"), outgoing1("outgoin1"), outgoing2("outgoing2"),outgoing3("outgoing3"){
    outgoing1 = false;
    outgoing2 = false;
    outgoing3 = false;
    SC_THREAD(monitor);
    sensitive << incoming1.pos() << incoming2.pos() << incoming3.pos();
}};

tb_server.cpp

  #include "systemc.h"
#include "server.cpp"

int sc_main(int argc, char* argv[]){
  //Inputs
  sc_signal<bool> begin1;
  sc_signal<bool> begin2;
  sc_signal<bool> begin3;
  sc_signal<bool> end1;
  sc_signal<bool> end2;
  sc_signal<bool> end3;
  sc_signal<bool> incoming1;
  sc_signal<bool> incoming2;
  sc_signal<bool> incoming3;
  sc_signal<bool> outgoing1;
  sc_signal<bool> outgoing2;
  sc_signal<bool> outgoing3;
  sc_signal<bool> free;


  server srvr("server");
  srvr.begin1(begin1);
  srvr.begin2(begin2);
  srvr.begin3(begin3);
  srvr.end1(end1);
  srvr.end2(end2);
  srvr.end3(end3);
  srvr.incoming1(incoming1);
  srvr.incoming2(incoming2);
  srvr.incoming3(incoming3);
  srvr.outgoing1(outgoing1);
  srvr.outgoing2(outgoing2);
  srvr.outgoing3(outgoing3);
  srvr.free(free);

  incoming1 = 1;
  incoming2 = 1;
  incoming3 = 1;

  for(int i = 0; i < 30; i++){
    sc_start(10, SC_MS);
  }

}

I get the following error:

Error: (E112) get interface failed: port is not bound: port 'server.outgoin1' (sc_out) In file: /systemc-2.3.2/./src/sysc/communication/sc_port.cpp:233

I'm pretty sure based on my code I've connected the outgoing ports


Solution

  • Deleting the executable file and recompiling the code helped me out.