Jump to content

KEVIN CHACKO

Members
  • Content Count

    7
  • Joined

  • Last visited

About KEVIN CHACKO

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The wait statements inside the dynamically spawned threads are the cause of the problem. The waits cause the threads to terminate without completing.
  2. I am trying to implement SC_JOIN any in a uvm component run phase analogous to SystemVerilog UVM, but the wait statements inside the threads are not executing in the run phase. It will work fine if I use SC_THREAD instead. Here is my code: The code is fine for SC_JOIN all and SC_JOIN NONE implementation. And apparently this issue is there for every uvm_component I instantiate. #include<systemc.h> #include<uvm> template <int TOP_DEPTH=10> class top: public uvm::uvm_component{ public: void fun1() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== fun1========" << endl; wait(30,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } void fun2() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== fun2========" << endl; wait(20,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } void run_phase(uvm::uvm_phase& phase) { cout<< " run: before fork/join" << endl; /*SC_FORK sc_spawn(sc_bind(&top::fun1, this)), sc_spawn(sc_bind(&top::fun2, this)) SC_JOIN*/ /*void(sc_spawn(sc_bind(&top::fun1, this))); void(sc_spawn(sc_bind(&top::fun2, this)));*/ std::vector<sc_process_handle> process_handles; process_handles.push_back(sc_spawn(sc_bind(&top::fun1, this)) ); process_handles.push_back(sc_spawn(sc_bind(&top::fun2, this)) ); sc_event_or_list terminated_events; for(std::vector<sc_process_handle>::iterator it = process_handles.begin(); it != process_handles.end(); ++it) { terminated_events |= (*it).terminated_event(); } wait( terminated_events ); //< wait for any process to exit for(std::vector<sc_process_handle>::iterator it = process_handles.begin(); it != process_handles.end(); ++it) { (*it).kill(); } cout << "run: after fork/join" << endl; wait(40,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } top (uvm::uvm_component_name name="top") : uvm::uvm_component( name ) { } }; int sc_main(int argc, char **argv) { top<15>* top_1; top_1 = new top<15>("top_1"); uvm::run_test(""); return 0; }
  3. KEVIN CHACKO

    How can I implement SC_FORK JOIN_ANY /SC_FORK JOIN_NONE

    Yes I could see that it work fine with regular SC_THREAD. Thanks for the help though.
  4. KEVIN CHACKO

    How can I implement SC_FORK JOIN_ANY /SC_FORK JOIN_NONE

    Sure The code is fine for SC_JOIN all and SC_JOIN NONE implementation. And apparently this issue is there for every uvm_component I instantiate. #include<systemc.h> #include<uvm> template <int TOP_DEPTH=10> class top: public uvm::uvm_component{ public: void fun1() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== fun1========" << endl; wait(30,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } void fun2() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== fun2========" << endl; wait(20,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } void run_phase(uvm::uvm_phase& phase) { cout<< " run: before fork/join" << endl; /*SC_FORK sc_spawn(sc_bind(&top::fun1, this)), sc_spawn(sc_bind(&top::fun2, this)) SC_JOIN*/ /*void(sc_spawn(sc_bind(&top::fun1, this))); void(sc_spawn(sc_bind(&top::fun2, this)));*/ std::vector<sc_process_handle> process_handles; process_handles.push_back(sc_spawn(sc_bind(&top::fun1, this)) ); process_handles.push_back(sc_spawn(sc_bind(&top::fun2, this)) ); sc_event_or_list terminated_events; for(std::vector<sc_process_handle>::iterator it = process_handles.begin(); it != process_handles.end(); ++it) { terminated_events |= (*it).terminated_event(); } wait( terminated_events ); //< wait for any process to exit for(std::vector<sc_process_handle>::iterator it = process_handles.begin(); it != process_handles.end(); ++it) { (*it).kill(); } cout << "run: after fork/join" << endl; wait(40,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } top (uvm::uvm_component_name name="top") : uvm::uvm_component( name ) { } }; int sc_main(int argc, char **argv) { top<15>* top_1; top_1 = new top<15>("top_1"); uvm::run_test(""); return 0; }
  5. KEVIN CHACKO

    How can I implement SC_FORK JOIN_ANY /SC_FORK JOIN_NONE

    Thank your for the help. But when I try implementing the fork_join any solution, I get this error invalid use of sc_(and|or)_event_list: list prematurely destroyed I am using the fork join any in a run phase process of a uvm systemc driver. This issue is reported specifically for 40th agent i am running out of 65 agents. Is it because the size of the process handles or the terminated_event list getting exhausted
  6. How can I have a virtual interface in systemC analogous to systemverilog
  7. How can i implement SC_FORK JOIN_ANY and SC_FORK JOIN_NONE in systemC which is analogous to systemverilog
×