Jump to content

Yash Jain

Members
  • Content Count

    5
  • Joined

  • Last visited

  1. I fixed the error: For anyone else wondering. Please use: wait(incoming1.posedge_event() | incoming2.posedge_event() | incoming3.posedge_event());
  2. I am getting this error for my wait() #include "systemc.h" SC_MODULE(server){ 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"}; sc_out<bool> outgoing1{"outgoing1"}; sc_out<bool> outgoing2{"outgoing2"}; sc_out<bool> outgoing3{"outgoing3"}; void monitor(){ free = true; outgoing1 = false; outgoing2 = false; outgoing3 = false; while(true){ cout << "Inside this loop" << endl; wait(incoming1.pos() | incoming2.pos() | incoming3.pos()); cout << "After first wait" << endl; //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){ //outgoing1 = false; //outgoing2 = false; //outgoing3 = false;' cout << "Started" << endl; SC_THREAD(monitor); //sensitive << incoming1.pos() << incoming2.pos() << incoming3.pos(); } }; Any suggestions on what the problem is?
  3. 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.
  4. 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; }
  5. I am getting the following error. I can't figure out why I am getting 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(); } }; 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); } }
×
×
  • Create New...