Yash Jain Posted May 4, 2020 Report Share Posted May 4, 2020 I am getting the following error. I can't figure out why I am getting error: Quote get interface failed: port is not bound: port 'server.outgoin1' (sc_out) 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(); } }; And this is my testbench 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); } } Quote Link to comment Share on other sites More sharing options...
Eyck Posted May 4, 2020 Report Share Posted May 4, 2020 You are writing to ports in the constructor of server. At this point they are not bound. Since you initialize them in the beginning of your thread this is not needed anyways. Aside of that you also do not need the sensitivity list for the monitor thread as you never use the default sensitivity (by using wait() ). And if you use C++11 or newer you should use In-class member initializers which eases the naming of signals (and you should name them to make debugging easier): sc_in<bool> begin1{"begin1"}, begin2{"begin2"}, begin3{"begin3"}; sc_in<bool> end1{"end1"}, end2{"end2"}, end3{"end3"}; sc_in<bool> incoming1{"incoming1"}, incoming2{"incoming2"}, incoming3{"incoming3"}; sc_out<bool> free{"free"}, outgoing1{"outgoing1"}, outgoing2{"outgoing2"}, outgoing3{"outgoing3"}; David Black 1 Quote Link to comment Share on other sites More sharing options...
Yash Jain Posted May 4, 2020 Author Report Share Posted May 4, 2020 Hey Eyck. Nothing was fixed. I removed the ports in the constructor and I' still getting the error: SC_CTOR(server){ SC_THREAD(monitor); } In fact I tried simplifying it further and still get the error: void monitor(){ free = true; outgoing1 = false; outgoing2 = false; outgoing3 = false; } Quote Link to comment Share on other sites More sharing options...
Yash Jain Posted May 4, 2020 Author Report Share Posted May 4, 2020 Update. I removed the testbench and added a new testbench for a different module. I deleted the old one and re-added the tb_server.cpp testbench and now I'm not getting the error. Not sure if this a problem in systemC or my compiler. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.