Jump to content

KEVIN CHACKO

Members
  • Content Count

    10
  • 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. Thanks Stephan, for the temporary workaround.
  2. Hi , Yes by adding the raise and drop phase objection the problem is solvable, but not all run phase can afford having these objections. For eg: top_uvm2 is a uvm component that has a run phase which has a thread that has to be run forever; like a driver component. It cannot have phaise raise or drop objections because of this reason. top_uvm2 is instantiated inside top_uvm1 component. top_uvm1 component has a phase raise and drop objections to make sure the phase is persistent and does not get over. If the threads in top_uvm2 are in a SC_JOIN or SC_JOIN_None implementation(both commented in code) the whole system works fine without any errors but the issue is with the SC_JOIN_ANY implementation. class top_uvm2: public uvm::uvm_component{ public: sc_event e1,e2; void fun1() { for(;;){ //Could be the main reason for different results between SC_JOIN and SC_JOIN_ANY cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== Main_fun1========" << endl; wait(e1); cout<<"Current time is "<< sc_time_stamp() << endl; } } void fun2() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== Main_fun2========" << endl; wait(e2); cout<<"Current time is "<< sc_time_stamp() << endl; } void run_phase(uvm::uvm_phase& phase) { uvm::uvm_component::run_phase(phase); cout<< " run: before fork/join main" << endl; /* SC_FORK sc_spawn(sc_bind(&top_uvm2::fun1, this)), sc_spawn(sc_bind(&top_uvm2::fun2, this)) SC_JOIN*/ /* void(sc_spawn(sc_bind(&top_uvm1::fun1, this))); void(sc_spawn(sc_bind(&top_uvm1::fun2, this)));*/ std::vector<sc_process_handle> process_handles; process_handles.push_back(sc_spawn(sc_bind(&top_uvm2::fun1, this)) ); process_handles.push_back(sc_spawn(sc_bind(&top_uvm2::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(); } sc_core::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 main" << endl; wait(50,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } top_uvm2 (uvm::uvm_component_name name="uvm_top2") : uvm::uvm_component( name ) { } }; class top_uvm1: public uvm::uvm_component{ public: top_uvm2* top_uvm_2; void fun1() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== fun1========" << endl; wait(10,SC_NS); top_uvm_2->e1.notify(); cout<<"Current time is "<< sc_time_stamp() << endl; } void fun2() { cout<<"Current time is "<< sc_time_stamp() << endl; cout<< " =========== fun2========" << endl; wait(40,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; } void build_phase(uvm::uvm_phase& phase){ top_uvm_2 = new top_uvm2("top_2"); } void run_phase(uvm::uvm_phase& phase) { uvm::uvm_component::run_phase(phase); cout<< " run: before fork/join" << endl; phase.raise_objection(this); SC_FORK sc_spawn(sc_bind(&top_uvm1::fun1, this)), sc_spawn(sc_bind(&top_uvm1::fun2, this)) SC_JOIN cout << "run: after fork/join" << endl; wait(100,SC_NS); cout<<"Current time is "<< sc_time_stamp() << endl; phase.drop_objection(this); } top_uvm1 (uvm::uvm_component_name name="uvm_top1") : uvm::uvm_component( name ) { } }; int sc_main(int argc, char **argv) { top_uvm1* top_uvm_1; top_uvm_1 = new top_uvm1("top_1"); uvm::run_test(""); return 0; }
  3. Hi Philip, Here is the output of the simulation. I have observed that it works fine when you include phase.raise() and phase.drop() objection inside the run_phase. Well there are instances where you cannot afford to have these objections in every run_phase. SystemC 2.3.2-Accellera --- Dec 18 2018 15:43:13 Copyright (c) 1996-2017 by all Contributors, ALL RIGHTS RESERVED Universal Verification Methodology for SystemC (UVM-SystemC) Version: 1.0-beta2 Date: 2018-10-24 Copyright (c) 2006 - 2018 by all Contributors See NOTICE file for all Contributors ALL RIGHTS RESERVED Licensed under the Apache License, Version 2.0 UVM_INFO @ 0 s: reporter [RNTST] Running test ... run: before fork/join top_1.thread_p_0 Current time is 0 s =========== fun1======== top_1.thread_p_1 Current time is 0 s =========== fun2======== Fatal: (F565) invalid use of sc_(and|or)_event_list: list prematurely destroyed In file: ../../../src/sysc/kernel/sc_event.cpp:679 In process: uvm_top.uvm_phase_run_process.thread_p_1.thread_p_0.exec_proc_run_top_1_0 @ 0 s Info: (I99) simulation aborted run_c++: line 9: 5962 Aborted (core dumped) ./sc_main.o
  4. The wait statements inside the dynamically spawned threads are the cause of the problem. The waits cause the threads to terminate without completing.
  5. 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; }
  6. 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.
  7. 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; }
  8. 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
  9. How can I have a virtual interface in systemC analogous to systemverilog
  10. How can i implement SC_FORK JOIN_ANY and SC_FORK JOIN_NONE in systemC which is analogous to systemverilog
×